I was able to figure out all of my libcamera stream settings needed to stream video from my Camera Module 3 and audio from a USB microphone in my RPi Zero W 2 straight to YouTube, which is as follows:

libcamera-vid -t 0 -g 10 --bitrate 4500000 --inline --width 1920 --height 1080 --framerate 30 --rotation 180 --codec libav --libav-format flv --libav-audio --audio-bitrate 192000 --av-sync 200000 -n -o tmp://a.rtmp.youtube.com/live2/[STREAM-KEY]

My question is: why do all of the other streaming pipelines I've seen online require the use of FFmpeg? Every single tutorial I have ever seen on streaming video to RTMP with a Raspberry Pi involves piping the feed into FFmpeg first, which seems super complicated and unnecessary.

Is there some benefit to doing that? Is it more efficient somehow? Why can't I just use libcamera-vid and output straight to RTMP as indicated above?

Would appreciate some insight into this, thanks!

Edit: Just to clarify, this is already working perfectly with RTMP. I want to understand why this works, and why I don't have to pipe it into FFmpeg like literally everyone else on Earth who is using libcamera to stream.

  • straight to RTMP ... RTMP is Real-Time Messaging Protocol - I would posit that libcamera-vid doesn't know that particular protocol Apr 3 at 8:48
  • But it CAN stream to RTMP. I already did it. So what's the issue? Apr 3 at 15:52
  • oh, libcamera-vid can? then I must've misunderstood the question Apr 3 at 22:25
  • My question is: why does every code example I find on the web that uses libcamera-vid pipe the result into ffmpeg when the libav codec already does this natively? Do people just not understand what libcamera can do? Apr 5 at 3:55
  • Perhaps they are using libcamera-apps-lite, which does not use libav Apr 5 at 5:54


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.