user21460: I've noticed that in movies download from iTunes Store there is duplicated audio track - the first one is AAC and the second one is AC3 but this is visible as one audio track with option "Prefer AC3 passthrough". I've compressed a movie in handbrake with AAC and AC3 audio but when I load this to iTunes, I see 2 audio tracks (same language) instead of 1. I've also noticed that when you put 2 audio tracks in the latest HandBrake, where the first one is AAC and the second one is AC3, iTunes displays this as one audio track. I wonder if there is any possibility to change my M4V file, so iTunes will display 1 audio track instead of 2 without recompressing the video? I'm thinking about using ffmpeg or mp4box to do that but have no idea how to deal with it.
For better results I've created new files. One using HandBrake 0.10 and second using HandBrake 1.0.7. Both files are the same movie, same settings, the only difference is HandBrake version I've used. FFprobe output seems to be the same (except creation date).
Below is the output from ffprobe for the file that is desirable and the file that has 2 audio tracks visible in iTunes:
ffprobe version 3.4 Copyright (c) 2007-2017 the FFmpeg developers
  built with gcc 7.2.0 (GCC)
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-cuda --enable-cuvid --enable-d3d11va --enable-nvenc --enable-dxva2 --enable-avisynth --enable-libmfx
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'd:\tbbb_ok.m4v':
  Metadata:
    major_brand     : mp42
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    creation_time   : 2018-02-17T09:09:52.000000Z
    title           : Big Buck Bunny
    artist          : Big Buck Bunny artist
    date            : 2018-01-01
    encoder         : HandBrake 1.0.7 2017040900
    genre           : Comedy
  Duration: 00:09:56.48, start: 0.000000, bitrate: 4857 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720 [SAR 1:1 DAR 16:9], 4048 kb/s, 24 fps, 24 tbr, 90k tbn, 48 tbc (default)
    Metadata:
      creation_time   : 2018-02-17T09:09:52.000000Z
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 160 kb/s (default)
    Metadata:
      creation_time   : 2018-02-17T09:09:52.000000Z
      handler_name    : Stereo
    Stream #0:2(und): Audio: ac3 (ac-3 / 0x332D6361), 48000 Hz, stereo, fltp, 640 kb/s
    Metadata:
      creation_time   : 2018-02-17T09:09:52.000000Z
      handler_name    : Stereo
    Side data:
      audio service type: main

.
ffprobe version 3.4 Copyright (c) 2007-2017 the FFmpeg developers
  built with gcc 7.2.0 (GCC)
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-cuda --enable-cuvid --enable-d3d11va --enable-nvenc --enable-dxva2 --enable-avisynth --enable-libmfx
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'd:\tbbb_nok.m4v':
  Metadata:
    major_brand     : mp42
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    title           : Big Buck Bunny
    artist          : Big Buck Bunny artist
    date            : 2018-01-01
    encoder         : HandBrake 0.10.1 2015030800
    genre           : Comedy
  Duration: 00:09:56.46, start: 0.000000, bitrate: 4806 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720 [SAR 1:1 DAR 16:9], 3997 kb/s, 24 fps, 24 tbr, 90k tbn, 48 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 160 kb/s (default)
    Metadata:
      handler_name    : Stereo
    Stream #0:2(und): Audio: ac3 (ac-3 / 0x332D6361), 48000 Hz, stereo, fltp, 640 kb/s
    Metadata:
      handler_name    : Stereo
    Side data:
      audio service type: main


user21460: I've found solution. To achieve this I used MP4Box and group audio tracks, so I've put AAC tracks in group 1 and AC3 tracks in group 2.
mp4box -add "track1.h264:fps=24.000:delay=0:lang=en:name=Video" -add "track2.aac:delay=0:lang=en:name=English:group=1" -add "track3.ac3:delay=0:lang=en:name=English:group=2" -add "track4.aac:delay=0:lang=fr:name=French:group=1" -add "track5.ac3:delay=0:lang=fr:name=French:group=2" -new "muxed.m4v"

The above command creates new m4v file with 2 AAC tracks and 2 AC3 tracks, so iTunes will display "English" and "French" once and "Prefer AC3 Passthrough" option as well.

21460: <p>I've noticed that in movies download from iTunes Store there is duplicated audio track - the first one is AAC and the second one is AC3 but this is visible as one audio track with option "Prefer AC3 passthrough". I've compressed a movie in handbrake with AAC and AC3 audio but when I load this to iTunes, I see 2 audio tracks (same language) instead of 1. I've also noticed that when you put 2 audio tracks in the latest HandBrake, where the first one is AAC and the second one is AC3, iTunes displays this as one audio track. I wonder if there is any possibility to change my M4V file, so iTunes will display 1 audio track instead of 2 without recompressing the video? I'm thinking about using ffmpeg or mp4box to do that but have no idea how to deal with it.</p>

<p>For better results I've created new files. One using HandBrake 0.10 and second using HandBrake 1.0.7. Both files are the same movie, same settings, the only difference is HandBrake version I've used. FFprobe output seems to be the same (except creation date).</p>

<p>Below is the output from ffprobe for the file that is desirable and the file that has 2 audio tracks visible in iTunes:</p>

<pre><code>ffprobe version 3.4 Copyright (c) 2007-2017 the FFmpeg developers
  built with gcc 7.2.0 (GCC)
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-cuda --enable-cuvid --enable-d3d11va --enable-nvenc --enable-dxva2 --enable-avisynth --enable-libmfx
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'd:\tbbb_ok.m4v':
  Metadata:
    major_brand     : mp42
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    creation_time   : 2018-02-17T09:09:52.000000Z
    title           : Big Buck Bunny
    artist          : Big Buck Bunny artist
    date            : 2018-01-01
    encoder         : HandBrake 1.0.7 2017040900
    genre           : Comedy
  Duration: 00:09:56.48, start: 0.000000, bitrate: 4857 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720 [SAR 1:1 DAR 16:9], 4048 kb/s, 24 fps, 24 tbr, 90k tbn, 48 tbc (default)
    Metadata:
      creation_time   : 2018-02-17T09:09:52.000000Z
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 160 kb/s (default)
    Metadata:
      creation_time   : 2018-02-17T09:09:52.000000Z
      handler_name    : Stereo
    Stream #0:2(und): Audio: ac3 (ac-3 / 0x332D6361), 48000 Hz, stereo, fltp, 640 kb/s
    Metadata:
      creation_time   : 2018-02-17T09:09:52.000000Z
      handler_name    : Stereo
    Side data:
      audio service type: main
</code></pre>

<p>.</p>

<pre><code>ffprobe version 3.4 Copyright (c) 2007-2017 the FFmpeg developers
  built with gcc 7.2.0 (GCC)
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-cuda --enable-cuvid --enable-d3d11va --enable-nvenc --enable-dxva2 --enable-avisynth --enable-libmfx
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'd:\tbbb_nok.m4v':
  Metadata:
    major_brand     : mp42
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    title           : Big Buck Bunny
    artist          : Big Buck Bunny artist
    date            : 2018-01-01
    encoder         : HandBrake 0.10.1 2015030800
    genre           : Comedy
  Duration: 00:09:56.46, start: 0.000000, bitrate: 4806 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720 [SAR 1:1 DAR 16:9], 3997 kb/s, 24 fps, 24 tbr, 90k tbn, 48 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 160 kb/s (default)
    Metadata:
      handler_name    : Stereo
    Stream #0:2(und): Audio: ac3 (ac-3 / 0x332D6361), 48000 Hz, stereo, fltp, 640 kb/s
    Metadata:
      handler_name    : Stereo
    Side data:
      audio service type: main
</code></pre>
 21460: <p>I've found solution. To achieve this I used MP4Box and group audio tracks, so I've put AAC tracks in group 1 and AC3 tracks in group 2.</p>

<pre><code>mp4box -add "track1.h264:fps=24.000:delay=0:lang=en:name=Video" -add "track2.aac:delay=0:lang=en:name=English:group=1" -add "track3.ac3:delay=0:lang=en:name=English:group=2" -add "track4.aac:delay=0:lang=fr:name=French:group=1" -add "track5.ac3:delay=0:lang=fr:name=French:group=2" -new "muxed.m4v"
</code></pre>

<p>The above command creates new m4v file with 2 AAC tracks and 2 AC3 tracks, so iTunes will display "English" and "French" once and "Prefer AC3 Passthrough" option as well.</p>
