[FFmpeg-user] ffmpeg record from usb webcam give huge sync problem

Vlăduţ Frăţiman fratiman.vladut at gmail.com
Mon Feb 23 19:25:21 CET 2015


Ok.
First test:
$ ./ffmpeg -y -f v4l2 -video_size 640x360 -framerate 5 \
> -ts abs -i /dev/video0 \
> -f alsa -ac 1 -i hw:1,0 \
> -vcodec mpeg4 -vtag xvid -q 3 \
> -acodec libmp3lame -ab 96k \
> output.avi
ffmpeg version N-43517-gac424b2-   http://johnvansickle.com/ffmpeg/
Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.9.2 (Debian 4.9.2-10)
  configuration: --enable-gpl --enable-version3 --disable-shared
--disable-debug --enable-runtime-cpudetect --enable-libmp3lame
--enable-libx264 --enable-libx265 --enable-libwebp --enable-libspeex
--enable-libvorbis --enable-libvpx --enable-libfreetype
--enable-fontconfig --enable-libxvid --enable-libopencore-amrnb
--enable-libopencore-amrwb --enable-libtheora --enable-libvo-aacenc
--enable-libvo-amrwbenc --enable-gray --enable-libopenjpeg
--enable-libopus --enable-libass --enable-gnutls --enable-libvidstab
--cc=gcc-4.9
  libavutil      54. 19.100 / 54. 19.100
  libavcodec     56. 25.101 / 56. 25.101
  libavformat    56. 23.103 / 56. 23.103
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 11.100 /  5. 11.100
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
[video4linux2,v4l2 @ 0xa607a20] The driver changed the time per frame
from 1/5 to 2/15
[video4linux2,v4l2 @ 0xa607a20] Unknown timestamps
Input #0, video4linux2,v4l2, from '/dev/video0':
  Duration: N/A, start: 3768.386227, bitrate: 27648 kb/s
    Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422,
640x360, 27648 kb/s, 7.50 fps, 7.50 tbr, 1000k tbn, 1000k tbc
Guessed Channel Layout for  Input Stream #1.0 : mono
Input #1, alsa, from 'hw:1,0':
  Duration: N/A, start: 1424715579.013785, bitrate: 768 kb/s
    Stream #1:0: Audio: pcm_s16le, 48000 Hz, 1 channels, s16, 768 kb/s
Output #0, avi, to 'output.avi':
  Metadata:
    ISFT            : Lavf56.23.103
    Stream #0:0: Video: mpeg4 (xvid / 0x64697678), yuv420p, 640x360,
q=2-31, 200 kb/s, 7.50 fps, 7.50 tbn, 7.50 tbc
    Metadata:
      encoder         : Lavc56.25.101 mpeg4
    Stream #0:1: Audio: mp3 (libmp3lame) (U[0][0][0] / 0x0055), 48000
Hz, mono, s16p, 96 kb/s
    Metadata:
      encoder         : Lavc56.25.101 libmp3lame
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> mpeg4 (native))
  Stream #1:0 -> #0:1 (pcm_s16le (native) -> mp3 (libmp3lame))
Press [q] to stop, [?] for help
[video4linux2,v4l2 @ 0xa607a20] Unknown timestamps
    Last message repeated 12 times
frame=    4 fps=0.0 q=3.0 size=      31kB time=00:00:00.53 bitrate=
474.1kbits/s[video4linux2,v4l2 @ 0xa607a20] Unknown timestamps
    Last message repeated 3 times
frame=    8 fps=7.9 q=3.0 size=      60kB time=00:00:01.06 bitrate=
457.4kbits/s[video4linux2,v4l2 @ 0xa607a20] Unknown timestamps
    Last message repeated 2 times
frame=   11 fps=7.3 q=3.0 size=      88kB time=00:00:01.60 bitrate=
448.8kbits/s[video4linux2,v4l2 @ 0xa607a20] Unknown timestamps
    Last message repeated 3 times
frame=   15 fps=7.4 q=3.0 size=     119kB time=00:00:02.13 bitrate=
456.9kbits/s[video4linux2,v4l2 @ 0xa607a20] Unknown timestamps
    Last message repeated 2 times
frame=   18 fps=7.1 q=3.0 size=     145kB time=00:00:02.53 bitrate=
467.4kbits/s[video4linux2,v4l2 @ 0xa607a20] Unknown timestamps
    Last message repeated 1 times
frame=   20 fps=6.6 q=3.0 size=     159kB time=00:00:03.06 bitrate=
424.5kbits/s[video4linux2,v4l2 @ 0xa607a20] Unknown timestamps
    Last message repeated 4 times
frame=   23 fps=6.5 q=3.0 size=     178kB time=00:00:03.60 bitrate=
405.4kbits/s[video4linux2,v4l2 @ 0xa607a20] Unknown timestamps
    Last message repeated 6 times
frame=   27 fps=6.7 q=3.0 size=     202kB time=00:00:05.06 bitrate=
326.4kbits/sframe=   27 fps=6.1 q=3.0 Lsize=     218kB
time=00:00:05.06 bitrate= 352.4kbits/s dup=0 drop=6
video:156kB audio:47kB subtitle:0kB other streams:0kB global
headers:0kB muxing overhead: 7.365676%

--------------------------------
second test:
$ ./ffmpeg -y -f v4l2 -video_size 640x360 -framerate 5 \
> -ts mono2abs -i /dev/video0 \
> -f alsa -ac 1 -i hw:1,0 \
> -vcodec mpeg4 -vtag xvid -q 3 \
> -acodec libmp3lame -ab 96k \
> output.avi
ffmpeg version N-43517-gac424b2-   http://johnvansickle.com/ffmpeg/
Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.9.2 (Debian 4.9.2-10)
  configuration: --enable-gpl --enable-version3 --disable-shared
--disable-debug --enable-runtime-cpudetect --enable-libmp3lame
--enable-libx264 --enable-libx265 --enable-libwebp --enable-libspeex
--enable-libvorbis --enable-libvpx --enable-libfreetype
--enable-fontconfig --enable-libxvid --enable-libopencore-amrnb
--enable-libopencore-amrwb --enable-libtheora --enable-libvo-aacenc
--enable-libvo-amrwbenc --enable-gray --enable-libopenjpeg
--enable-libopus --enable-libass --enable-gnutls --enable-libvidstab
--cc=gcc-4.9
  libavutil      54. 19.100 / 54. 19.100
  libavcodec     56. 25.101 / 56. 25.101
  libavformat    56. 23.103 / 56. 23.103
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 11.100 /  5. 11.100
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
[video4linux2,v4l2 @ 0xbc28a20] The driver changed the time per frame
from 1/5 to 2/15
[video4linux2,v4l2 @ 0xbc28a20] Detected monotonic timestamps, converting
Input #0, video4linux2,v4l2, from '/dev/video0':
  Duration: N/A, start: 1424715824.973374, bitrate: 27648 kb/s
    Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422,
640x360, 27648 kb/s, 7.50 fps, 7.50 tbr, 1000k tbn, 1000k tbc
Guessed Channel Layout for  Input Stream #1.0 : mono
Input #1, alsa, from 'hw:1,0':
  Duration: N/A, start: 1424715814.786186, bitrate: 768 kb/s
    Stream #1:0: Audio: pcm_s16le, 48000 Hz, 1 channels, s16, 768 kb/s
Output #0, avi, to 'output.avi':
  Metadata:
    ISFT            : Lavf56.23.103
    Stream #0:0: Video: mpeg4 (xvid / 0x64697678), yuv420p, 640x360,
q=2-31, 200 kb/s, 7.50 fps, 7.50 tbn, 7.50 tbc
    Metadata:
      encoder         : Lavc56.25.101 mpeg4
    Stream #0:1: Audio: mp3 (libmp3lame) (U[0][0][0] / 0x0055), 48000
Hz, mono, s16p, 96 kb/s
    Metadata:
      encoder         : Lavc56.25.101 libmp3lame
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> mpeg4 (native))
  Stream #1:0 -> #0:1 (pcm_s16le (native) -> mp3 (libmp3lame))
Press [q] to stop, [?] for help
Past duration 0.960197 too large    238kB time=00:00:04.13 bitrate=
471.0kbits/s dup=0 drop=4
frame=   55 fps=5.4 q=3.0 Lsize=     527kB time=00:00:10.26 bitrate=
420.2kbits/s dup=0 drop=10
video:401kB audio:105kB subtitle:0kB other streams:0kB global
headers:0kB muxing overhead: 4.251526%


More information about the ffmpeg-user mailing list