Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: .MKV video with 6-channel AC3 audio downmix to Stereo AAC (Read 16479 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

.MKV video with 6-channel AC3 audio downmix to Stereo AAC

Hello, I've been trying to search the forum but having AC3 and AAC as my primary keyword, the forum search engine won't let me due to the character limitations. So I hope this hasn't been asked yet. If it is, may I ask a link to where I could direct myself to the right thread? Also I hope I'm asking in the right category too.

So here it is. I have 350 separate .MKV files which are separate "scenes" of a single film project. Each of these MKV files have 3 tracks. Video, Audio, and subtitle. Now I tried to use MKVtoolnix to append all these files together but it wasn't possible due to the audio tracks of some of the mkv files are of different format. So here's the breakdown of the audio file differences out of those 350 files.

20 files are 6-channel AC3 @ 384 kbps
20 files are stereo AC3 @ 384 kbps
310 files are stereo AAC @ 192 kbps.

Now, Video and subtitle doesn't seem to have any problems, but MKVtoolnix only pointed out the audio error only. So This is what I'm assuming would be the best way to do it.

1. Demux the 40 mkv file to separate the audio from the video (also the subtitles too).
2. Downmix the first 20 files into Stereo AC3.
3. Convert the 40 files into AAC. (keeping the stereo).
4. reencode the bitrate into 192 kbps.
5. Remux the audio with the video (with subtitles too).
6. Append all the remaining files together.

Do I get those steps correctly? Or is there any way that I can make the steps simpler and more efficient in terms of minimalizing quality loss? Maybe there are some steps that I can do simultaneously... As they say, single process is better than 2 separate processes since it has risks of losing some of the quality in separate processes. Or perhaps I got all the steps wrong and there's a right way to do it?

On the other hand, what tool can I use to achieve all that work in the most efficient and effective way? I don't mind command line since I tested out with eac3to myself at first, but I still don't know if the steps I want to do are the correct one. A GUI probably better for me. I also don't mind buying some commercial decoders/encoders myself too if I have to.

Any thoughts?
Thanks

.MKV video with 6-channel AC3 audio downmix to Stereo AAC

Reply #1
I've never worked with MKV files...

Subtitles are always a problem, and the programs I'm suggesting will probably loose them.  You'd probably have to handle the subtitles separately, and re-multiplex them after converting & joining the audio/video files.  Subtitles are usually added at the end after the audio/video editing has been done and you've got a complete movie/program.  So, most video editing programs (and conversion programs) will ignore subtitles when you import a A/V file. 

Typically if you want to join different audio/video formats (and optionally render to a new format) you'd use a video editor.   I use Corel Video Studio[/u] and Womble for video editing, but I don't know if these will work with your MKV files.  Lightworks is FREE, but I have not tried it yet and I don't know if it can edit/convert MKV files either.

Another option is to use a conversion program like SUPER (FREE) to convert all of the files to a common format before joining them.  SUPER does support MKV, and it has GUI interface.  SUPER can convert audio files, video files, or audio/video files.    It can demultiplex the audio or video from an A/V stream or it can 'extract" the audio or video to a different format.    But again, I don't think it handles subtitles.

.MKV video with 6-channel AC3 audio downmix to Stereo AAC

Reply #2
Thanks for the suggestions.
But I did use a video converter that supports joining. That one is actually a lot easier to do since I just use all 350 mkv files as an input set it to output as one single mkv file and the application just joins the file beautifully. The problem with that is the software renders the whole movie from the start until finish. The total length is over 8 hours. And it took me 3 days because the software renders frame by frame and reencoding them into a common format.

In the end, it joined successfully but there was a massive loss of quality from both the video and the audio. I know because I compare the scenes with the original source and there were blocks everywhere and parts of the video that's suppose to be sharp becomes blurry. (Even though the technical data seems to be identical resolution, unified bitrate and sample frequency, etc.)

When I use eac3to and mkvtoolnix, I can join and demux at the raw level, without reencoding ever occuring. That resulted in a very clean identical quality output. But that still gives me the problem. Mkvmerge won't let me append the 350 mkv files together because of the AC3 and AAC format differences in some of the videos.

Since the number of files that uses AC3 is a lot less than the AAC, that's why I assume it's better to demux the video from the audio and convert the 384 AC3 into 192 AAC. But I don't know what tool to use to let me do just that. Also have to downmix the AC3 as well.

.MKV video with 6-channel AC3 audio downmix to Stereo AAC

Reply #3
Do I get those steps correctly?


You got i right, except that the steps 2 and 3 are better be merged into a single process (you don't need to transcode twice).

All these operations can be performed with freely available tools (I assume you're on Windows). You will need mkvextract (part of mkvtoolnix, you probably alredy have it), foobar2000 with ac3 input plugin and Channel Mixer plugin, and Nero AAC encoder (note though that EULA for the latter only permits non-commercial use).

Extract the ac3 tracks and add them to foobar2000 playlist. Select all, right-click and choose "Convert". In the converter setup set AAC as output format (adjust the AAC encoder settings to 192 kbps), and in the "Processing" settings add "Channel Mixer" to the DSP filters list. In the Channel Mixer setup set number of output channels to 2. Click "Convert" when everything is set. Foobar2000 will need a command-line AAC encoder to do the job, it will ask you for neroAacEnc.exe location.

Use mkvmerge to multiplex and join the resulting files.

.MKV video with 6-channel AC3 audio downmix to Stereo AAC

Reply #4
Thanks for the tips.. It worked wonderfully. And easy too.
But I just hit another roadblock. After trying to join all the files together.
Turns out that the last 91 mkv files has been encoded differently again... *sigh* It's still the same AAC and 48kHz, but somehow there's a difference in the audio profile. Below is the specs that I got for the first 241 files with Media Player Classic for the Audio (I used ABR 192kbps):

Code: [Select]
Format            : AAC
Format/Info       : Advanced Audio Codec
Format profile    : LC
Codec ID          : A_AAC
Channel(s)        : 2 channels
Channel positions : Front: L R
Sampling rate     : 48.0 KHz


And below is what I got for the last 91 files:

Code: [Select]
Format            : AAC
Format/Info       : Advanced Audio Codec
Format profile    : HE-AAC / LC
Codec ID          : A_AAC
Channel(s)        : 2 channels
Channel positions : Front: L R
Sampling rate     : 48.0 KHz / 24.0 KHz


Now the one at the top I can join easily. But I won't be able to join it with the last 91 files since the audio format is somewhat different since it's HE-AAC encoded. The foobar tool that you suggested was successful in encoding the audio into the format at the top. But it won't be able to encode with the format I specify at the bottom.

My plan is to join the first 241 files. Then demultiplex the audio, convert it to have the exact same format as the last 91 files. Remultiplex it.. Then join the videos again, is that correct? However, I still don't know what tools that I can use to encode it exactly the same format as the second one. Or is there a better way?

I'm trying on using Winamp's transcoder function. Hopefully it works.

Thanks again

.MKV video with 6-channel AC3 audio downmix to Stereo AAC

Reply #5
UPDATE:

Never mind, After joining some files together, somehow there's some playback issues involved. Square blocks appeared on the video. And that's from just joining through mkvmerge, not a re-encoding.

I give up... I have no more desire to join or convert this project anymore. I'll just compile them into one folder and create a custom playlist that will allow anyone to just play the separate files sequentially.

Thanks for the information, suggestion, and assistance. I learned a lot about multichannel videos and conversion now. I'm closing this thread. Thank you for everything.