Using ffmpeg with 64mp Hawkeye camera

I just received the new 64mp Hawkeye Pivariety camera. It’s configured and working correctly, but I’m curious if anyone has had success using ffmpeg to stream with it. Prior to getting this camera, I was using a V1 camera with the standard drivers, and I had some solid homegrown scripts that would stream to YouTube, while at the same time, they created local MP4 and MP3 files (ffmpeg is a phenomenal program, capable of multiple streams with very little CPU overhead).
With this old setup, ffmpeg could access the /dev/video0 directly, so I didn’t need raspivid or anything else.

Questions:
1). With the new Pivariety camera, apparently ffmpeg can no longer directly access it, so I had to “pipe” output from libcamera-vid into ffmpeg.
Is that correct? Or does anyone know a way to directly feed ffmpeg from the camera driver?
I’m just wanting to keep CPU usage to a minimum, so the less programs running, the better.

2). When using the “-bitrate” option in libcamera-vid, no matter what value I set, it doesn’t seem to lock in on it. The ffmpeg informational output shows a varying bitrate that seems to ignore my desired rate. (With the old standard camera, whatever rate I set via v4l2-ctl prior to running ffmpeg, that rate would hold rock solid when ffmpeg encoded.)
Can anyone confirm that “-bitrate” works? Can you give examples? Perhaps I’m using it wrong.

Here’s an example of how I’m using it now, with the new camera. This runs a 60-second test stream:

libcamera-vid --nopreview --autofocus --gain 5 --metering average --exposure normal --ev 1 --awb indoor --intra 48 --codec h264 --width 1920 --height 1080 --rotation 0 --brightness 0.1 --contrast 1.3 --saturation 1.2 --sharpness 1.3 --framerate 24 --bitrate 5000000 --timeout 60 --output - | \
ffmpeg -loglevel info -hide_banner \
-fflags +genpts -use_wallclock_as_timestamps 1 -avoid_negative_ts auto \
-thread_queue_size 8192 -framerate 24 -i - \
-itsoffset 0.95 -f alsa -thread_queue_size 32768 -ac 1 -i hw:3,0 \
-vcodec copy -acodec aac -ac 1 -ar 44100 -b:a 128k -b:v 5000k -maxrate 5000k -bufsize 10000k -f flv -t 60000 rtmp://a.rtmp.youtube.com/live2/${MY_YT_KEY}

1 Like