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

Reuben Martin reuben.m at gmail.com
Mon Feb 23 06:42:29 CET 2015


On Sunday, February 22, 2015 09:42:40 AM Vlăduţ Frăţiman wrote:
> 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.

Unfortunately there is no means by which to guarantee sync. As far as I am 
aware there is no means to sync lock the alsa and v4l2 sub-systems. If there 
is ever a version 3 of v4l developed, that should be one of it’s primary 
goals.

Your best bet is to use the native frame size / rate (1280x720 at 30fps if google 
search is correct) and try to see if you can adjust delay time in audio by 
trial and error to try to match it up.

Also, the aac codec in ffmpeg is currently crap. I would advise trying 
libfdk_aac codec.

-Reuben


More information about the ffmpeg-user mailing list