Closed kford closed 9 years ago
kford,
I'm glad you like the scripts. Thanks.
By default, transcode-video.sh
will create two audio tracks for input like your source.mkv
example. You're getting a third track because you added that same main audio track again.
Let me explain in detail what's happening and then how you can easily fix it. First, the diagnosis... :)
The way that transcode-video.sh
works is that, If possible, audio is first passed through in its original form. When audio transcoding is required, it's done in AAC format. And if the original is multi-channel surround sound (which your source.mkv
file seems to be), it's also done in Dolby Digital AC-3 format. Meaning the output can contain two tracks from the same source in different formats.
Dual format audio tracks are essentially required for proper playback on Apple TV. Which is why this is the the default behavior.
For output in a Matroska format container (which you've requested via the --mkv
option), the dual audio tracks are ordered AC-3 format first and then AAC format.
By default, transcode-video.sh
uses the first audio track in the input as the main audio track. You can override that behavior by using the --audio
option to identify a different track. (Note: not the --add-audio
option.) You haven't done that and since source.mkv
only contains a single audio track it doesn't matter.
However, you did request to add that that same track again to the output via the --add-audio 1
option and argument. By default, additional audio tracks are added in AAC format. Which means the second and third track of your output are identical.
Now, let me give your the cure... :)
For the case of an input file with a single audio track, simply use the --no-surround
option to prevent creation of any AC-3 audio tracks and do not use the --add-audio
option at all:
transcode-video.sh --slow --mkv --no-surround --add-subtitle 1 --crop 54:58:0:0 source.mkv
For the case of an input file with multiple audio tracks, you'll need to identify how many additional tracks there are and simply use an --add-audio
option for each track with the appropriate track number. For example, here's how you might handle a file with two additional audio tracks:
transcode-video.sh --slow --mkv --no-surround --add-audio 2 --add-audio 3 --add-subtitle 1 --crop 54:58:0:0 source.mkv
In the future, I'm considering a way to do something like --add-audio all
to make this even simpler. But for now, you need to use an option for each track. Which is how I use the script when I add named commentary tracks.
I hope that helps.
I'm closing this issue now but feel free to continue commenting here or in additional issues. Your questions and feedback are always welcome. Thanks.
Thanks for the detailed response Don! I've read it and I'll be updating my batch script to reflect what you've just shared with me. Your example command was
transcode-video.sh --slow --mkv --no-surround --add-audio 2 --add-audio 3 --add-subtitle 1 --crop 54:58:0:0 source.mkv
I assume, based on the quote below, that you added audio tracks 2 and 3 because track 1 was added by default (and because you specified no-surround, it was added as AAC), so you query the source to determine number of tracks, and add them all, excluding the first one which is added by default. Correct?
For the case of an input file with multiple audio tracks, you'll need to identify how many additional tracks there are and simply use an --add-audio option for each track with the appropriate track number. For example, here's how you might handle a file with two additional audio tracks:
Correct.
Hi Don,
Thanks for the great scripts!
I'm having a problem that is likely an issue with the way I'm using transcode-video.sh. I have source video that has a single (or multiple) AC-3 audio tracks. I wanted to convert them all to AAC (not add additional tracks) during transcoding. Here's an example
source.mkv (mediainfo tells me there is only a single audio track, like below)
And it produces target.mkv (mediainfo tells me there are now 3 audo tracks in the target file, like below)
I'd appreciate any advice you can offer
Thank you.