[FFmpeg-user] pipe from /dev/video to /dev/video adding a delay - syncing issues

Javier Infante Porro jabi at irontec.com
Thu Jun 27 12:54:16 EEST 2019



----- Mensaje original -----
> De: "Nicolas George" <george at nsup.org>
> Para: "FFmpeg user questions" <ffmpeg-user at ffmpeg.org>
> Enviados: Jueves, 27 de Junio 2019 11:23:10
> Asunto: Re: [FFmpeg-user] pipe from /dev/video to /dev/video adding a delay - syncing issues
> 
> Javier Infante Porro (12019-06-27):
> > > For a regular countdown, you need an accurate timestamp. You are killing
> > > your timestamps with the setpts filter: why do you do it?
> > I am not using it anymore... it's something i forgot inside the filter
> > chain...
> 
> That does not answer the question about why you put it in the first
> place.

Yes sorry, I put it trying to make it work before I realize the "-re" option.
I was using setpts=N/(28*TB) as a filter on the countdown input, trying to "force" de video to use 28 fps. (huge mistake i guess)



> > Right now i am using the -re switch (as Moritz suggest me in this thread),
> 
> That was a mistake. Devices already are timed.

 
> > I am guessing it has sometyhing to do with the "-ts  parameter on the v4l2
> > input
> 
> You did not set the -ts option on the v4l input. If you want efficient
> help here, you need to be very careful when showing your command lines.
>
> > or maybe using the pts filter... but i am out of luck so far.
> 
> As I told you, no setpts filter, you are killing the timestamps you
> need.

Ok, thank you for your advice. 

I have seen in the log v4l2 detects monotonic timestamps:
[video4linux2,v4l2 @ 0x56150895f400] Detected monotonic timestamps, converting

So i have tried:

TIME=5
ffmpeg -loglevel 48 -y -re -loop 1 -r 28 -t $TIME -i bg.jpg -f v4l2 -thread_queue_size 512 -ts mono2abs -framerate 28 -i /dev/video30 -filter_complex \
"[0:v:0]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\:$TIME+1-t\:d}\'[count]; \
   [1:v:0]fps=28[live];[count] [live] 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


But the result its the same with and without "-ts": The nice 5 seconds timeout, a few real-fast frames, and the a ~2 seconds delayed-time video (when it should be 5 seconds delayed).


And again, using the fps filter on the 1:v:0 input is useless, as i get the same output:

TIME=5
ffmpeg -loglevel 48 -y -re -loop 1 -r 28 -t $TIME -i bg.jpg -f v4l2 -thread_queue_size 512 -ts mono2abs -framerate 28 -i /dev/video30 -filter_complex \
"[0:v:0]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\:$TIME+1-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


Anyway, thanks for your time and will keep investigating (and keeping away from setpts filter)
All thought i am running out of ideas... 

Greets!




More information about the ffmpeg-user mailing list