My Objective : To Transcode mjpeg stream from ip camera to youtube using ffmpeg

My Command :

ffmpeg -re -f mjpeg -i "" -c copy -movflags +faststart  -vcodec libx264 -f flv "rtmp://a.rtmp.youtube.com/live2/<key>"

My Reference for above effort : Streaming Guide

But when i try to run the command, it seems something is being transcoded and transmitted but youtube live i am not able to see anything, below is the screenshot of command output

enter image description here

  • -c copy and -vcodec libx264` conflict with each other and -movflags +faststart only applies to mp4s, which you are not using. I recommend you take some time to know what these flags do. – SlimSCSI Jul 10 '19 at 20:11

Last time I checked, Youtube requires an audio stream even if there is no input audio, so supply a dummy one.

ffmpeg -re -f mjpeg -i "" -f lavfi -i anullsrc -c:v libx264 -g 60 -c:a aac -ar 44100 -ac 2 -f flv "rtmp://a.rtmp.youtube.com/live2/<key>"
  • almost worked, but there is a resolution problem, even though the resolution of my IP Cam is set to 1024x768 , youtube says the resolution 600x800, any default settings of ffmpeg causing this ? – Mi Ubi Jul 10 '19 at 16:07
  • 1
    No, your input resolution is 800x600. See the properties for Input #0 in your image. – Gyan Jul 10 '19 at 16:23
  • You were right, YouTube does require an audio stream. I removed the -an from my pipeline, to restore audio, and it started working properly. – Trevor Sullivan Dec 20 '19 at 22:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.