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

Vlăduţ Frăţiman fratiman.vladut at gmail.com
Sun Feb 22 08:42:40 CET 2015


Hi!
I try to use ffmpeg to record from an usb cam (microsoft HD-3000).
Command for record look like this:

ffmpeg -y -f v4l2 -s 640x360 -framerate 5 -i /dev/video0 -f alsa -ac 1
-i default:CARD=HD3000
-pix_fmt yuv420p -c:v libx264 -q:v 20 -r 5 -preset ultrafast -strict
-2 -c:a aac capture.mkv

The main problem is that audio and video are totally out of sync.
Probably each device (video and audio) will not start simultaneously.
Is there any parameter to ensure that the two devices are ready
simultaneously so when recording, video and audio will be in sync?
In my case, audio start much faster. At begining video is freezing and
hear audio, then both play obviously out of sync and then audio is
finishing and video still playing until finish.

Thanks for anu suggestion!
Specs: core2duo at 1,8Ghz, 2Gb ram, XUbuntu 14.04, ffmpeg latest static
build from git.
ffmpeg version N-43517-gac424b2-   http://johnvansickle.com/ffmpeg/
Copyright (c) 2000-2015 the FFmpeg developers

Here is my webcam specs:
[video4linux2,v4l2 @ 0x907a180] Raw       :   yuyv422 :     YUV 4:2:2
(YUYV) : 640x480 1280x720 960x544 800x448 640x360 424x240 352x288
320x240 800x600 176x144 160x120 1280x800

[video4linux2,v4l2 @ 0x907a180] Compressed:     mjpeg :
MJPEG : 640x480 1280x720 960x544 800x448 640x360 800x600 416x240
352x288 176x144 320x240 160x120


More information about the ffmpeg-user mailing list