Opened 9 years ago

Last modified 9 years ago

#4334 new defect

Second audio track marked as default after copy

Reported by: Arthur Marxer Owned by:
Priority: normal Component: ffmpeg
Version: git-master Keywords: mp4 default audio track
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:

I have an mp4 source file with one video and two audio tracks. The first audio track is english and marked as default, the second is german. But the language in the file is undefined for both audio tracks:

c:\Temp>ffprobe -i "C:\Temp\Test.mp4"
ffprobe version N-70239-g111d79a Copyright (c) 2007-2015 the FFmpeg developers
  built with gcc 4.9.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-lib
modplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinge
r --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis
 --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-lzma --enable-decklink --enab
le-zlib
  libavutil      54. 19.100 / 54. 19.100
  libavcodec     56. 26.100 / 56. 26.100
  libavformat    56. 23.105 / 56. 23.105
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 11.101 /  5. 11.101
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'C:\Temp\Test.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf56.23.105
  Duration: 00:00:05.02, start: 0.005333, bitrate: 1658 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 720x576 [SAR 64:45 DAR 16:9], 757 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: ac3 (ac-3 / 0x332D6361), 48000 Hz, 5.1(side), fltp, 448 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
    Side data:
      unknown side data type 7 (4 bytes)
    Stream #0:2(und): Audio: ac3 (ac-3 / 0x332D6361), 48000 Hz, 5.1(side), fltp, 448 kb/s
    Metadata:
      handler_name    : SoundHandler
    Side data:
      unknown side data type 7 (4 bytes)

c:\Temp>

How to reproduce:
Now, I want to change the order of the audio tracks so that the first track will be german and maked as default and the second will be english. And I also want to set the language meta data to "ger" and "eng". I execute the following:

c:\Temp>ffmpeg.exe -i Test.mp4 -map 0:0 -map 0:2 -map 0:1 -c copy -metadata:s:a:0 language=ger -metadata:s:a:1 language=eng Out.mp4
ffmpeg version N-70239-g111d79a Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.9.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-lib
modplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinge
r --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis
 --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-lzma --enable-decklink --enab
le-zlib
  libavutil      54. 19.100 / 54. 19.100
  libavcodec     56. 26.100 / 56. 26.100
  libavformat    56. 23.105 / 56. 23.105
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 11.101 /  5. 11.101
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Test.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf56.23.105
  Duration: 00:00:05.02, start: 0.005333, bitrate: 1658 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 720x576 [SAR 64:45 DAR 16:9], 757 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: ac3 (ac-3 / 0x332D6361), 48000 Hz, 5.1(side), fltp, 448 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
    Side data:
      unknown side data type 7 (4 bytes)
    Stream #0:2(und): Audio: ac3 (ac-3 / 0x332D6361), 48000 Hz, 5.1(side), fltp, 448 kb/s
    Metadata:
      handler_name    : SoundHandler
    Side data:
      unknown side data type 7 (4 bytes)
[mp4 @ 0000000004a57b80] track 1: codec frame size is not set
[mp4 @ 0000000004a57b80] track 2: codec frame size is not set
Output #0, mp4, to 'Out.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf56.23.105
    Stream #0:0(und): Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 720x576 [SAR 64:45 DAR 16:9], q=2-31, 757 kb/s, 25 fps, 25 tbr, 12800 tbn, 12800 tbc (defau
lt)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(ger): Audio: ac3 ([165][0][0][0] / 0x00A5), 48000 Hz, 5.1(side), 448 kb/s
    Metadata:
      handler_name    : SoundHandler
    Side data:
      unknown side data type 7 (4 bytes)
    Stream #0:2(eng): Audio: ac3 ([165][0][0][0] / 0x00A5), 48000 Hz, 5.1(side), 448 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
    Side data:
      unknown side data type 7 (4 bytes)
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:2 -> #0:1 (copy)
  Stream #0:1 -> #0:2 (copy)
Press [q] to stop, [?] for help
frame=  125 fps=0.0 q=-1.0 Lsize=    1017kB time=00:00:05.02 bitrate=1658.2kbits/s
video:463kB audio:550kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.483151%

c:\Temp>

But in the output file, the second track is marked as default (english) and not the first (german):

c:\Temp>ffprobe -i Out.mp4
ffprobe version N-70239-g111d79a Copyright (c) 2007-2015 the FFmpeg developers
  built with gcc 4.9.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-lib
modplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinge
r --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis
 --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-lzma --enable-decklink --enab
le-zlib
  libavutil      54. 19.100 / 54. 19.100
  libavcodec     56. 26.100 / 56. 26.100
  libavformat    56. 23.105 / 56. 23.105
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 11.101 /  5. 11.101
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Out.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf56.23.105
  Duration: 00:00:05.02, start: 0.000000, bitrate: 1658 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 720x576 [SAR 64:45 DAR 16:9], 757 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(ger): Audio: ac3 (ac-3 / 0x332D6361), 48000 Hz, 5.1(side), fltp, 448 kb/s
    Metadata:
      handler_name    : SoundHandler
    Side data:
      unknown side data type 7 (4 bytes)
    Stream #0:2(eng): Audio: ac3 (ac-3 / 0x332D6361), 48000 Hz, 5.1(side), fltp, 448 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
    Side data:
      unknown side data type 7 (4 bytes)

c:\Temp>

I'm not shre if I'm correct, but should ffmpeg not always produce files where the first audio track is makred as default? Or is there a possibility how I can infuence ffmpeg so that the first audio track will be marked as default?

Attachments (1)

Test.mp4 (1016.9 KB ) - added by Arthur Marxer 9 years ago.
The sample mp4 file that can be used to reproduce the problem

Download all attachments as: .zip

Change History (3)

by Arthur Marxer, 9 years ago

Attachment: Test.mp4 added

The sample mp4 file that can be used to reproduce the problem

comment:1 by Arthur Marxer, 9 years ago

I also found a similar Ticket #3622, I don't know if it's the same bug.

comment:2 by Arthur Marxer, 9 years ago

As workaround, I can use mp4box to correct this. With mp4box, I see that the first audio track of my output is disabled:

c:\Temp>mp4box -info Out.mp4
* Movie Info *
        Timescale 1000 - Duration 00:00:05.024
        3 track(s)
        Fragmented File: no
        File Brand isom - version 512
        Created: UNKNOWN DATE   Modified: UNKNOWN DATE
File has no MPEG4 IOD/OD

iTunes Info:
        Encoder Software: Lavf56.23.105
1 UDTA types: meta (1)

Track # 1 Info - TrackID 1 - TimeScale 12800 - Media Duration 00:00:05.000
Track has 2 edit lists: track duration is 00:00:05.005
Media Info: Language "und (und)" - Type "vide:avc1" - 125 samples
Visual Track layout: x=0 y=0 width=1024 height=576
MPEG-4 Config: Visual Stream - ObjectTypeIndication 0x21
AVC/H264 Video - Visual Size 720 x 576
        AVC Info: 1 SPS - 1 PPS - Profile High @ Level 3
        NAL Unit length bits: 32
        Pixel Aspect Ratio 64:45 - Indicated track size 1024 x 576
Self-synchronized

Track # 2 Info - TrackID 2 - TimeScale 48000 - Media Duration 00:00:05.024
Track has 1 edit lists: track duration is 00:00:05.024
Track is disabled
Media Info: Language "ger (ger)" - Type "soun:ac-3" - 157 samples
        AC-3 stream - Sample Rate 48000 - 5.1 channel(s) - bitrate 448000
Alternate Group ID 1

Track # 3 Info - TrackID 3 - TimeScale 48000 - Media Duration 00:00:05.024
Track has 1 edit lists: track duration is 00:00:05.024
Media Info: Language "eng (eng)" - Type "soun:ac-3" - 157 samples
        AC-3 stream - Sample Rate 48000 - 5.1 channel(s) - bitrate 448000
Alternate Group ID 1


c:\Temp>

So as workaround, I can simply enable the first audio track and disable the second audio track with mp4box:

c:\Temp>mp4box Out.mp4 -enable 2 -disable 3
Saving Out.mp4: 0.500 secs Interleaving

Now, everything is fine, the mp4box output is

c:\Temp>mp4box -info Out.mp4
* Movie Info *
        Timescale 1000 - Duration 00:00:05.024
        3 track(s)
        Fragmented File: no
        File suitable for progressive download (moov before mdat)
        File Brand isom - version 512
        Created: UNKNOWN DATE   Modified: UNKNOWN DATE
File has no MPEG4 IOD/OD

iTunes Info:
        Encoder Software: Lavf56.23.105
1 UDTA types: meta (1)

Track # 1 Info - TrackID 1 - TimeScale 12800 - Media Duration 00:00:05.000
Track has 2 edit lists: track duration is 00:00:05.005
Media Info: Language "und (und)" - Type "vide:avc1" - 125 samples
Visual Track layout: x=0 y=0 width=1024 height=576
MPEG-4 Config: Visual Stream - ObjectTypeIndication 0x21
AVC/H264 Video - Visual Size 720 x 576
        AVC Info: 1 SPS - 1 PPS - Profile High @ Level 3
        NAL Unit length bits: 32
        Pixel Aspect Ratio 64:45 - Indicated track size 1024 x 576
        Chroma format 0 - Luma bit depth 8 - chroma bit depth 8
Self-synchronized

Track # 2 Info - TrackID 2 - TimeScale 48000 - Media Duration 00:00:05.024
Track has 1 edit lists: track duration is 00:00:05.024
Media Info: Language "ger (ger)" - Type "soun:ac-3" - 157 samples
        AC-3 stream - Sample Rate 48000 - 5.1 channel(s) - bitrate 448000
Alternate Group ID 1

Track # 3 Info - TrackID 3 - TimeScale 48000 - Media Duration 00:00:05.024
Track has 1 edit lists: track duration is 00:00:05.024
Track is disabled
Media Info: Language "eng (eng)" - Type "soun:ac-3" - 157 samples
        AC-3 stream - Sample Rate 48000 - 5.1 channel(s) - bitrate 448000
Alternate Group ID 1


c:\Temp>

And ffprobe is also fine:

c:\Temp>ffprobe -i Out.mp4
ffprobe version N-70239-g111d79a Copyright (c) 2007-2015 the FFmpeg developers
  built with gcc 4.9.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-lib
modplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinge
r --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis
 --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-lzma --enable-decklink --enab
le-zlib
  libavutil      54. 19.100 / 54. 19.100
  libavcodec     56. 26.100 / 56. 26.100
  libavformat    56. 23.105 / 56. 23.105
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 11.101 /  5. 11.101
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Out.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf56.23.105
  Duration: 00:00:05.02, start: 0.000000, bitrate: 1655 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 720x576 [SAR 64:45 DAR 16:9], 757 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(ger): Audio: ac3 (ac-3 / 0x332D6361), 48000 Hz, 5.1(side), fltp, 448 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
    Side data:
      unknown side data type 7 (4 bytes)
    Stream #0:2(eng): Audio: ac3 (ac-3 / 0x332D6361), 48000 Hz, 5.1(side), fltp, 448 kb/s
    Metadata:
      handler_name    : SoundHandler
    Side data:
      unknown side data type 7 (4 bytes)

c:\Temp>

It would be nice when I could produce the desired output wihout this workaround i.e. without another product.

Last edited 9 years ago by Arthur Marxer (previous) (diff)
Note: See TracTickets for help on using tickets.