Opened 11 years ago

Closed 11 years ago

Last modified 9 years ago

#2626 closed enhancement (invalid)

possibility to create "disabled" tracks in MP4/MOV container missing

Reported by: julian Owned by:
Priority: wish Component: avformat
Version: git-master Keywords: mov mkv
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

hello
i need to create an MP4 file with an "disabled" audio track for playback on the AppleTV. it seems MP4 and MOV containers have the option to toggle whether tracks are enabled or disabled.

i've searched the manpage and googled to no avail, it seems ffmpeg is currently missing this capability. only thing i found is someone else looking for this too ( http://stackoverflow.com/questions/14409194/how-to-disable-non-1st-audio-streams-tracks-in-ffmpeg-for-mp4-files ).

please add the option to specify which tracks ( -map ) should be enabled or disabled when creating MP4 files.

currently i have to post process the files created by ffmpeg using MP4Box ( http://blog.jdknight.me/2011/05/handbrake-playstation-3-and-51-surround.html ).

thanks in advance for considering to implement this (or pointing me to the documentation if it really is already possible).

Change History (16)

comment:1 by Carl Eugen Hoyos, 11 years ago

Keywords: mov mkv added
Priority: normalwish

comment:2 by Carl Eugen Hoyos, 11 years ago

Rereading your ticket, I am not sure if I understand it:
Afaict, FFmpeg by default makes the first audio track "enabled" and the remaining audio tracks "disabled" which may not match your ticket description.

Please add your command line together with the complete, uncut console output to make this a valid ticket and to allow to reproduce the issue.

comment:3 by julian, 11 years ago

i'm not seeing the second audio track being "disabled", i have to post process the files in MP4Box

comment:4 by Carl Eugen Hoyos, 11 years ago

Please provide your failing ffmpeg command line (the one that produces the output file that you have to post process) together with the complete, uncut console output to make this a valid ticket and to allow developers to reproduce the problem.

comment:5 by julian, 11 years ago

you are right, 1.2.1 disables a second audio track by default, but v1.0 (which i did use previously) does not - there must have been a recent change here.

i'm not sure in which version the change occurred, and it doesn't seem to be documented here: https://ffmpeg.org/ffmpeg.html

is there any way to control this behavior to specify which audio tracks should be en/disabled? if not, i'd like to see this added ;)

comment:6 by Carl Eugen Hoyos, 11 years ago

Please always test current git head before opening tickets, see http://ffmpeg.org/bugreports.html

If you are interested in this issue, please provide a failing command line including the complete, uncut console output and explain the incorrect behaviour.

comment:7 by julian, 11 years ago

please read my comment again, there is no failing command line (anymore). i'm happy that recent ffmpeg already disables the second audio track.

however there are still two issues here (and still no failing command line):

  • the current behavior is not documented at all, and the change wasn't even documented in the changelog
  • there is no way to control the behavior. what about users that DON'T want the second audio track to be disabled?

in reply to:  7 comment:8 by Carl Eugen Hoyos, 11 years ago

Resolution: invalid
Status: newclosed

Replying to julian:

please read my comment again, there is no failing command line (anymore). i'm happy that recent ffmpeg already disables the second audio track.

Thank you for testing!

however there are still two issues here (and still no failing command line):

  • the current behavior is not documented at all, and the change wasn't even documented in the changelog

This was a user-reported bug, bug fixes generally do not make it into the Changelog

  • there is no way to control the behavior. what about users that DON'T want the second audio track to be disabled?

Please feel free to contribute to http://thread.gmane.org/gmane.comp.video.ffmpeg.user/46316
I don't think my main question was answered yet.

comment:9 by julian, 10 years ago

2.1 creates the second audio track as enabled again (and again without option to 'disable' it) so i'd like to have this bug-report re-opened

comment:10 by julian, 10 years ago

https://dl.dropboxusercontent.com/u/7221986/bla.aac
https://dl.dropboxusercontent.com/u/7221986/bla.mkv

ffmpeg -i bla.mkv -i bla.aac -map 0:0 -map 1:0 -map 0:1 -acodec copy -vcodec copy bla.mp4

with 1.2.4 this produces a MP4 with the second (surround) audio track being disabled, with 2.1 its enabled

comment:11 by julian, 10 years ago

would a git bisect speed up a fix of this?

comment:12 by Carl Eugen Hoyos, 10 years ago

Sorry for forgetting about this issue.
A bisect will hopefully not be necessary but a failing command line (a command line that does not work as expected) together with complete, uncut console output is needed: I am unable to produce an output mov file where the second audio track is enabled.

comment:13 by julian, 10 years ago

provided in comment 10 but i'll write it up again

  1. download ​

https://dl.dropboxusercontent.com/u/7221986/bla.aac
https://dl.dropboxusercontent.com/u/7221986/bla.mkv

  1. ffmpeg-1.2.1 -i bla.mkv -i bla.aac -map 0:0 -map 1:0 -map 0:1 -acodec copy -vcodec copy bla-old.mp4
  2. ffmpeg-2.2.1 -i bla.mkv -i bla.aac -map 0:0 -map 1:0 -map 0:1 -acodec copy -vcodec copy bla-new.mp4
  3. open bla-old.mp4, the second audio track is disabled as it should be. open bla-new.mp4, the second audio track is enabled

complete output


$ ./ffmpeg-2.2.1 -i bla.mkv -i bla.aac -map 0:0 -map 1:0 -map 0:1 -acodec copy -vcodec copy bla-new.mp4
ffmpeg version 2.2.1-tessus Copyright (c) 2000-2014 the FFmpeg developers
  built on Apr 10 2014 05:10:42 with llvm-gcc 4.2.1 (LLVM build 2336.1.00)
  configuration: --prefix=/Users/tessus/data/ext/ffmpeg/sw --as=yasm --extra-version=tessus --disable-shared --enable-static --disable-ffplay --enable-gpl --enable-pthreads --enable-postproc --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libx265 --enable-libxvid --enable-libspeex --enable-bzlib --enable-zlib --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libxavs --enable-version3 --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvpx --enable-libgsm --enable-libopus --enable-libmodplug --enable-fontconfig --enable-libfreetype --enable-libass --enable-libbluray --enable-filters --disable-indev=qtkit --enable-runtime-cpudetect
  libavutil      52. 66.100 / 52. 66.100
  libavcodec     55. 52.102 / 55. 52.102
  libavformat    55. 33.100 / 55. 33.100
  libavdevice    55. 10.100 / 55. 10.100
  libavfilter     4.  2.100 /  4.  2.100
  libswscale      2.  5.102 /  2.  5.102
  libswresample   0. 18.100 /  0. 18.100
  libpostproc    52.  3.100 / 52.  3.100
Input #0, matroska,webm, from 'bla.mkv':
  Metadata:
    ENCODER         : Lavf55.19.104
  Duration: 00:00:13.89, start: 0.042000, bitrate: 3975 kb/s
    Stream #0:0(eng): Video: h264 (High), yuv420p(tv, bt709), 1280x720 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn, 2k tbc (default)
    Stream #0:1(eng): Audio: ac3, 48000 Hz, 5.1(side), fltp, 384 kb/s (default)
    Stream #0:2: Subtitle: subrip (default)
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'bla.aac':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42isom
    creation_time   : 1983-09-23 01:07:26
  Duration: 00:00:12.86, start: 0.044000, bitrate: 153 kb/s
    Stream #1:0(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 150 kb/s (default)
    Metadata:
      creation_time   : 1983-09-23 01:07:26
File 'bla-new.mp4' already exists. Overwrite ? [y/N] y
[mp4 @ 0x103804800] track 2: codec frame size is not set
Output #0, mp4, to 'bla-new.mp4':
  Metadata:
    encoder         : Lavf55.33.100
    Stream #0:0(eng): Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 23.98 fps, 16k tbn, 1k tbc (default)
    Stream #0:1(eng): Audio: aac ([64][0][0][0] / 0x0040), 48000 Hz, stereo, 150 kb/s (default)
    Metadata:
      creation_time   : 1983-09-23 01:07:26
    Stream #0:2(eng): Audio: ac3 ([165][0][0][0] / 0x00A5), 48000 Hz, 5.1(side), 384 kb/s (default)
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
[mp4 @ 0x103804800] Non-monotonous DTS in output stream 0:0; previous: 4672, current: 4672; changing to 4673. This may result in incorrect timestamps in the output file.
frame=  310 fps=0.0 q=-1.0 Lsize=    6986kB time=00:00:12.92 bitrate=4427.0kbits/s    
video:6130kB audio:840kB subtitle:0 data:0 global headers:0kB muxing overhead 0.234052%
$ ./ffmpeg-1.2.1 -i bla.mkv -i bla.aac -map 0:0 -map 1:0 -map 0:1 -acodec copy -vcodec copy bla-old.mp4
ffmpeg version 1.2.1-tessus Copyright (c) 2000-2013 the FFmpeg developers
  built on May  9 2013 21:58:14 with llvm-gcc 4.2.1 (LLVM build 2336.1.00)
  configuration: --prefix=/Users/tessus/data/ext/ffmpeg/sw --as=yasm --extra-version=tessus --disable-shared --enable-static --disable-ffplay --enable-gpl --enable-pthreads --enable-postproc --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-libspeex --enable-bzlib --enable-zlib --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libxavs --enable-version3 --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvpx --enable-libgsm --enable-libopus --enable-fontconfig --enable-libfreetype --enable-libass --enable-filters --enable-runtime-cpudetect
  libavutil      52. 18.100 / 52. 18.100
  libavcodec     54. 92.100 / 54. 92.100
  libavformat    54. 63.104 / 54. 63.104
  libavdevice    54.  3.103 / 54.  3.103
  libavfilter     3. 42.103 /  3. 42.103
  libswscale      2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
Input #0, matroska,webm, from 'bla.mkv':
  Metadata:
    ENCODER         : Lavf55.19.104
  Duration: 00:00:13.89, start: 0.000000, bitrate: 3975 kb/s
    Stream #0:0(eng): Video: h264 (High), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn, 2k tbc (default)
    Stream #0:1(eng): Audio: ac3, 48000 Hz, 5.1(side), fltp, 384 kb/s (default)
    Stream #0:2: Subtitle: subrip (default)
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'bla.aac':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42isom
    creation_time   : 1983-09-23 01:07:26
  Duration: 00:00:12.86, start: 0.044000, bitrate: 153 kb/s
    Stream #1:0(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 150 kb/s
    Metadata:
      creation_time   : 1983-09-23 01:07:26
File 'bla-old.mp4' already exists. Overwrite ? [y/N] y
track 2: codec frame size is not set
Output #0, mp4, to 'bla-old.mp4':
  Metadata:
    encoder         : Lavf54.63.104
    Stream #0:0(eng): Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 23.98 fps, 16k tbn, 1k tbc (default)
    Stream #0:1(eng): Audio: aac ([64][0][0][0] / 0x0040), 48000 Hz, stereo, 150 kb/s
    Metadata:
      creation_time   : 1983-09-23 01:07:26
    Stream #0:2(eng): Audio: ac3 ([165][0][0][0] / 0x00A5), 48000 Hz, 5.1(side), 384 kb/s (default)
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
[mp4 @ 0x102122200] st:0 PTS: 7360 DTS: 5344 < 5345 invalid, clipping
frame=  310 fps=0.0 q=-1.0 Lsize=    6986kB time=00:00:12.92 bitrate=4426.9kbits/s    
video:6130kB audio:840kB subtitle:0 global headers:0kB muxing overhead 0.233100%

in reply to:  13 comment:14 by Carl Eugen Hoyos, 10 years ago

Replying to julian:

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

I hope you understand why the console output was needed...

I opened ticket #3622, thank you for the reminder!

comment:15 by julian, 10 years ago

ok full output from now on ;) thanks for taking care of the issue

comment:16 by julian, 9 years ago

i had to change the location of the uploaded file to reproduce the issue:

http://www.filehosting.org/file/details/501454/ffmpeg_2626_disabled.zip

Note: See TracTickets for help on using tickets.