Opened 12 years ago

Closed 12 years ago

#2399 closed defect (duplicate)

when merging audio and video to mp4 , the audio / video not syncdiated correctly

Reported by: chinshou Owned by:
Priority: normal Component: undetermined
Version: unspecified Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

executing following command with the two videos I attached.

ffmpeg -i aaa.mp4 -i bbb.mp4 test.mp4

C:\Conversion>ffmpeg -i aaa.mp4 -i bbb.mp4 test.mp4
ffmpeg version N-51211-ge0e8c20 Copyright (c) 2000-2013 the FFmpeg developers

built on Mar 22 2013 08:56:38 with gcc 4.7.2 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av

isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libg
sm --enable-libilbc --enable-libmp3lame --enable-libopencore-amrnb --enable-libo
pencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-li
bschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-lib
twolame --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enabl
e-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib

libavutil 52. 22.101 / 52. 22.101
libavcodec 55. 1.100 / 55. 1.100
libavformat 55. 0.100 / 55. 0.100
libavdevice 55. 0.100 / 55. 0.100
libavfilter 3. 48.100 / 3. 48.100
libswscale 2. 2.100 / 2. 2.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 2.100 / 52. 2.100

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'aaa.mp4':

Metadata:

major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf54.59.102

Duration: 00:00:08.71, start: 0.000000, bitrate: 245 kb/s

Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1366x768,

241 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc

Metadata:

handler_name : VideoHandler

Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'bbb.mp4':

Metadata:

major_brand : isom
minor_version : 512
compatible_brands: isomiso2mp41
encoder : Lavf54.59.102

Duration: 00:00:00.13, start: 0.023220, bitrate: 9029 kb/s

Stream #1:0(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 89

40 kb/s

Metadata:

handler_name : SoundHandler

File 'test.mp4' already exists. Overwrite ? [y/N] y
using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
[libx264 @ 024adac0] profile High, level 3.2
[libx264 @ 024adac0] 264 - core 130 r2274 c832fe9 - H.264/MPEG-4 AVC codec - Cop
yleft 2003-2013 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deb
lock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 m
e_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chro
ma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 i
nterlaced=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=25 scenec
ut=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
Output #0, mp4, to 'test.mp4':

Metadata:

major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf55.0.100
Stream #0:0(und): Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 1366x768, q

=-1--1, 30k tbn, 29.97 tbc

Metadata:

handler_name : VideoHandler

Stream #0:1(und): Audio: aac ([64][0][0][0] / 0x0040), 44100 Hz, stereo, s16

, 128 kb/s

Metadata:

handler_name : SoundHandler

Stream mapping:

Stream #0:0 -> #0:0 (h264 -> libx264)
Stream #1:0 -> #0:1 (aac -> libvo_aacenc)

Press [q] to stop, ? for help
frame= 54 fps=0.0 q=29.0 size= 0kB time=00:00:00.06 bitrate= 5.8kbits/
frame= 80 fps= 76 q=29.0 size= 219kB time=00:00:00.93 bitrate=1917.7kbits/
frame= 114 fps= 72 q=29.0 size= 219kB time=00:00:02.06 bitrate= 866.1kbits/
frame= 148 fps= 71 q=29.0 size= 219kB time=00:00:03.20 bitrate= 559.3kbits/
frame= 187 fps= 72 q=29.0 size= 219kB time=00:00:04.50 bitrate= 397.7kbits/
frame= 226 fps= 72 q=29.0 size= 219kB time=00:00:05.80 bitrate= 308.6kbits/
frame= 261 fps= 63 q=2686559.0 Lsize= 390kB time=00:00:08.64 bitrate= 369.9
kbits/s
video:251kB audio:133kB subtitle:0 global headers:0kB muxing overhead 1.517758%
[libx264 @ 024adac0] frame I:2 Avg QP:20.77 size: 84310
[libx264 @ 024adac0] frame P:68 Avg QP:24.08 size: 1098
[libx264 @ 024adac0] frame B:191 Avg QP:33.16 size: 70
[libx264 @ 024adac0] consecutive B-frames: 1.9% 1.5% 0.0% 96.6%
[libx264 @ 024adac0] mb I I16..4: 65.2% 4.7% 30.2%
[libx264 @ 024adac0] mb P I16..4: 0.8% 0.0% 0.3% P16..4: 0.6% 0.1% 0.0%

0.0% 0.0% skip:98.1%

[libx264 @ 024adac0] mb B I16..4: 0.0% 0.0% 0.0% B16..8: 0.7% 0.0% 0.0%

direct: 0.0% skip:99.2% L0:48.3% L1:51.6% BI: 0.1%

[libx264 @ 024adac0] 8x8 transform intra:3.7% inter:46.9%
[libx264 @ 024adac0] coded y,uvDC,uvAC intra: 20.3% 19.0% 16.6% inter: 0.1% 0.1%

0.0%

[libx264 @ 024adac0] i16 v,h,dc,p: 62% 37% 0% 0%
[libx264 @ 024adac0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 74% 12% 12% 0% 0% 0% 0%

0% 1%

[libx264 @ 024adac0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 34% 39% 12% 2% 2% 2% 3%

2% 3%

[libx264 @ 024adac0] i8c dc,h,v,p: 67% 23% 9% 0%
[libx264 @ 024adac0] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 024adac0] ref P L0: 79.1% 12.4% 6.1% 2.4%
[libx264 @ 024adac0] ref B L0: 60.7% 38.5% 0.8%
[libx264 @ 024adac0] ref B L1: 95.4% 4.6%
[libx264 @ 024adac0] kb/s:235.67

then executing ffplay test.mp4 to view the result mp4, you will notice that audio not syndicate with video from the pronunciation of "ffffff" and input "fffffff" via keyboard .

But if we merge the audio and video to a avi file , the audio/video syndicated correctly.

ffmpeg -i aaa.mp4 -i bbb.mp4 test.avi.

I tested with old release and found that http://ffmpeg.zeranoe.com/builds/win32/dev/ffmpeg-git-e01f478-win32-dev.7z built on 2012/03/20 is still ok. From http://ffmpeg.zeranoe.com/builds/win32/dev/ffmpeg-git-4082198-win32-dev.7z built on 2012/03/25 the problem was introduced.

I compared the source code between 03/20 and 03/25 and suspect the audio encode api in codec switch from encode to encode2 interface caused the problem.


Change History (2)

comment:1 by chinshou, 12 years ago

sorry , I press the submit button twice , create additional ticket , please delete this one. thanks

comment:2 by Carl Eugen Hoyos, 12 years ago

Resolution: duplicate
Status: newclosed
Note: See TracTickets for help on using tickets.