2

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 rtmp://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?

I would appreciate some insight into this.

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.

Greenonline
  • 2,969
  • 5
  • 27
  • 38

2 Answers2

1

Based on my experience, directly streaming from libcamera-vid uses less resource and is much better. I used to stream using ffmpeg before i realize that installing the full libcamera-apps instead of lite package allows you to stream from libcamera with lower latency. You can still use ffmpeg if you are more familiar with ffmpeg configuration parameters and are not solely using PiCamera. libcamera won't work with USB cameras.

1

Works well. I use Camera Module 3 and no audio in my RPi P4 straight to YouTube, but I got errors like:

Mistake
YouTube does not receive enough video data to ensure smooth streaming without buffering.
09:57
Mistake
Your encoder sends data faster than real time (several seconds of video per second). You need to set a limit of approximately one second of video per second for uploading your live video.
09:57
Suggestion
The audio stream's current bitrate of 0 is below the recommended bitrate. We recommend using an audio stream bitrate of 128 Kbps.
Greenonline
  • 2,969
  • 5
  • 27
  • 38