lisamelton / other_video_transcoding

Other tools to transcode videos.
MIT License
555 stars 26 forks source link

Multiple Audio Tracks in Quicktime #69

Closed weaverm closed 3 years ago

weaverm commented 4 years ago

Here's a curious side note. I ran an encode last night that included an added audio track.

other-transcode --eac3 --hevc --x265 --mp4 --add-audio 3 /path/to/movie.mkv

In the resulting file, mediainfo shows both audio tracks.

Audio #1
ID                                       : 2
Format                                   : E-AC-3
Format/Info                              : Enhanced AC-3
Commercial name                          : Dolby Digital Plus
Codec ID                                 : ec-3
Duration                                 : 1 h 55 min
Bit rate mode                            : Constant
Bit rate                                 : 640 kb/s
Channel(s)                               : 6 channels
Channel layout                           : L R C LFE Ls Rs
Sampling rate                            : 48.0 kHz
Frame rate                               : 31.250 FPS (1536 SPF)
Compression mode                         : Lossy
Stream size                              : 528 MiB (9%)
Language                                 : English
Service kind                             : Complete Main
Default                                  : Yes
Alternate group                          : 1
Menus                                    : 4

Audio #2
ID                                       : 3
Format                                   : AC-3
Format/Info                              : Audio Coding 3
Commercial name                          : Dolby Digital
Codec ID                                 : ac-3
Duration                                 : 1 h 55 min
Bit rate mode                            : Constant
Bit rate                                 : 192 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 31.250 FPS (1536 SPF)
Compression mode                         : Lossy
Stream size                              : 159 MiB (3%)
Language                                 : English
Service kind                             : Complete Main
Default                                  : No
Alternate group                          : 1
Menus                                    : 4

I can access both tracks using mpv. Quicktime (and iTunes), however, only sees the first audio track. My AppleTV 4K can play both tracks. I wonder if this is an artifact of the version of Quicktime on my Mojave Mac? Perhaps it is because I used the --eac3 switch?

If you think this is a separate issue, that's fine with me.

_Originally posted by @weaverm in https://github.com/donmelton/other_video_transcoding/issues/50#issuecomment-690325094_

weaverm commented 4 years ago

I transcoded the same movie without the --eac3 switch. Quicktime still does not see the 2nd audio track.

other-transcode --hevc --x265 --mp4 --add-audio 3 /path/to/movie.mkv

Both audio tracks are now just AC-3 according the mediainfo.

Audio #1
ID                                       : 2
Format                                   : AC-3
Format/Info                              : Audio Coding 3
Commercial name                          : Dolby Digital
Codec ID                                 : ac-3
Duration                                 : 1 h 55 min
Bit rate mode                            : Constant
Bit rate                                 : 640 kb/s
Channel(s)                               : 6 channels
Channel layout                           : L R C LFE Ls Rs
Sampling rate                            : 48.0 kHz
Frame rate                               : 31.250 FPS (1536 SPF)
Compression mode                         : Lossy
Stream size                              : 528 MiB (9%)
Language                                 : English
Service kind                             : Complete Main
Default                                  : Yes
Alternate group                          : 1
Menus                                    : 4

Audio #2
ID                                       : 3
Format                                   : AC-3
Format/Info                              : Audio Coding 3
Commercial name                          : Dolby Digital
Codec ID                                 : ac-3
Duration                                 : 1 h 55 min
Bit rate mode                            : Constant
Bit rate                                 : 192 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 31.250 FPS (1536 SPF)
Compression mode                         : Lossy
Stream size                              : 159 MiB (3%)
Language                                 : English
Service kind                             : Complete Main
Default                                  : No
Alternate group                          : 1
Menus                                    : 4
lisamelton commented 4 years ago

@weaverm Thanks for testing that! But I have no explanation as to this peculiarity of QuickTime. Is this a limitation with any other videos that you have? That is, those not generated by other-transcode.

weaverm commented 4 years ago

No, which is why it stood out to me. I've made quite a lot of videos with your first transcode-video tool and Quicktime sees the additional audio tracks and the names I give them. For example, here's the command line I used for the same movie discussed above.

transcode-video --m4v --output ./moviehome/ --target big --encoder vt_h264 --add-audio 3="Director+ Commentary" --crop 138:138:0:0 ./path/to/movie.mkv

When I open that file in Quicktime I have the option to select an audio track titled Director+ Commentary.

In the MKV rip of the Blu-ray I named that track using makeMKV.

Audio #3
ID                                       : 4
ID in the original source medium         : 4357 (0x1105)
Format                                   : AC-3
Format/Info                              : Audio Coding 3
Commercial name                          : Dolby Digital
Codec ID                                 : A_AC3
Duration                                 : 1 h 55 min
Bit rate mode                            : Constant
Bit rate                                 : 192 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 31.250 FPS (1536 SPF)
Compression mode                         : Lossy
Stream size                              : 159 MiB (1%)
Title                                    : Director+ Commentary
Language                                 : English
Service kind                             : Complete Main
Default                                  : No
Forced                                   : No
Original source medium                   : Blu-ray

It is possible this is a bug/limitation in the Mojave version of Quicktime. I don't have a Catalina version of Quicktime available to me to test. It is also possible it is a peculiarity of how ffmpeg writes out an hevc movie into a .mp4 container.

In traditional software engineering parlance, this is clearly a low priority bug. Especially since an AppleTV 4K seems to be able to access the additional audio track, although, without the descriptive name.

lisamelton commented 4 years ago

@weaverm Yeah, this is probably an issue with the MP4 muxer in ffmpeg then.

And I would agree, this is a low priority bug for now. I'll talk to the HiveMind™ about this and see if anyone has an idea how we can work around it.

weaverm commented 4 years ago

Here's another weird tidbit. The movie I encoded to a 10-bit h265 in a .mp4 container… I synced the movie over to my iPhone (iOS 13.7) and it does not see the second audio track. Other movies made with transcode-video that do have second audio tracks work as expected on my iPhone.

lisamelton commented 4 years ago

@weaverm This one is a puzzler, isn't it? :) And another reason I'll never be done with this project.

rhapsodians commented 3 years ago

@weaverm @donmelton Hi all - quick update: I ran a quick test of other-transcode "E:\BR\1917 (2019).mkv" --eac3 --hevc --x265 --mp4 --add-audio all and expected to see the five audio streams. They are all present and accounted for when viewed by ffprobe and MediaInfo on the Mac. But the AC3 streams are not seen with MediaInfo on Windows.

When checking on a Catalina Mac (10.15.7), both VLC, MPV and Plex see all the tracks ... no problem at all. However, QuickTime only sees the first two tracks. I can't get it to see any more. I then though it was audio-codec related but it's all standard stuff: one EAC3 track, one AAC stereo track and three AC-3 tracks (one AD and two commentary tracks).

Because every other piece of software works fine (including via Plex on the ATV4K and FireTV4K), I can only conclude it's a QT problem ... which lead me to find lots and lots of comments on the various forums saying AC-3 can't be played within QT without third-party plugins. (Apple have added this to tvOS apparently which is why it's working on ATV).

So if this is true, I'd recommend switching to Infuse Pro or VLC on iPhone and just avoid iTunes playback of AC-3 tracks on iPhone/Mac QuickTime Player. Then use MPV or VLC on a Mac too.

lisamelton commented 3 years ago

@rhapsodians Thanks for the testing! Very odd. But I agree completely with your recommendation for @weaverm.

lisamelton commented 3 years ago

I'm going to close this since, technically, this is not a bug in other-transcode.