[FFmpeg-trac] #1259(undetermined:new): Audio sync issue
FFmpeg
trac at avcodec.org
Sun Apr 29 18:25:01 CEST 2012
#1259: Audio sync issue
-------------------------------------+-------------------------------------
Reporter: burek | Type: defect
Status: new | Priority: normal
Component: | Version:
undetermined | unspecified
Keywords: | Blocked By:
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
-------------------------------------+-------------------------------------
From IRC channel:
<Adys> Trying to record from webcam and keep audio in sync, this has audio
running behind by 3-4 seconds
<Adys> input comes from a separate usb mic if that makes any difference
{{{
% ffmpeg -f alsa -i pulse -f video4linux2 -s 800x600 -i /dev/video0 -sameq
-acodec libmp3lame -ab 96k out.mkv
ffmpeg version N-40213-g9f98a8e Copyright (c) 2000-2012 the FFmpeg
developers
built on Apr 29 2012 16:47:10 with gcc 4.7.0 20120414 (prerelease)
configuration: --enable-libx264 --enable-nonfree --enable-libmp3lame
--enable-libpulse --enable-gpl --disable-outdev=oss
libavutil 51. 48.100 / 51. 48.100
libavcodec 54. 17.100 / 54. 17.100
libavformat 54. 3.100 / 54. 3.100
libavdevice 53. 4.100 / 53. 4.100
libavfilter 2. 72.100 / 2. 72.100
libswscale 2. 1.100 / 2. 1.100
libswresample 0. 11.100 / 0. 11.100
libpostproc 52. 0.100 / 52. 0.100
[alsa @ 0x279e100] Estimating duration from bitrate, this may be
inaccurate
Input #0, alsa, from 'pulse':
Duration: N/A, start: 1335715213.308329, bitrate: 1536 kb/s
Stream #0:0: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s
[video4linux2,v4l2 @ 0x279b3a0] Estimating duration from bitrate, this may
be inaccurate
Input #1, video4linux2,v4l2, from '/dev/video0':
Duration: N/A, start: 67955.437449, bitrate: 153600 kb/s
Stream #1:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 800x600,
153600 kb/s, 20 tbr, 1000k tbn, 20 tbc
[buffer @ 0x27a5100] w:800 h:600 pixfmt:yuyv422 tb:1/1000000 sar:0/1
sws_param:flags=2
[buffersink @ 0x279c9e0] auto-inserting filter 'auto-inserted scale 0'
between the filter 'src' and the filter 'out'
[scale @ 0x279d320] w:800 h:600 fmt:yuyv422 sar:0/1 -> w:800 h:600
fmt:yuv422p sar:0/1 flags:0x4
[libx264 @ 0x279a820] using cpu capabilities: MMX2 SSE2Fast SSSE3
FastShuffle SSE4.2
[libx264 @ 0x279a820] profile High 4:2:2, level 3.1, 4:2:2 8-bit
[libx264 @ 0x279a820] 264 - core 120 - H.264/MPEG-4 AVC codec - Copyleft
2003-2011 - http://www.videolan.org/x264.html - options: cabac=1 ref=3
deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00
mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0
deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12
sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0
constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1
weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=20 scenecut=40
intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60
qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Guessed Channel Layout for Input Stream #0.0 : stereo
Output #0, matroska, to 'out.mkv':
Metadata:
encoder : Lavf54.3.100
Stream #0:0: Video: h264, yuv422p, 800x600, q=-1--1, 1k tbn, 20 tbc
Stream #0:1: Audio: mp3, 48000 Hz, stereo, s16, 96 kb/s
Stream mapping:
Stream #1:0 -> #0:0 (rawvideo -> libx264)
Stream #0:0 -> #0:1 (pcm_s16le -> libmp3lame)
Press [q] to stop, [?] for help
Input stream #0:0 frame changed from rate:48000 fmt:s16 ch:2 chl:0x0 to
rate:48000 fmt:s16 ch:2 chl:0x3
frame= 65 fps= 13 q=-1.0 Lsize= 871kB time=00:00:04.40
bitrate=1622.4kbits/s
video:782kB audio:87kB global headers:0kB muxing overhead 0.307903%
[libx264 @ 0x279a820] frame I:1 Avg QP:23.90 size: 34621
[libx264 @ 0x279a820] frame P:31 Avg QP:23.35 size: 17539
[libx264 @ 0x279a820] frame B:33 Avg QP:25.02 size: 6721
[libx264 @ 0x279a820] consecutive B-frames: 7.7% 64.6% 27.7% 0.0%
[libx264 @ 0x279a820] mb I I16..4: 18.5% 60.6% 20.9%
[libx264 @ 0x279a820] mb P I16..4: 1.7% 7.0% 1.4% P16..4: 48.3% 18.1%
13.3% 0.0% 0.0% skip:10.0%
[libx264 @ 0x279a820] mb B I16..4: 0.3% 1.8% 0.3% B16..8: 38.5% 4.8%
1.2% direct: 7.8% skip:45.3% L0:41.9% L1:49.5% BI: 8.7%
[libx264 @ 0x279a820] 8x8 transform intra:67.8% inter:73.1%
[libx264 @ 0x279a820] coded y,uvDC,uvAC intra: 65.6% 95.6% 80.9% inter:
23.1% 58.6% 16.7%
[libx264 @ 0x279a820] i16 v,h,dc,p: 17% 11% 2% 69%
[libx264 @ 0x279a820] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 23% 12% 12% 8% 8%
11% 7% 11% 9%
[libx264 @ 0x279a820] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 25% 15% 12% 8% 9%
10% 7% 8% 6%
[libx264 @ 0x279a820] i8c dc,h,v,p: 45% 11% 24% 21%
[libx264 @ 0x279a820] Weighted P-Frames: Y:3.2% UV:3.2%
[libx264 @ 0x279a820] ref P L0: 53.4% 12.1% 22.5% 12.1% 0.0%
[libx264 @ 0x279a820] ref B L0: 73.9% 24.6% 1.5%
[libx264 @ 0x279a820] ref B L1: 95.1% 4.9%
[libx264 @ 0x279a820] kb/s:1422.43
}}}
<burek> try lowering your video resolution to 320x240 just to see if it
works
<Adys> i get some weird speedup and lots of PTS 4254653, next:4716287
invalid dropping st:0
<burek> try: ffmpeg -f video4linux2 -s 320x240 -r 25 -i /dev/video0 -f
alsa -i pulse -sameq -acodec libmp3lame -ab 96k out.mkv
<Adys> no errors but sound still lagging about 1 second behind
<Adys> using mp4 solves it, even works in 1280x720
So, there is some kind of bug, when using alsa+video4linux2, which might
be investigated a little bit, since a lot of people have reported syncing
issues when capturing inputs from webcams (using video4linux2) + alsa
audio.
--
Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/1259>
FFmpeg <http://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list