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

bob Darkblue darkbluewonderfulworld at gmail.com
Sat Dec 3 17:18:20 EET 2016


Update to previous mail :
Still not working with git version

./ffmpeg -re -f v4l2 -fflags nobuffer  -framerate 15 -video_size 1280x720
-input_format mjpeg -i /dev/video1 -f v4l2 -re -fflags nobuffer -framerate
15  -input_format mjpeg -video_size 1280x720 -i /dev/video0 -filter_complex
"
> nullsrc=size=2560x720 [background];
> [0:v]  scale=1280x720 [left];
> [1:v]  scale=1280x720 [right];
> [background][left]       overlay=shortest=1       [background+left];
> [background+left][right] overlay=shortest=1:x=1280 [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: 6803.700184, 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: 6804.458933, 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 @ 0x338b480] deprecated pixel format used, make sure you did set
range correctly
[swscaler @ 0x33c24c0] 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 [SAR 1:1 DAR 32:9],
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) -> scale
  Stream #1:0 (mjpeg) -> scale
  overlay -> Stream #0:0 (mpeg4)
Press [q] to stop, [?] for help
frame=    8 fps=0.0 q=2.1 size=     271kB time=00:00:00.46
bitrate=4758.4kbits/sframe=   16 fps= 16 q=13.5 size=     294kB
time=00:00:01.00 bitrate=2411.8kbits/

On Sat, Dec 3, 2016 at 4:14 PM, bob Darkblue <
darkbluewonderfulworld at gmail.com> wrote:

> >> [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
>
> I've also tried to remove the option and also tried with setpts=PTS but
> there is still a ~1s synchronization issue.
>
>
> >>> ffmpeg version 3.2 Copyright (c) 2000-2016 the FFmpeg developers
>
> >Please remember to test current FFmpeg git head before asking
> >for support here.
>
> I'm currently compiling it. Will retest on the git version when the
> compilation is done.
>
>
>
>
> On Sat, Dec 3, 2016 at 3:46 PM, Carl Eugen Hoyos <ceffmpeg at gmail.com>
> wrote:
>
>> 2016-12-03 15:26 GMT+01:00 bob Darkblue <darkbluewonderfulworld at gmail.com
>> >:
>>
>> > It works but there is a delay of ~1 second between the two screens.
>>
>> > 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 "
>> > nullsrc=size=2560x720 [background];
>>
>> > [0:v] setpts=PTS-STARTPTS,
>> > [1:v] setpts=PTS-STARTPTS,
>>
>> Isn't this making sure that the two streams are not synchronised?
>>
>> > ffmpeg version 3.2 Copyright (c) 2000-2016 the FFmpeg developers
>>
>> Please remember to test current FFmpeg git head before asking
>> for support here.
>>
>> 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