av_interleaved_write_frame(): Connection reset by peer youtube. - youtube

i want to live stream to youtube with ffmpeg but i take error " av_interleaved_write_frame(): Connection reset by peer". i send stream with FMLE its works nice.
ffmpeg -re -i /mnt/windows/21.mpg -r 30 -s 854x480 -c:v libx264 -c:a libfdk_aac -f mpegts "rtmp://a.rtmp.youtube.com/live2/hasanbagcaci.3s3v-pkwx-g64b-5zgz" -force_key_frames "expr:gte(t,n_forced*1)"
thanks for helping

I found a way to send a livestream to YouTube:
ffmpeg -re -i /mnt/windows/21.mpg -r 30 -s 854x480 -c:v libx264 -c:a libfdk_aac -force_key_frames "expr:gte(t,n_forced*4)" -f flv "rtmp://a.rtmp.youtube.com/live2/hasanbagcaci.3s3v-pkwx-g64b-5zgz"

Related

FFMpeg - PhantomJS to Youtube Live

I'm trying to stream a webpage captured with PhantomJS to Youtube using FMMpeg.
This is the command I use:
xvfb-run phantomjs --web-security=no render.js | ffmpeg -threads 0 -y -v verbose -c:v png -r 30 -f image2pipe -i - -f lavfi -i anullsrc -strict -2 -acodec aac -ac 1 -ar 44100 -b:a 128k -c:v libx264 -s 1280x720 -pix_fmt yuv420p -f flv "rtmp://a.rtmp.youtube.com/live2/key";
And the render.js code:
http://pastebin.com/raw/X9gv8iGH
It looks like it's streaming, but no feed is received by YouTube, and I can't see where the problem is.
Outpout from my console
Try this:
phantomjs --web-security=no render.js | ffmpeg -threads 0 -y -v verbose -c:v png -framerate 33 -f image2pipe -i - -f lavfi -i anullsrc -strict -2 -acodec aac -ac 1 -ar 44100 -b:a 128k -c:v libx264 -s 1280x720 -pix_fmt yuv420p -g 60 -r 30 -f flv "rtmp://a.rtmp.youtube.com/live2/key";
Parameter -framerate:
You can specify two frame rates: input and output.
Set input frame rate with the -framerate input option (before -i). The default for reading inputs is -framerate 25 which will be set if
no -framerate is specified.
The output frame rate for the video stream by setting -r after -i or by using the fps filter.
So in your case framerate should be 1/period_from_phantomjs which is 1000/30 = 33.33
As for the -g 60, that will add a key frame every 2 seconds, which is probably a requirement for the youtube streaming api (I know that for facebook it is).

How to Live Stream YouTube without Audio [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 years ago.
Improve this question
I have two IP cam and a computer with ffmpeg to re-stream them to YouTube.
First Cam
It has Video and Audio. I can re-stream to YouTube successfully with this command.
ffmpeg -re -rtsp_transport tcp -i rtsp://192.168.aaa.bbb:554/ch0_1.h264 -acodec libmp3lame -ar 44100 -b:a 128k -pix_fmt yuv420p -profile:v baseline -s 426x240 -bufsize 2048k -vb 400k -maxrate 800k -deinterlace -vcodec libx264 -preset medium -g 30 -r 30 -f flv rtmp://a.rtmp.youtube.com/live2/<YouTube_key>
Second Cam
It has Video only. However, with both commands below, I can't stream to YouTube. (although the ffmpeg process is running well)
ffmpeg -re -rtsp_transport tcp -i rtsp://192.168.aaa.ccc/Streaming/Channels/102 -an -pix_fmt yuv420p -profile:v baseline -s 426x240 -bufsize 2048k -vb 400k -maxrate 800k -deinterlace -vcodec libx264 -preset medium -g 30 -r 30 -f flv rtmp://a.rtmp.youtube.com/live2/<YouTube_key>
or
ffmpeg -re -rtsp_transport tcp -i rtsp://192.168.aaa.ccc/Streaming/Channels/102 -acodec libmp3lame -ar 44100 -b:a 128k -pix_fmt yuv420p -profile:v baseline -s 426x240 -bufsize 2048k -vb 400k -maxrate 800k -deinterlace -vcodec libx264 -preset medium -g 30 -r 30 -f flv rtmp://a.rtmp.youtube.com/live2/<YouTube_key>
I've test both camera's stream first using FLV, and they work well. So, the issue is not the URL of IP camera.
From what I understand, YouTube define stream as audio-video content. However, what if the source only has Video.
So, my question:
How to live stream YouTube without audio, specially from an IP cam?
Thanks
Generate a dummy audio and try
ffmpeg -re -rtsp_transport tcp -i rtsp://192.168.aaa.ccc/Streaming/Channels/102
-f lavfi -i anullsrc
-pix_fmt yuv420p -profile:v baseline -s 426x240 -bufsize 2048k -vb 400k -maxrate 800k
-deinterlace -vcodec libx264 -preset medium -g 30 -r 30
-acodec libmp3lame -ar 44100 -b:a 128k
-f flv rtmp://a.rtmp.youtube.com/live2/<YouTube_key>

ffmpeg stream file to crtmp - How to change the resolution?

I'm using ffmpeg - streaming local file to crtmpserver (or other server):
ffmpeg.exe -re -i file.avi -vcodec libx264 -preset veryfast -acodec aac -strict experimental -f flv rtmp://256.257.0.0:1935/flvplayback/live
How to change the resolution? File has a resolution 1920x1080, but I want to send only 640x360.
-s 640x360 does not work.
Use -vf scale=640:360.
ffmpeg.exe -re -i file.avi -vf scale=640:360 -vcodec libx264 -preset veryfast -acodec aac -strict experimental -f flv rtmp://256.257.0.0:1935/flvplayback/live

Adding 2 pictures to a video with avconv

Here is the command that I am using to add a logo to a stream
avconv -f alsa -i pulse -f x11grab -s hd720 -i :1.0+nomouse -vf "movie=logo.png [watermark]; [in][watermark] overlay=10:10 [out]" -acodec libvo_aacenc -vcodec libx264 -threads auto -f flv rtmp://server
How can I add a second picture to the stream? Is there a way to do this without using -filter_complex as it's not available?
Thank you.
Yes, just add another set of movie and overlay filters. Something like (split over multiple lines for clarity)
-vf "
movie=logo1.png [watermark1];
movie=logo2.png [watermark2];
[in][watermark1] overlay=x1:y1 [watermarked1];
[watermarked1][watermark2]overlay=x2:y2[out]
"

Http Live Streaming Delay on iPhone

With this code I see the stream of my desktop in a iPhone:
vlc -I dummy screen:// vlc://quit --sout='#transcode{threads=300,width=554,height=367,fps=30,vcodec=h264,vb=500000,venc=x264{aud,profile=baseline,level=30,keyint=30,bframes=0,ref=1}}:duplicate{dst=std{access=livehttp{seglen=10,delsegs=true,numsegs=100,index=/var/www/streaming/mystream.m3u8,index-url=http://localhost/streaming/mystream-########.ts},mux=ts{use-key-frames},dst=/var/www/streaming/mystream-########.ts}};
but I have a big delay, like 30-40 second... Do you know how to reduce this delay?
All I want is:
• Stream clearly the desktop for a 600x400 window in a iPhone
• No audio
• MAX delay of 1-2 second
Do you know how to do a stream?
The Best stream I get is from ffmpeg, but there is always 7-8 seconds of delay.
This is the string:
ffmpeg -f x11grab -s `xdpyinfo | grep 'dimensions:'|awk '{print $2}'` -r 25 -i :0.0 -pix_fmt yuv420p -vcodec libx264 -acodec libfaac -r 25 -profile:v baseline -b:v 1500k -x264opts keyint=25 -s 640x360 -map 0 -flags -global_header -f segment -segment_list index_1500.m3u8 -segment_time 1 -segment_format mpeg_ts -segment_list_type m3u8 -segment_list_flags +live -segment_list_size 1 segment%05d.ts

Resources