[FFmpeg-user] pipe from /dev/video to /dev/video adding a delay - syncing issues
Moritz Barsnick
barsnick at gmx.net
Thu Jun 27 10:27:04 EEST 2019
On Wed, Jun 26, 2019 at 21:17:11 +0200, Javier Infante Porro wrote:
> I am trying to create a video device using another video device, adding a 20 seconds extra delay.
> Also, i will create on the fly a custom countdown video before my delayed stream starts.
[...]
> But whenever i try to push the stream back to the the /dev/video20
> device, it works, but the countdown goes real fast (like 10x faster),
> and then video tries to catch up and keeps around a 2 second delay:
>
> ffmpeg -loglevel 43 -y -loop 1 -r 28 -t 20 -i bg.jpg -f v4l2 -thread_queue_size 512 -i /dev/video0 -filter_complex "[0:v:0]setpts=N/(28*TB),drawtext=fontfile='/usr/share/fonts/truetype/msttcorefonts/Georgia.ttf':fontcolor=yellow:fontsize=40:x=(w-text_w)/2:y=(h-text_h)/2:text='%{eif\:20-t\:d}'[count]; [count] [1:v:0] concat=n=2:v=1:a=0:unsafe=1 [v];[v]scale=852:480[out]" -map "[out]" -an -pix_fmt yuv420p -f v4l2 -r 28 /dev/video20
The input image is processed "as fast as possible" by ffmpeg, while the
v4l2 input stream is "realtime" by nature.
It should suffice to add "-re" as an input option to the first input:
$ ffmpeg -loglevel 43 -y -re -loop 1 -r 28 -t 20 -i bg.jpg -f v4l2 [...]
^^^
Hope this helps,
Moritz
More information about the ffmpeg-user
mailing list