Pipe rpicam-vid into ffmpeg to draw text overlays

The Raspberry Pi is a series of credit card-sized single-board computers developed in the United Kingdom by the Raspberry Pi Foundation to promote the teaching of basic computer science in schools and developing countries.

Post Reply
User avatar
/RaspberryPi
Corporate
Posts: 2449
Joined: Wed Jun 05, 2019 1:29 am

Pipe rpicam-vid into ffmpeg to draw text overlays

Post by /RaspberryPi »


Hey folks, I'm using the following command to pipe my Pi Camera V3 module into ffmpeg in order to overlay timestamps frame after frame:

rpicam-vid \ -t 30000 \ --width 1920 --height 1080 \ -o - \ | \ ffmpeg \ -y \ -i - \ -vf "\ drawtext=x=50:y=(h-50-30-10-40):fontcolor=white:fontsize=40:text=%{localtime} \ " \ test.h264

Unfortunately, the output video is encoded at around 2x the speed. For instance, a 1 minute long input video stream from rpicam-vid results in just a 16s video out of ffmpeg.

I'm tempted to use the -c:v copy flag that copies the encoding of the rpicam-vid video stream over to the output file but then again video filters cannot be used with copy. I've tried various other flags such as --framerate 30, -r 30, and -vsync 1 but they all result in the same output, which is a video that is way shorter in length and also sped up.

Any thoughts on how to go about this?
submitted by /u/the-Geeky-Lad
[link] [comments]

Source: https://www.reddit.com/r/raspberry_pi/c ... _overlays/
/RaspberryPi
Post Reply

Return to “Raspberry Pi Forum”