[FFmpeg-user] Can't synchronize two webcam streams side by side using ffmpeg

bob Darkblue darkbluewonderfulworld at gmail.com
Sat Dec 3 19:50:37 EET 2016


When I try with the hstack filter :
it stills have a synchronisation issue but it outputs a probably useful
warning :


*"Past duration 0.979973 too large"*
Maybe you know what it means ? At least it gives a lead to follow.

./ffmpeg -f v4l2   -framerate 15 -video_size 1280x720 -input_format mjpeg
-i /dev/video1 -f v4l2 -framerate 15  -input_format mjpeg -video_size
1280x720 -i /dev/video0 -filter_complex "
[0:v][1:v]hstack [left+right]" -map [left+right] -r 15 -fflags nobuffer  -f
rtp_mpegts rtp://192.168.0.5:8888


ffmpeg version N-82748-g5a237c3 Copyright (c) 2000-2016 the FFmpeg
developers
  built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609
  configuration: --disable-yasm
  libavutil      55. 41.101 / 55. 41.101
  libavcodec     57. 66.109 / 57. 66.109
  libavformat    57. 58.101 / 57. 58.101
  libavdevice    57.  2.100 / 57.  2.100
  libavfilter     6. 68.100 /  6. 68.100
  libswscale      4.  3.101 /  4.  3.101
  libswresample   2.  4.100 /  2.  4.100
Input #0, video4linux2,v4l2, from '/dev/video1':
  Duration: N/A, start: 15838.916456, bitrate: N/A
    Stream #0:0: Video: mjpeg, yuvj422p(pc, bt470bg/unknown/unknown),
1280x720, -2 kb/s, 15 fps, 15 tbr, 1000k tbn, 1000k tbc
Input #1, video4linux2,v4l2, from '/dev/video0':
  Duration: N/A, start: 15839.810583, bitrate: N/A
    Stream #1:0: Video: mjpeg, yuvj422p(pc, bt470bg/unknown/unknown),
1280x720, -2 kb/s, 15 fps, 15 tbr, 1000k tbn, 1000k tbc
[swscaler @ 0x295f000] deprecated pixel format used, make sure you did set
range correctly
Output #0, rtp_mpegts, to 'rtp://192.168.0.5:8888':
  Metadata:
    encoder         : Lavf57.58.101
    Stream #0:0: Video: mpeg4, yuv420p, 2560x720, q=2-31, 200 kb/s, 15 fps,
90k tbn, 15 tbc (default)
    Metadata:
      encoder         : Lavc57.66.109 mpeg4
    Side data:
      cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1
Stream mapping:
  Stream #0:0 (mjpeg) -> hstack:input0
  Stream #1:0 (mjpeg) -> hstack:input1
  hstack -> Stream #0:0 (mpeg4)
Press [q] to stop, [?] for help
Past duration 0.979973 too large
Past duration 0.999535 too large
frame=    8 fps=0.0 q=6.0 size=     113kB time=00:00:00.46
bitrate=1981.0kbits/sPast duration 0.979973 too large
frame=   15 fps= 15 q=11.4 size=     160kB time=00:00:00.93
bitrate=1400.3kbits/Past duration 0.979973 too large
Past duration 0.999977 too large
frame=   23 fps= 15 q=12.3 size=     178kB time=00:00:01.46 bitrate=
992.5kbits/Past duration 0.979973 too large
Past duration 0.999947 too large
Past duration 0.979958 too large





On Sat, Dec 3, 2016 at 5:59 PM, Carl Eugen Hoyos <ceffmpeg at gmail.com> wrote:

> 2016-12-03 16:14 GMT+01:00 bob Darkblue <darkbluewonderfulworld at gmail.com
> >:
> >>> [0:v] setpts=PTS-STARTPTS,
> >>> [1:v] setpts=PTS-STARTPTS,
> >
> >>Isn't this making sure that the two streams are not synchronised?
> > I copy pasted it from
> > https://trac.ffmpeg.org/wiki/Create%20a%20mosaic%20out%
> 20of%20several%20input%20videos
> >
> > I don't understand it quite well but it should take care of the little
> > difference in start time between :
> > Input #0, video4linux2,v4l2, from '/dev/video1':
> >   Duration: N/A, start:* 858.256014*, bitrate: N/A
> >  ...
> > Input #1, video4linux2,v4l2, from '/dev/video0':
> >   Duration: N/A, start:* 858.878636*, bitrate: N/A
>
> It "takes care" insofar as it removes any difference
> from the timestamps of the two streams.
>
> > I've also tried to remove the option and also tried with setpts=PTS but
> > there is still a ~1s synchronization issue.
>
> Please also try the hstack video filter.
>
> Carl Eugen
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
>


More information about the ffmpeg-user mailing list