Opened 13 years ago
Closed 12 years ago
#1338 closed defect (worksforme)
FFMPEG creating broken MP4/Audio files with libx264
Reported by: | ramitb | Owned by: | |
---|---|---|---|
Priority: | important | Component: | undetermined |
Version: | unspecified | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
The latest version of FFMPEG (N-40824-g31dfe20) is creating broken MP4 files when starting with a TS file.
The Audio is completely out of sync or creates no audio at all.
This is a regression bug so I'm marking it important.
This was working with FFMPEG build N-37915-g6cb2085 with no audio issues.
Attaching the link to the input file (it is 40MB in size unfortunately to be able to replicate the issue).
http://www.mediafire.com/?5xwf84kbzp6ci4y
You can replace libvo_aacenc with ac3 and it still has the same problem. If I put -vn the audio comes back (but there's no video). Some reason the Audio/sync is broken after build N-37915-g6cb2085.
COMMMAND:
ffmpeg -i CSI.ts -ss 3 -vf yadif=0:-1,hqdn3d,crop=688:416:14:46 -vcodec libx264 -b
1911111 -flags +loop -cmp +chroma -deblock -1:-1 -bt 256k -refs 8 -bf 3 -b_strategy 2 -coder 1 -me_method hex -me_range
16 -subq 8 -partitions +parti4x4+parti8x8+partp8x8+partb8x8 -weightb 1 -mixed-refs 1 -8x8dct 1 -g 25 -keyint_min 20 -lev
el 41 -trellis 1 -sc_threshold 40 -i_qfactor 0.71 -acodec libvo_aacenc -ab 192k -ac 2 csi.mp4
OUTPUT:
ffmpeg version N-40824-g31dfe20 Copyright (c) 2000-2012 the FFmpeg developers built on May 19 2012 00:45:59 with gcc 4.6.3 configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-runtime-cpudetect --enable-avisynth --enab le-bzlib --enable-frei0r --enable-libass --enable-libcelt --enable-libopencore-amrnb --enable-libopencore-amrwb --enable -libfreetype --enable-libgsm --enable-libmp3lame --enable-libnut --enable-libopenjpeg --enable-librtmp --enable-libschro edinger --enable-libspeex --enable-libtheora --enable-libutvideo --enable-libvo-aacenc --enable-libvo-amrwbenc --enable- libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib libavutil 51. 53.100 / 51. 53.100 libavcodec 54. 21.101 / 54. 21.101 libavformat 54. 5.100 / 54. 5.100 libavdevice 53. 4.100 / 53. 4.100 libavfilter 2. 74.101 / 2. 74.101 libswscale 2. 1.100 / 2. 1.100 libswresample 0. 12.100 / 0. 12.100 libpostproc 52. 0.100 / 52. 0.100 [mp3 @ 02b9e3a0] Header missing [mpeg2video @ 02b98140] mpeg_decode_postinit() failure Last message repeated 7 times [mpegts @ 02b7e860] max_analyze_duration 5000000 reached at 5016000 Input #0, mpegts, from 'CSI.ts': Duration: 00:00:46.61, start: 14.737000, bitrate: 8185 kb/s Program 1 Stream #0:0[0x1100]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p, 720x480 [SAR 8:9 DAR 4:3], 9000 kb/s , 31.22 fps, 29.97 tbr, 90k tbn, 59.94 tbc Stream #0:1[0x1101]: Audio: mp2 ([4][0][0][0] / 0x0004), 48000 Hz, stereo, s16, 384 kb/s Please use -b:a or -b:v, -b is ambiguous [buffer @ 035cef60] w:720 h:480 pixfmt:yuv420p tb:1/1000000 sar:8/9 sws_param:flags=2 [buffersink @ 03657020] No opaque field provided [yadif @ 035cecc0] mode:0 parity:-1 auto_enable:0 [hqdn3d @ 035cee20] ls:4.000000 cs:3.000000 lt:6.000000 ct:4.500000 [crop @ 035cee80] w:720 h:480 sar:8/9 -> w:688 h:416 sar:8/9 [abuffer @ 035ceee0] format:s16 layout:stereo rate:48000 [libx264 @ 03657860] using SAR=8/9 [libx264 @ 03657860] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.2 [libx264 @ 03657860] profile High, level 4.1 [libx264 @ 03657860] 264 - core 120 r2164 da19765 - H.264/MPEG-4 AVC codec - Copyleft 2003-2012 - http://www.videolan.or g/x264.html - options: cabac=1 ref=8 deblock=1:-1:-1 analyse=0x3:0x113 me=hex subme=8 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=6 sliced_threa ds=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=2 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=25 keyint_min=13 scenecut=40 intra_refresh=0 rc_lookahead=25 rc=abr mbtree=1 bitra te=1911 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00 Output #0, mp4, to 'csi.mp4': Metadata: encoder : Lavf54.5.100 Stream #0:0: Video: h264 (![0][0][0] / 0x0021), yuv420p, 688x416 [SAR 8:9 DAR 172:117], q=-1--1, 1911 kb/s, 30k tbn, 29.97 tbc Stream #0:1: Audio: aac (@[0][0][0] / 0x0040), 48000 Hz, stereo, s16, 192 kb/s Stream mapping: Stream #0:0 -> #0:0 (mpeg2video -> libx264) Stream #0:1 -> #0:1 (mp2 -> libvo_aacenc) Press [q] to stop, [?] for help [mp2 @ 02b9e3a0] Header missing Error while decoding stream #0:1 ac-tex damaged at 32 137.0 size= 0kB time=00:00:00.00 bitrate= 0.0kbits/s [mpeg2video @ 02b98140] Warning MVs not available [mpeg2video @ 02b98140] concealing 765 DC, 765 AC, 765 MV errors [mp2 @ 02b9e3a0] incomplete frame Error while decoding stream #0:1 [libvo_aacenc @ 032d48a0] Trying to remove 1024 samples, but que empty [mp4 @ 03657100] Encoder did not produce proper pts, making some up. [libvo_aacenc @ 032d48a0] Trying to remove 1024 samples, but que empty frame= 1308 fps= 35 q=-1.0 Lsize= 10692kB time=00:00:00.04 bitrate=2052801.5kbits/s dup=1 drop=0 video:10675kB audio:1kB global headers:0kB muxing overhead 0.143845% [libx264 @ 03657860] frame I:62 Avg QP: 9.60 size: 38680 [libx264 @ 03657860] frame P:551 Avg QP:11.57 size: 10696 [libx264 @ 03657860] frame B:695 Avg QP:17.93 size: 3798 [libx264 @ 03657860] consecutive B-frames: 24.7% 6.0% 22.2% 47.1% [libx264 @ 03657860] mb I I16..4: 23.6% 43.0% 33.4% [libx264 @ 03657860] mb P I16..4: 5.2% 7.1% 2.4% P16..4: 31.9% 12.9% 11.0% 0.0% 0.0% skip:29.6% [libx264 @ 03657860] mb B I16..4: 0.3% 1.3% 0.5% B16..8: 27.3% 7.6% 2.2% direct: 7.5% skip:53.4% L0:34.0% L1:4 9.9% BI:16.1% [libx264 @ 03657860] final ratefactor: 13.28 [libx264 @ 03657860] 8x8 transform intra:47.5% inter:52.8% [libx264 @ 03657860] coded y,uvDC,uvAC intra: 63.8% 82.3% 67.5% inter: 21.9% 25.3% 7.5% [libx264 @ 03657860] i16 v,h,dc,p: 67% 13% 2% 17% [libx264 @ 03657860] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 24% 16% 14% 5% 7% 8% 8% 9% 9% [libx264 @ 03657860] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 22% 17% 12% 6% 9% 9% 8% 8% 9% [libx264 @ 03657860] i8c dc,h,v,p: 40% 28% 18% 13% [libx264 @ 03657860] Weighted P-Frames: Y:6.5% UV:4.2% [libx264 @ 03657860] ref P L0: 74.8% 6.1% 11.7% 3.0% 1.8% 1.1% 0.8% 0.5% 0.2% 0.0% [libx264 @ 03657860] ref B L0: 86.9% 9.0% 2.4% 0.8% 0.5% 0.3% 0.1% [libx264 @ 03657860] ref B L1: 95.6% 4.4% [libx264 @ 03657860] kb/s:2003.66
Change History (18)
comment:1 by , 13 years ago
comment:2 by , 13 years ago
Summary: | FFMPEG creating broken MP4/Audio files with LibXvid → FFMPEG creating broken MP4/Audio files with libx264 |
---|
Is this only reproducible with libx264 or also with -vcodec mpeg4 -strict experimental -acodec aac ?
If this is a regression, please find the version introducing the problem with git bisect.
comment:3 by , 13 years ago
I tried the command with the CSI.ts, i see no desync with ffplay CSI.mp4. With what player do you see a problem ?
Also a minimal command line would simplify debuging this, are all options needed to reproduce this issue?
comment:4 by , 13 years ago
I'm using Windows Media Player and KMPlayer. KMPlayer is not able to play the file while WMP does not have any audio for quite a while after which it suddenly appears but out of sync.
Unfortunatley yes all the parameters are required. If I remove all the params (say use only -sameq it works but the quality is terrible). The previous version of ffmpeg works perfectly with these params. I tend to update ffmpeg every few months, upto N-37915-g6cb2085 there was no issue, somewhere after that it broke (unfortunately I do not know how to use bisect etc to figure it out).
Also mpeg4 codec quality for the same bitrate creates more artifacts so my users insist on using lix264.
comment:5 by , 13 years ago
I tested the following command line and the resulting video plays fine (in sync) with WMP:
$ ffmpeg -i CSI.ts -ss 3 -vf yadif=0:-1,hqdn3d,crop=688:416:14:46 -vcodec mpeg4 -acodec aac -strict experimental -qscale 2 out.mp4
follow-up: 7 comment:6 by , 13 years ago
Thanks, but like I had mentioned earlier the users are insisting on using lix264.
I want to upgrade ffmpeg to the latest version to fix the WTV and MPEG2/TS issues that were fixed recently but with libx264 broken it will not be possible.
MCEBuddy has been running for years on libx264 with a strong userbase.
Is there anyway to isolate the issue?
comment:7 by , 13 years ago
Replying to ramitbhalla:
Thanks, but like I had mentioned earlier the users are insisting on using lix264.
Did you already confirm that the problem happens with libx264 but not with mpeg4 ?
If yes, which options from your command line can be removed and which are essential to reproduce the problem?
follow-up: 9 comment:8 by , 13 years ago
No I haven't tried it with MPEG4 given the feedback from the uesrs not to use that codec.
Is there some way to identify what broken in libx264 AV sync?
comment:9 by , 12 years ago
Replying to ramitbhalla:
No I haven't tried it with MPEG4 given the feedback from the uesrs not to use that codec.
Is there some way to identify what broken in libx264 AV sync?
there are several options
git bisect
or
try to remove each command line option at a time to find the absolute needed set to reproduce it
or
analyze the output file to find out what is broken if anything.
there may be other options, but most ffmpeg developers dont have windows so its kinda difficult for us to test/fix this. Also if you can confirm that it works with mpeg4 this itself may also be usefull to circle in on the bug ...
follow-up: 12 comment:11 by , 12 years ago
Does the following produce a working file or is it sufficient to produce the broken file (or is a parameter missing for the encode to succeed)?
$ ffmpeg -i CSI.ts -crf 2 out.mp4
follow-up: 13 comment:12 by , 12 years ago
This command works fine, produces good audio
ffmpeg -i CSI.ts -crf 2 out.mp4 ffmpeg version N-40824-g31dfe20 Copyright (c) 2000-2012 the FFmpeg developers built on May 19 2012 00:45:59 with gcc 4.6.3 configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-runtime-cpudetect --enable-avisynth --enab le-bzlib --enable-frei0r --enable-libass --enable-libcelt --enable-libopencore-amrnb --enable-libopencore-amrwb --enable -libfreetype --enable-libgsm --enable-libmp3lame --enable-libnut --enable-libopenjpeg --enable-librtmp --enable-libschro edinger --enable-libspeex --enable-libtheora --enable-libutvideo --enable-libvo-aacenc --enable-libvo-amrwbenc --enable- libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib libavutil 51. 53.100 / 51. 53.100 libavcodec 54. 21.101 / 54. 21.101 libavformat 54. 5.100 / 54. 5.100 libavdevice 53. 4.100 / 53. 4.100 libavfilter 2. 74.101 / 2. 74.101 libswscale 2. 1.100 / 2. 1.100 libswresample 0. 12.100 / 0. 12.100 libpostproc 52. 0.100 / 52. 0.100 [mp3 @ 02ec0e60] Header missing [mpeg2video @ 01d3c840] mpeg_decode_postinit() failure Last message repeated 7 times [mpegts @ 01d3bb80] max_analyze_duration 5000000 reached at 5016000 Input #0, mpegts, from 'CSI.ts': Duration: 00:00:46.61, start: 14.737000, bitrate: 8185 kb/s Program 1 Stream #0:0[0x1100]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p, 720x480 [SAR 8:9 DAR 4:3], 9000 kb/s , 31.22 fps, 29.97 tbr, 90k tbn, 59.94 tbc Stream #0:1[0x1101]: Audio: mp2 ([4][0][0][0] / 0x0004), 48000 Hz, stereo, s16, 384 kb/s [buffer @ 02fa0b60] w:720 h:480 pixfmt:yuv420p tb:1/1000000 sar:8/9 sws_param:flags=2 [buffersink @ 02fa0e40] No opaque field provided [abuffer @ 02ea66c0] format:s16 layout:stereo rate:48000 [libx264 @ 0311f5c0] using SAR=8/9 [libx264 @ 0311f5c0] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.2 [libx264 @ 0311f5c0] profile High, level 3.0 [libx264 @ 0311f5c0] 264 - core 120 r2164 da19765 - H.264/MPEG-4 AVC codec - Copyleft 2003-2012 - http://www.videolan.or g/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 m e_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 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 we ightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=2. 0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00 Output #0, mp4, to 'out.mp4': Metadata: encoder : Lavf54.5.100 Stream #0:0: Video: h264 (![0][0][0] / 0x0021), yuv420p, 720x480 [SAR 8:9 DAR 4:3], q=-1--1, 30k tbn, 29.97 tbc Stream #0:1: Audio: aac (@[0][0][0] / 0x0040), 48000 Hz, stereo, s16, 128 kb/s Stream mapping: Stream #0:0 -> #0:0 (mpeg2video -> libx264) Stream #0:1 -> #0:1 (mp2 -> libvo_aacenc) Press [q] to stop, [?] for help [mp2 @ 02ec0e60] Header missing Error while decoding stream #0:1 ac-tex damaged at 32 13.0 size= 93129kB time=00:00:44.67 bitrate=17075.9kbits/s dup=11 drop=0 [mpeg2video @ 01d3c840] Warning MVs not available [mpeg2video @ 01d3c840] concealing 765 DC, 765 AC, 765 MV errors [mp2 @ 02ec0e60] incomplete frame Error while decoding stream #0:1 frame= 1398 fps= 19 q=-1.0 Lsize= 98213kB time=00:00:46.56 bitrate=17279.9kbits/s dup=12 drop=0 video:97436kB audio:727kB global headers:0kB muxing overhead 0.051065% [libx264 @ 0311f5c0] frame I:26 Avg QP: 1.86 size:127652 [libx264 @ 0311f5c0] frame P:531 Avg QP: 3.23 size: 96782 [libx264 @ 0311f5c0] frame B:841 Avg QP: 5.09 size: 53584 [libx264 @ 0311f5c0] consecutive B-frames: 14.7% 11.4% 11.8% 62.1% [libx264 @ 0311f5c0] mb I I16..4: 31.3% 34.3% 34.4% [libx264 @ 0311f5c0] mb P I16..4: 21.2% 17.5% 15.1% P16..4: 23.1% 12.1% 9.5% 0.0% 0.0% skip: 1.5% [libx264 @ 0311f5c0] mb B I16..4: 2.3% 3.2% 2.2% B16..8: 34.0% 11.5% 7.7% direct:36.2% skip: 2.9% L0:41.9% L1:3 7.0% BI:21.1% [libx264 @ 0311f5c0] 8x8 transform intra:34.3% inter:60.0% [libx264 @ 0311f5c0] coded y,uvDC,uvAC intra: 78.1% 98.2% 97.1% inter: 58.1% 86.7% 77.4% [libx264 @ 0311f5c0] i16 v,h,dc,p: 51% 17% 19% 13% [libx264 @ 0311f5c0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 25% 22% 31% 2% 3% 3% 4% 4% 5% [libx264 @ 0311f5c0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 24% 36% 15% 4% 4% 4% 4% 4% 5% [libx264 @ 0311f5c0] i8c dc,h,v,p: 55% 19% 15% 11% [libx264 @ 0311f5c0] Weighted P-Frames: Y:10.2% UV:7.5% [libx264 @ 0311f5c0] ref P L0: 53.6% 11.4% 22.0% 11.8% 1.2% [libx264 @ 0311f5c0] ref B L0: 81.7% 15.1% 3.2% [libx264 @ 0311f5c0] ref B L1: 91.1% 8.9% [libx264 @ 0311f5c0] kb/s:17111.43
Replying to cehoyos:
Does the following produce a working file or is it sufficient to produce the broken file (or is a parameter missing for the encode to succeed)?
$ ffmpeg -i CSI.ts -crf 2 out.mp4
comment:13 by , 12 years ago
Replying to ramitbhalla:
This command works fine, produces good audio
Which of the options from your original command line have to be added to reproduce the problem?
(I understand that adding all options from your original command line will allow to reproduce the problem, the question is to find the minimal set of options.)
comment:14 by , 12 years ago
I hope this narrows it down.
It's the -ss 3 which is causing the Audio to break:
This does NOT work:
ffmpeg -i CSI.ts -ss 3 -vcodec libx264 -b 1911111 -acodec libvo_aacenc -ab 192k csi.mp4
This DOES:
ffmpeg -i CSI.ts -vcodec libx264 -b 1911111 -acodec libvo_aacenc -ab 192k csi.mp4
comment:17 by , 12 years ago
I tested the following command line with current ffmpeg and the sample you uploaded (CSI.ts), and I don't see any problems with the resulting file and WMP.
Was the problem fixed?
$ ffmpeg -i CSI-ts -ss 3 -crf 2 out.mp4
comment:18 by , 12 years ago
Resolution: | → worksforme |
---|---|
Status: | new → closed |
As said, this works for me (with libx264), please reopen if you can still reproduce the original problem.
My apologies, I got the subject line wrong, it's Libx264. Can it be corrected?