[Libav-user] help with raw fifo as movie src & overlay

Andrey Utkin andrey.krieger.utkin at gmail.com
Mon Feb 13 12:02:11 CET 2012


2012/2/13  <gstream at ccc2.com>:
> Hi All,
>
> I am hoping you can help with getting the libavfilter movie and overlay
> working correctly.
>
> My objective is to get two RTSP camera feeds to go side by side in sync.
>
> I started with the below that works to transmit the final image but due to
> the loading times of each overlay the streams are out of sync.
>
> ffmpeg  -loop_input -i 800x600.jpg -an -s 1288x360 -vf
> 'movie=rtsp\\://192.168.20.112\\:551/channel1,scale=640:352[wm];
>  movie=rtsp\\://192.168.20.111\\:551/channel1,scale=640:352[wm2];
> [in][wm] overlay=2:4[in+wm];
> [in+wm][wm2] overlay=646:4 [out]'
> -s 1288x360 -vcodec rawvideo /home/fifo/mpegpipe99.yuv
>
> so firstly, is there a way I can add a video buffer to the first overlay
> so it syncs with the second?

I assume you have de-sync of nearly 5 seconds, with video coming from
first mentioned URL coming late. Is that correct?
If so, point must be the streams recognition delay (during opening). I
suspect that libavfilter opens your sources sequentially, not in
parallel. (Just speculations, haven't check in sources.)
You could try adding to second source the "setpts" filter, to shift
its timestamps. So your invoke should look like

ffmpeg  -loop_input -i 800x600.jpg -an -s 1288x360 -vf
'movie=rtsp\\://192.168.20.112\\:551/channel1,scale=640:352[wm];
 movie=rtsp\\://192.168.20.111\\:551/channel1,scale=640:352,setpts=PTS+5[wm2];
[in][wm] overlay=2:4[in+wm];
[in+wm][wm2] overlay=646:4 [out]'
-s 1288x360 -vcodec rawvideo /home/fifo/mpegpipe99.yuv

If that doesn't help, imo it requires hacking libavfilter or writing
an application.

-- 
Andrey Utkin


More information about the Libav-user mailing list