Alex Serban
Alex Serban

Reputation: 39

How do I correct the ffmpeg to stream my mp4?

I'm trying to setup a live stream from my raspberry pi to youtube using ffmpeg, but the stream fails to start

I've tried first streaming an MP4 file I've captured using raspivid to figure out how ffmpeg works. I've captured a 10 mins video, at 426x240, bitrate 222kbps, 25 frames/sec and tried streaming.

ffmpeg -re -i "video4-10min.mp4" -acodec libmp3lame -ar 44100 -b:a 128k -pix_fmt yuv420p -profile:v baseline -s 426x240 -bufsize 2048k -vb 222k -maxrate 800k -deinterlace -vcodec libx264 -preset medium -g 30 -r 30 -f flv "rtmp://a.rtmp.youtube.com/live2/[my-stream-key]"

Stream looks like it's starting, the health prompt says: "4:48 PM Good Stream is healthy / Stream health is excellent." but in a few secs goes to: "4:48 PM No data No active stream", even though the ffmpeg looks like it's streaming accurately: "frame= 1061 fps= 25 q=-1.0 Lsize= 1205kB time=00:00:42.40 bitrate= 232.9kbits/s speed=0.994x"

Upvotes: 1

Views: 1845

Answers (1)

Gyan
Gyan

Reputation: 93299

YT requires an audio stream. Add a dummy one.

ffmpeg -re -i "video4-10min.mp4" -f lavfi -i anullsrc -acodec libmp3lame -ar 44100 -b:a 128k -pix_fmt yuv420p -profile:v baseline -s 426x240 -bufsize 2048k -vb 222k -maxrate 800k -deinterlace -vcodec libx264 -preset medium -g 30 -r 30 -f flv "rtmp://a.rtmp.youtube.com/live2/[my-stream-key]

Upvotes: 1

Related Questions