Opened 11 years ago
Last modified 6 years ago
#3622 reopened defect
Second audio track in mov sometimes marked as default
Reported by: | Carl Eugen Hoyos | Owned by: | |
---|---|---|---|
Priority: | important | Component: | avformat |
Version: | git-master | Keywords: | mov regression |
Cc: | julian@corecode.at, james.heliker@gmail.com, v0qiu24elio.ldb63qpfmjrkkiv9el@gmail.com | Blocked By: | |
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
Related to ticket #468, #1174 and #2626
The following command line produces an output file with exactly one enabled audio track (the first one), the second audio track is not enabled:
$ ffmpeg -i fate-suite/mp3-conformance/compl.bit -i fate-suite/mp3-conformance/he_32khz.bit -acodec aac -strict -2 -map 0:0 -map 1:0 out.mov
But the following command produces an output file with two enabled audio tracks, this is bad for playback with QuickTime:
$ ffmpeg -i fate-suite/aac/al04_44.mp4 -i fate-suite/aac/al05_44.mp4 -acodec aac -strict -2 -map 0:0 -map 1:0 out2.mov ffmpeg version N-63026-g54ae588 Copyright (c) 2000-2014 the FFmpeg developers built on May 7 2014 22:40:04 with gcc 4.7 (SUSE Linux) configuration: --enable-gpl libavutil 52. 81.100 / 52. 81.100 libavcodec 55. 60.103 / 55. 60.103 libavformat 55. 37.102 / 55. 37.102 libavdevice 55. 13.101 / 55. 13.101 libavfilter 4. 5.100 / 4. 5.100 libswscale 2. 6.100 / 2. 6.100 libswresample 0. 18.100 / 0. 18.100 libpostproc 52. 3.100 / 52. 3.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'fate-suite/aac/al04_44.mp4': Metadata: major_brand : mp42 minor_version : 0 compatible_brands: mp42isom creation_time : 2004-02-19 14:38:56 Duration: 00:00:08.24, start: 0.000000, bitrate: 67 kb/s Stream #0:0(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 63 kb/s (default) Metadata: creation_time : 2004-02-19 14:38:56 handler_name : soun Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'fate-suite/aac/al05_44.mp4': Metadata: major_brand : mp42 minor_version : 0 compatible_brands: mp42isom creation_time : 2004-02-19 14:38:56 Duration: 00:00:07.43, start: 0.000000, bitrate: 131 kb/s Stream #1:0(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 127 kb/s (default) Metadata: creation_time : 2004-02-19 14:38:56 handler_name : soun Output #0, mov, to 'out2.mov': Metadata: major_brand : mp42 minor_version : 0 compatible_brands: mp42isom encoder : Lavf55.37.102 Stream #0:0(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 128 kb/s (default) Metadata: creation_time : 2004-02-19 14:38:56 handler_name : soun Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default) Metadata: creation_time : 2004-02-19 14:38:56 handler_name : soun Stream mapping: Stream #0:0 -> #0:0 (aac -> aac) Stream #1:0 -> #0:1 (aac -> aac) Press [q] to stop, [?] for help size= 252kB time=00:00:08.24 bitrate= 250.6kbits/s video:0kB audio:246kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 2.660035%
out2.mov has both audio tracks enabled, this is a regression since 800ea20c
Attachments (2)
Change History (32)
comment:1 by , 11 years ago
Cc: | added |
---|
comment:2 by , 11 years ago
comment:3 by , 11 years ago
I've been fighting the same problem. An m4v container written by ffmpeg-2.2.2 with one h.264 video stream and two audio streams (one AAC and one AC3) is shown by ffprobe as having 3 "default" streams and the audio does not play on an Apple TV 3.
The same source file converted with Handbrake plays correctly on the ATV3 and ffprobe shows only the first audio stream as "default".
This is a real problem for my workflow. Other than digging into source I'm not at all familiar with (and dealing with compiling it entirely manually rather than with Homebrew) I'm happy to assist in any way to get this fixed.
comment:4 by , 11 years ago
i can only tell you that the change from comment2 makes this work for me and building ffmpeg from source is quite a joy compared to nearly all other common large packages
comment:5 by , 11 years ago
OK, I bit the bullet (partially) and produced a more complete patch for this. It more correctly identifies which tracks should and shouldn't be enabled.
I'm still using homebrew since it so easily deals with all the external dependencies but this means I'm not manually doing make and thus am not in a position to be able to run "make fate" to do the regression tests needed to post patches to ffmpeg-devel. Sorry but I just don't have time currently to start from scratch building things. Julian, if you want to do that then feel free to use my patch. :-)
That's lame I know but work's crushing me now and I just don't have any more spare cycles.
comment:6 by , 11 years ago
i ran "make fate" on 2.2.2 without and with you patch and couldn't notice any differences. how would a test failure make itself known? where are the results?
comment:7 by , 10 years ago
In case it's helpful to anyone; I uploaded a Homebrew build script and patch as GitHub Gists and you can find them here. If you replace your existing ffmpeg.rb
with the Gist, it should download and build a patched version of ffmpeg 2.2.3.
https://gist.github.com/outlyer/4a88f1adb7f895b93fd9
For what it's worth, I've also found this patch worked to solve the disabled track issue on both 2.2.2 and 2.2.3 and make fate
didn't report any issues of note.
comment:8 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Should have been fixed by merging code from Luca Barbato in 4c91599484e115e9b51c884fc46cea3f8511f8ae
This would leave both enabled but should avoid the problem with QT
If this is insufficient and still causes problems then please reopen
comment:9 by , 10 years ago
thanks for the fix. will test as soon as i move to git-head and let you know in case the solution is insufficient.
follow-up: 11 comment:10 by , 10 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
The issue is still reproducible with current FFmpeg git head:
$ ffmpeg -i fate-suite/aac/al04_44.mp4 -i fate-suite/aac/al05_44.mp4 -acodec aac -strict -2 -map 0:0 -map 1:0 out2.mov ffmpeg version N-64656-g2a9b4c0 Copyright (c) 2000-2014 the FFmpeg developers built on Jul 14 2014 13:56:52 with gcc 4.7 (SUSE Linux) configuration: --enable-gpl libavutil 52. 92.100 / 52. 92.100 libavcodec 55. 69.100 / 55. 69.100 libavformat 55. 46.100 / 55. 46.100 libavdevice 55. 13.102 / 55. 13.102 libavfilter 4. 10.100 / 4. 10.100 libswscale 2. 6.100 / 2. 6.100 libswresample 0. 19.100 / 0. 19.100 libpostproc 52. 3.100 / 52. 3.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'fate-suite/aac/al04_44.mp4': Metadata: major_brand : mp42 minor_version : 0 compatible_brands: mp42isom creation_time : 2004-02-19 14:38:56 Duration: 00:00:08.24, start: 0.000000, bitrate: 67 kb/s Stream #0:0(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 63 kb/s (default) Metadata: creation_time : 2004-02-19 14:38:56 handler_name : soun Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'fate-suite/aac/al05_44.mp4': Metadata: major_brand : mp42 minor_version : 0 compatible_brands: mp42isom creation_time : 2004-02-19 14:38:56 Duration: 00:00:07.43, start: 0.000000, bitrate: 131 kb/s Stream #1:0(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 127 kb/s (default) Metadata: creation_time : 2004-02-19 14:38:56 handler_name : soun [mov @ 0x2188d00] Using AVStream.codec.time_base as a timebase hint to the muxer is deprecated. Set AVStream.time_base instead. Last message repeated 1 times Output #0, mov, to 'out2.mov': Metadata: major_brand : mp42 minor_version : 0 compatible_brands: mp42isom encoder : Lavf55.46.100 Stream #0:0(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 128 kb/s (default) Metadata: creation_time : 2004-02-19 14:38:56 handler_name : soun encoder : Lavc55.69.100 aac Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default) Metadata: creation_time : 2004-02-19 14:38:56 handler_name : soun encoder : Lavc55.69.100 aac Stream mapping: Stream #0:0 -> #0:0 (aac (native) -> aac (native)) Stream #1:0 -> #0:1 (aac (native) -> aac (native)) Press [q] to stop, [?] for help size= 252kB time=00:00:08.24 bitrate= 250.6kbits/s video:0kB audio:246kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 2.660035%
$ ffmpeg -i out2.mov ffmpeg version N-64656-g2a9b4c0 Copyright (c) 2000-2014 the FFmpeg developers built on Jul 14 2014 13:56:52 with gcc 4.7 (SUSE Linux) configuration: --enable-gpl libavutil 52. 92.100 / 52. 92.100 libavcodec 55. 69.100 / 55. 69.100 libavformat 55. 46.100 / 55. 46.100 libavdevice 55. 13.102 / 55. 13.102 libavfilter 4. 10.100 / 4. 10.100 libswscale 2. 6.100 / 2. 6.100 libswresample 0. 19.100 / 0. 19.100 libpostproc 52. 3.100 / 52. 3.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'out2.mov': Metadata: major_brand : qt minor_version : 512 compatible_brands: qt encoder : Lavf55.46.100 Duration: 00:00:08.27, start: 0.023220, bitrate: 249 kb/s Stream #0:0(eng): Audio: aac (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 126 kb/s (default) Metadata: handler_name : DataHandler Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 129 kb/s (default) Metadata: handler_name : DataHandler At least one output file must be specified
follow-up: 12 comment:11 by , 10 years ago
Replying to cehoyos:
The issue is still reproducible with current FFmpeg git head:
can you explain in which way it is insufficient ? / what did QT do ?
comment:12 by , 10 years ago
Replying to michael:
Replying to cehoyos:
The issue is still reproducible with current FFmpeg git head:
can you explain in which way it is insufficient ? / what did QT do ?
When a file is played by QuickTime on a desktop, both audio tracks play simultaneously; on an AppleTV, the AC-3 track is ignored and cannot be played - only the AAC track is usable.
Both audio tracks are visible when ffprobe is used, but having multiple default audio streams causes the problem.
Broken (Unplayable AC-3)
Metadata: handler_name : VideoHandler Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 256 kb/s (default) Metadata: handler_name : SoundHandler Stream #0:2(eng): Audio: ac3 (ac-3 / 0x332D6361), 48000 Hz, 5.1(side), fltp, 384 kb/s (default) Metadata: handler_name : SoundHandler Stream #0:3(eng): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s (default) Metadata: handler_name : SubtitleHandler Stream #0:4: Video: mjpeg, yuvj444p(pc), 600x600 [SAR 72:72 DAR 1:1], 90k tbr, 90k tbn, 90k tbc
Playable (Working dual-audio)
Metadata: handler_name : VideoHandler Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 256 kb/s (default) Metadata: handler_name : SoundHandler Stream #0:2(eng): Audio: ac3 (ac-3 / 0x332D6361), 48000 Hz, 5.1(side), fltp, 384 kb/s Metadata: handler_name : SoundHandler Stream #0:3(eng): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s (default) Metadata: handler_name : SubtitleHandler Stream #0:4: Video: mjpeg, yuvj444p(pc), 600x600 [SAR 72:72 DAR 1:1], 90k tbr, 90k tbn, 90k tbc
comment:13 by , 10 years ago
I've updated the patch to apply against the 2.3.x series. It, along with the Homebrew formula can be found here:
https://gist.github.com/outlyer/4a88f1adb7f895b93fd9
I ran make fate
and it was clean.
comment:14 by , 10 years ago
this is still a issue in git-master
download files:
https://dl.dropboxusercontent.com/u/7221986/ffmpeg_ticket3622.mkv
https://dl.dropboxusercontent.com/u/7221986/ffmpeg_ticket3622.aac
output file test.mp4 has both audio tracks enabled ;(
ffmpeg -i ffmpeg_ticket3622.mkv -i ffmpeg_ticket3622.aac -map 0:0 -map 1:0 -map 0:1 -vcodec copy -acodec copy test.mp4 ffmpeg version N-67684-g12630fa Copyright (c) 2000-2014 the FFmpeg developers built on Nov 15 2014 13:27:31 with Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn) configuration: libavutil 54. 11.100 / 54. 11.100 libavcodec 56. 12.101 / 56. 12.101 libavformat 56. 12.103 / 56. 12.103 libavdevice 56. 3.100 / 56. 3.100 libavfilter 5. 2.103 / 5. 2.103 libswscale 3. 1.101 / 3. 1.101 libswresample 1. 1.100 / 1. 1.100 Input #0, matroska,webm, from 'ffmpeg_ticket3622.mkv': Metadata: title : The Dark Knight Rises (2012) ENCODER : Lavf55.19.104 Duration: 00:00:12.89, start: 0.083000, bitrate: 9844 kb/s Chapter #0:0: start 0.000000, end 10.000000 Metadata: title : 00:00:00.000 Stream #0:0: Video: h264 (High), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default) Metadata: title : 1080p Stream #0:1(ger): Audio: ac3, 48000 Hz, 5.1(side), fltp, 448 kb/s (default) Metadata: title : AC3 LANGUAGE : ger Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'ffmpeg_ticket3622.aac': Metadata: major_brand : mp42 minor_version : 0 compatible_brands: mp42isom creation_time : 2022-08-10 10:47:44 Duration: 00:00:12.70, start: 0.044000, bitrate: 162 kb/s Stream #1:0(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 159 kb/s (default) Metadata: creation_time : 2022-08-10 10:47:44 [mp4 @ 0x7f907b034800] track 2: codec frame size is not set Output #0, mp4, to 'test.mp4': Metadata: title : The Dark Knight Rises (2012) encoder : Lavf56.12.103 Chapter #0:0: start 0.000000, end 9.917000 Metadata: title : 00:00:00.000 Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 23.98 fps, 16k tbn, 1k tbc (default) Metadata: title : 1080p Stream #0:1(eng): Audio: aac ([64][0][0][0] / 0x0040), 48000 Hz, stereo, 159 kb/s (default) Metadata: creation_time : 2022-08-10 10:47:44 Stream #0:2(ger): Audio: ac3 ([165][0][0][0] / 0x00A5), 48000 Hz, 5.1(side), 448 kb/s (default) Metadata: title : AC3 LANGUAGE : ger Stream mapping: Stream #0:0 -> #0:0 (copy) Stream #1:0 -> #0:1 (copy) Stream #0:1 -> #0:2 (copy) Press [q] to stop, [?] for help frame= 307 fps=0.0 q=-1.0 Lsize= 15745kB time=00:00:12.75 bitrate=10110.6kbits/s video:14785kB audio:943kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.104643%
comment:17 by , 10 years ago
May I ask the status of this ticket?
Will this patch be applied to git master?
comment:18 by , 9 years ago
i had to move the uploaded file to reproduce the issue:
http://www.filehosting.org/file/details/501459/ffmpeg_3622_default.zip
follow-up: 20 comment:19 by , 9 years ago
The fix proposed and executed in this ticket works for a specific workflow. However there are other workflows that require all audio tracks to be enabled upon the MOV being created such as delivery to iTunes, or Netflix, or professional post production facilities internal workflows. I would like to propose (if it's possible) to have some type of switch in the code allowing someone to tell FFMPEG to either make only track 1 enabled or to make all tracks enabled.
by , 9 years ago
Attachment: | AlternateTrack.png added |
---|
comment:20 by , 9 years ago
Replying to kennyboy97:
The fix proposed and executed in this ticket works for a specific workflow. However there are other workflows that require all audio tracks to be enabled upon the MOV being created such as delivery to iTunes, or Netflix, or professional post production facilities internal workflows. I would like to propose (if it's possible) to have some type of switch in the code allowing someone to tell FFMPEG to either make only track 1 enabled or to make all tracks enabled.
I work with many people facing this same issue. It's surprising to me that the FFmpeg developers would introduce a behavior like this without any mechanism of control, to satisfy one user's request: https://trac.ffmpeg.org/ticket/2626
That said, per the attached screen shot (https://trac.ffmpeg.org/attachment/ticket/3622/AlternateTrack.png), the issue here is that the audio tracks are being created as alternates to each other, so there is no way to enable all created audio tracks, and save, unless you remove the Alternate assignment in QuickTime Player 7 (Pro). This behavior makes a major assumption that your audio content is alternative ie. languages that need to be switched, instead of perhaps stereo, 5.1, and M&E across 3 audio tracks of the QuickTime file. Is there any plan to fix this?
follow-up: 22 comment:21 by , 9 years ago
Cc: | added |
---|
comment:22 by , 9 years ago
Replying to jheliker:
This issue is magnified by the fact that the disabled tracks on the resulting files cannot be modified. If you attempt to re-enable them in quicktime and re-save the file (without doing a "save-as" and creating a new file), the change doesn't stick. When you close and re-open the files the track will remain disabled.
This really needs to be addressed -- it's rendering FFMPEG useless for us. I'd love to please see a response or even better, a patch!
follow-up: 24 comment:23 by , 9 years ago
I'd love to please see a response or even better, a patch!
there is a patch, see comment 13
comment:24 by , 9 years ago
Replying to julian:
I'd love to please see a response or even better, a patch!
there is a patch, see comment 13
I've updated the patch to apply cleanly against the 2.8.x series. It's here:
https://gist.github.com/outlyer/4a88f1adb7f895b93fd9
comment:25 by , 8 years ago
I'm currently trying to figure out how to manage the "default" audio track and this ticket is the closest I've come. I'm muxing h264 video along with aac and dts audio and don't have alternative languages so default has nothing to do with languages. Am I suffering this bug or just missing documentation on how to tag a default audio track?
comment:26 by , 8 years ago
while the patch can be updated to apply against 3.2+ (codec=>codecpar), it now prodeces broken files. does anyone have an updated patch or some progress on fixing the actual underlying bug?
comment:27 by , 8 years ago
ok not true first attempt was incomplete...this works for 3.2
https://gist.github.com/core-code/027bab78a24e0b937a2a6561ea8a8ab9
comment:28 by , 8 years ago
ok updated patch for 3.2 works:
https://gist.github.com/core-code/027bab78a24e0b937a2a6561ea8a8ab9
comment:29 by , 7 years ago
@julian, Thank you for the patch, it worked well for me today on 3.3.
From what I read above, it sounds like the issue is that this logic will cause a regression. I did notice that not all the tests passed when following the Travis build and test steps. Could a new 'Quicktime' flag be added to ffmpeg to enable this one-off behavior? It seems like we should start by adding an Acceptance Test for Quicktime that fails under the existing production code.
comment:30 by , 6 years ago
Cc: | added |
---|
changing
if (st->disposition & AV_DISPOSITION_DEFAULT)
to
if (0 && st->disposition & AV_DISPOSITION_DEFAULT)
fixes everything for my purpose. only first audio track is enabled, like in ffmpeg 1.2.x