This project has moved and is read-only. For the latest updates, please go here.

Including Multiple Audio Tracks

Sep 5, 2014 at 8:26 PM
Edited Sep 5, 2014 at 8:26 PM
I am trying to include multiple audio tracks, and have specified so in my custom profile, but it seems to be getting overridden, so instead of getting a 6 channel and stereo track, I get two 6 channel tracks.

Where should I look to fix this in my configuration? I have Select Best Audio Track uncheck and MultiChannel Audio checked. I can send you a log if that would be helpful.

I noticed in my log that it probes and finds both tracks correctly, but them when it goes to convert it has this:
INFORMATION> 2014-09-05T11:16:07 MCEBuddy.Transcode.ConvertWithFfmpeg --> Setting up audio conversion parameters : -acodec ac3 -ab 384k
INFORMATION> 2014-09-05T11:16:07 MCEBuddy.Transcode.ConvertWithFfmpeg --> Skipping over Audio Track selection, no language request or only one Audio Track found
INFORMATION> 2014-09-05T11:16:07 MCEBuddy.Transcode.ConvertWithFfmpeg --> Setting up Audio channels
INFORMATION> 2014-09-05T11:16:07 MCEBuddy.Transcode.ConvertWithFfmpeg --> Did not find Audio Channel information, setting default audio channels to 6
Sep 5, 2014 at 10:06 PM
Post a link to the full log. It depends on how your profile was setup.

Sep 5, 2014 at 11:28 PM
Uploaded to FTP site "Discussion 565631.zip"

Thanks for looking!


Sep 6, 2014 at 5:05 PM
You're MCEBuddy settings are perfectly correct and what you're seeing is the expected behavior.

Your original video has 2 audio streams, one 6 channel and one 2 channel stream. However your profile is setup to re-encode the audio streams into 6 channel tracks and support muti channel audio. The line -a 1,2,3,4,5 is tell handbrake to support upto 5 audio tracks. The -E ffac3 is telling it to reencode the audio tracks using ac3 and MCEBuddy is adding the -ac 6 since you haven't specific the -ac (channels) in your profile and it detects the highest number of audio tracks in the original file is 6 channels. So handbrake taking the first 5 audio tracks and encoding them all using a 6 channel ac3 encoder. It's behaving exactly the way it's supposed to.

The issue you're facing is that you want to retain the original configuration. For that you've written your profile incorrectly. See this page for how handbrake handles audio codecs and channels. https://trac.handbrake.fr/wiki/CLIGuide
See the section on multiple audio tracks.

You have 2 options, one if use the copy encoder instead of the ac3, i.e -E copy, this is copy all audio track as is without recoding it.
The other option is to tell handbrake how to handle the different audio tracks whcih ones to copy, which ones to encode, how many channels etc.

e.g.
-a 1,1,2 -A "Main Audio","Downmixed Audio","Director's Commentary"-E copy:ac3,faac,ffaac -B auto,160,128 -R auto,auto,44100 -6 auto,dpl2,stereo 

This can get pretty complicated but it looks like that's what you're looking for. The simplest way in my opinion would be use -E copy


Sep 8, 2014 at 8:01 PM
I'm actually using FFMPEG, not handbrake for encoding and I still can't get this to work. It looks like MCEBuddy is stripping out my -map instructions so FFMPEG just picks the best track. Any way to get around this? I've tried -map 0:a as well as specifying all the mappings. Here is an example from my logs. You can see that although -acodec copy is specified, FFMPEG still just picks the best track. I believe it needs -map commands in order to copy all tracks.

INFORMATION> 2014-09-08T11:46:44 MCEBuddy.Transcode.ConvertWithFfmpeg --> Setting up General conversion parameters : -threads 0
INFORMATION> 2014-09-08T11:46:44 MCEBuddy.Transcode.ConvertWithFfmpeg --> Setting up input file name parameters
INFORMATION> 2014-09-08T11:46:44 MCEBuddy.Transcode.ConvertWithFfmpeg --> Setting up video conversion parameters : -vf yadif=0:-1:1,hqdn3d -vcodec libx264 -preset slow -crf 18 -x264opts level=4.0 -map 0:0 -map 0:1 -map 0:2
INFORMATION> 2014-09-08T11:46:44 MCEBuddy.Transcode.ConvertWithFfmpeg --> Is preset video size -> False
2014-09-08T11:46:44 MCEBuddy.Transcode.ConvertWithFfmpeg --> FFMpeg detected interlaced (or mbaff/paff) video scan, adding de-interlacing filters
INFORMATION> 2014-09-08T11:46:44 MCEBuddy.Transcode.ConvertWithFfmpeg --> Setting up crop parameters
INFORMATION> 2014-09-08T11:46:44 MCEBuddy.Transcode.ConvertWithFfmpeg --> FFMpeg Skipping video cropping
INFORMATION> 2014-09-08T11:46:44 MCEBuddy.Transcode.ConvertWithFfmpeg --> Checking if video resizing required
INFORMATION> 2014-09-08T11:46:44 MCEBuddy.Transcode.ConvertWithFfmpeg --> Setting up video resize parameters
INFORMATION> 2014-09-08T11:46:44 MCEBuddy.Transcode.ConvertWithFfmpeg --> Setting up aspect ratio if required
INFORMATION> 2014-09-08T11:46:44 MCEBuddy.Transcode.ConvertWithFfmpeg --> Setting up bitrate and quality parameters
INFORMATION> 2014-09-08T11:46:44 MCEBuddy.Transcode.ConvertWithFfmpeg --> Setting up audio conversion parameters : -acodec copy
INFORMATION> 2014-09-08T11:46:44 MCEBuddy.Transcode.ConvertWithFfmpeg --> Selecting Audio Track : -1
INFORMATION> 2014-09-08T11:46:44 MCEBuddy.Transcode.ConvertWithFfmpeg --> Letting ffmpeg choose best audio track
WARNING> 2014-09-08T11:46:44 MCEBuddy.Transcode.ConvertWithFfmpeg --> Cannot get Audio stream details, continuing with default Audio Language selection
INFORMATION> 2014-09-08T11:46:44 MCEBuddy.Transcode.ConvertWithFfmpeg --> Setting up Audio channels
WARNING> 2014-09-08T11:46:44 MCEBuddy.Transcode.ConvertWithFfmpeg --> Skipping over requested to set audio channel information either due to COPY codec
INFORMATION> 2014-09-08T11:46:44 MCEBuddy.Transcode.ConvertWithFfmpeg --> Setting up Output filename
INFORMATION> 2014-09-08T11:46:44 MCEBuddy.Transcode.ConvertWithFfmpeg --> Replacing user specified parameters
2014-09-08T11:46:44 MCEBuddy.Transcode.ConvertWithFfmpeg --> Command line parameters -> -threads 0 -y -i "C:\Users\Public\Videos\The Young and the Restless_20140904_11001200.ts" -vf yadif=0:-1:1,hqdn3d,scale=1280:720 -vcodec libx264 -preset slow -crf 18 -x264opts level=4.0 -r 29.97002997002997 -acodec copy "D:\MCEBuddyTemp\working0\The Young and the Restless_20140904_11001200-converted.mkv"
INFORMATION> 2014-09-08T11:46:44 MCEBuddy.Transcode.ConvertWithFfmpeg --> Converting the video - Main conversion
2014-09-08T11:46:44 MCEBuddy.AppWrapper.FFmpeg --> Launching process C:\Program Files\MCEBuddy2x\ffmpeg\ffmpeg.exe
2014-09-08T11:46:44 MCEBuddy.AppWrapper.FFmpeg --> Process arguments -probesize 100M -analyzeduration 300M -threads 0 -y -i "C:\Users\Public\Videos\The Young and the Restless_20140904_11001200.ts" -vf yadif=0:-1:1,hqdn3d,scale=1280:720 -vcodec libx264 -preset slow -crf 18 -x264opts level=4.0:threads=auto -r 29.97002997002997 -acodec copy "D:\MCEBuddyTemp\working0\The Young and the Restless_20140904_11001200-converted.mkv"
2014-09-08T11:46:44 MCEBuddy.AppWrapper.FFmpeg --> UI Session Admin Process : True
2014-09-08T11:46:44 MCEBuddy.AppWrapper.FFmpeg --> Starting process as a UISession process with Admin privileges. This requires atleast 1 user to be logged into the system (remote desktop or locally)
2014-09-08T11:46:44 MCEBuddy.AppWrapper.FFmpeg --> Setting process priority to Normal
2014-09-08T11:46:44 MCEBuddy.AppWrapper.FFmpeg --> ffmpeg version N-65975-g9b8eedd Copyright (c) 2000-2014 the FFmpeg developers
2014-09-08T11:46:44 MCEBuddy.AppWrapper.FFmpeg --> built on Aug 29 2014 15:02:16 with gcc 4.8.0 (GCC)
2014-09-08T11:46:44 MCEBuddy.AppWrapper.FFmpeg --> configuration: --arch=x86_64 --target-os=mingw32 --cross-prefix=/home/mcebuddy/Software/ffmpeg/sandbox/mingw-w64-x86_64/bin/x86_64-w64-mingw32- --pkg-config=pkg-config --enable-hwaccels --enable-dxva2 --enable-gpl --enable-libx264 --enable-avisynth --enable-libxvid --enable-libmp3lame --enable-version3 --enable-zlib --enable-librtmp --enable-libvorbis --enable-libtheora --enable-libspeex --enable-libopenjpeg --enable-gnutls --enable-libgsm --enable-libfreetype --enable-libopus --disable-w32threads --enable-frei0r --enable-filter=frei0r --enable-libvo-aacenc --enable-bzlib --enable-libxavs --extra-cflags=-DPTW32_STATIC_LIB --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-libschroedinger --enable-libvpx --enable-libilbc --prefix=/home/mcebuddy/Software/ffmpeg/sandbox/mingw-w64-x86_64/x86_64-w64-mingw32 --enable-static --disable-shared --enable-libsoxr --enable-fontconfig --enable-libass --enable-libutvideo --enable-libbluray --enable-iconv --enable-libtwolame --extra-cflags=-DLIBTWOLAME_STATIC --enable-libzvbi --enable-libcaca --enable-libmodplug --extra-libs=-lstdc++ --extra-libs=-lpng --enable-libvidstab --extra-cflags= --extra-cflags= --enable-nonfree --enable-libfdk-aac --enable-libfaac --enable-runtime-cpudetect

Sep 8, 2014 at 8:32 PM
Please don't paste sections of logs, they have no meaning until one sees all the settings and the context.

Going back to the log you had uploaded earlier, the same thing applies. MCEBuddy is behaving exactly like it's supposed to. If you want ffmpeg to preserve your audio tracks, then change the ffmpeg-audio section from -acodec ac3 to -acodec copy.

Also don't mix up commands, all audio parameters should come in ffmpeg-audio and video in ffmpeg-video (assuming you're using ffmpeg).

In the log you uploaded mcebuddy is using -map 0:a -map 0:0 which represents all audio tracks (0:a) and the video track (0:0).

I see you've done in your excerpt above but without seeing the whole log file (at debug level) I can't tell what else changed. This would work fine in your previous log file settings.


Sep 10, 2014 at 3:11 PM
First, thanks for your help and for an amazing piece of software. I recommend MCEBuddy to everyone!

So, I got the copy working just fine and I now get both audio tracks copied, however, what I REALLY want to do is have an AC3 6 channel audio stream and an AAC 2 channel audio stream. I've figured out the correct parameters to include in my profile.conf file, but MCEBuddy always either includes an -ac 2 or -ac 6 depending on whether multi-channel option is set. This overrides my specific settings for each stream. Is there any way to NOT have MCEBuddy include the generic channel specifier.

This are my audio parameters:
-c:a:0 ac3 -b:a:0 384k -ac:a:0 6 -c:a:1 libfdk_aac -b:a:1 192k -cutoff 18000 -ac:a:1 2 -map 0:a

which seems to work except I also get an -ac 6 or -ac 2 tacked on.

Thanks again.

Sep 10, 2014 at 4:40 PM
With today's build there will be 2 new parameters you can define in your profile:

<encoder>-AudioOptimized=true (v2.4.1+)

This parameter is set for each encoder type, e.g. ffmpeg, mencoder or handbrake
When set this tells MCEBuddy that the audio parameters profile (<encoder>-audio) has been optimized and fixed and that MCEBuddy should not change any parameters within that section of the profile. This means MCEBuddy will not adjust any audio parameters like DRC, audio language selection, volume adjustment, channel selection etc.

<encoder>-VideoOptimized=true (v2.4.1+)

This parameter is set for each encoder type, e.g. ffmpeg, mencoder or handbrake
When set this tells MCEBuddy that the video parameters profile (<encoder>-video) has been optimized and fixed and that MCEBuddy should not change any parameters within that section of the profile. This means MCEBuddy will not adjust any audio parameters like cropping, scaling, bitrate, interlacing etc.


In your case you should use ffmpeg-AudioOptimized=true since you're using a fixed audio profile.

This will work starting with today's 2.4.1 build

Marked as answer by rboy1 on 9/11/2014 at 8:49 AM
Sep 10, 2014 at 4:43 PM
Truly awesome! Thanks so much.



Nov 20, 2014 at 3:33 AM
Edited Nov 20, 2014 at 3:35 AM
I would like to do the same with handbrake.

I want a 6-ch AC3 audio stream AND a 2-ch AAC audio stream in my MP4 converted files. The source file is wtv file with a 6-ch AC3 stream.

I see the above setting for FFMPEG, anyone know how to do the same with Handbrake and Mencoder?
Nov 20, 2014 at 4:14 AM
The examples above is for handbrake, also see this thread:

https://mcebuddy2x.codeplex.com/discussions/546267
Nov 21, 2014 at 1:32 AM
Edited Nov 21, 2014 at 1:37 AM
Oh okay. Sorry I don't have much experience with the command line, I normally just use the Handbrake GUI.

I changed the order to ffmpeg first and changed the ffmpeg audio line to:
ffmpeg-audioac3=-c:a:0 ac3 -b:a:0 384k -ac:a:0 6 -c:a:1 libfdk_aac -b:a:1 192k -cutoff 18000 -ac:a:1 2 -map 0:a
as well as adding the line
ffmpeg-AudioOptimized=true
and I got a 6-ch AC-3 stream of main surround audio and a 2-ch AC-3 stream of the audio with commentary (for the blind?). I wanted a 2-ch AAC stream (not AC-3 and of the main audio, not the secondary audio). I would still like to know how to do this in ffmpeg just in case it falls back from handbrake.

I do prefer to use Handbrake. So I'll change Handbrake back to first priority. And change the handbrake line to:
handbrake-audioac3=-E faac,copy:ac3
It sounds like that will take the default audio track (main surround track in the wtv file) and give me 2 streams. An AAC stream and a copy of the AC-3 stream. Which is what I want. Only question is will the AAC stream be 2-ch or 6-ch? Do I need to add a "-dpl2" line to down mix it?

I will test tonight! Thanks for the help!
Marked as answer by rboy1 on 11/20/2014 at 7:22 PM
Nov 22, 2014 at 3:43 PM
Edited Nov 22, 2014 at 3:52 PM
handbrake-audioac3=-E faac,copy:ac3

This worked except it was making the 2-ch AAC track as the default track. So I switched it to:

handbrake-audioac3=-E copy:ac3,faac

And now the 6-ch AC3 track is the default track.

However, even though i have 'eng' selected in the MCEBuddy GUI.
Image

But the output file has 'unknown' as the audio language.
Image

Next step, test the same for ffmpeg!
Nov 22, 2014 at 4:36 PM
Edited Nov 22, 2014 at 4:37 PM
the language only work is the audio tracks have language tags on them (see the log file to see if the language tracks have tags). These aren't necessarily the audio language but rather the tags assigned to them.

When MCEBuddy encodes tracks it doesn't assign tags to the tracks, however you can modify the profile to include your own language tags for each track :)
Nov 22, 2014 at 11:48 PM
Edited Nov 22, 2014 at 11:57 PM
rboy1 wrote:
the language only work is the audio tracks have language tags on them (see the log file to see if the language tracks have tags). These aren't necessarily the audio language but rather the tags assigned to them.

When MCEBuddy encodes tracks it doesn't assign tags to the tracks, however you can modify the profile to include your own language tags for each track :)
Yes, in the logs the source audio tracks do have 'eng' tags.

I've looked through the Handbrake help. I see -A which will set the audio track name, but nothing for setting a language tag in the output. How would I tag the audio tracks as 'eng'?
Nov 23, 2014 at 2:20 AM
https://trac.handbrake.fr/wiki/CLIGuide
-A, --aname <string> Audio track name(s), Separated by commas for more than one audio track.
The name is the language tag.
Nov 23, 2014 at 5:13 AM
Edited Nov 23, 2014 at 5:13 AM
'-A' changes the NAME of the Audio Track not the LANGUAGE.

I used this:
handbrake-audioac3=-A "English" -E copy:ac3,faac

And Got this: TEXT
Nov 23, 2014 at 9:13 PM
Post the link to the conversion log
Nov 25, 2014 at 12:20 AM
Edited Nov 25, 2014 at 3:51 AM
rboy1 wrote:
Post the link to the conversion log
Conversion log here: TEXT

It recognizes the audio stream is 'eng'. However when Handbrake goes to encode the "-A English" command changes the NAME of the stream to "English" but the decoder still says "Unknown":
Nov 25, 2014 at 2:01 AM
Edited Nov 25, 2014 at 3:55 AM
I downloaded yesterday's BETA and it worked on one file but not another.

I did change the Audio back to:
handbrake-audioac3=-E copy:ac3,faac

In both log files ffmpegMediaInfo recognizes the language as "eng".

In the 2014_09_22 log HandBrake.Conversion also sets the decoder to "eng". However in the 2014_10_07 log HandBrake sets the conversion to "unknown".

Log file here: TEXT
Nov 25, 2014 at 9:28 PM
I went through your logs, in none of your conversions the -A command is being used. See what's being executed, did you modify the correct profile?
2014-11-24T21:54:55 MCEBuddy.AppWrapper.Handbrake --> Launching process C:\Program Files\MCEBuddy2x\handbrake\handbrakecli.exe
2014-11-24T21:54:55 MCEBuddy.AppWrapper.Handbrake --> Process arguments -i "D:\Temp Conversion\working0\Forever_WLNEDT_2014_10_07_22_00_00.ts" --denoise="weak" --loose-anamorphic --verbose=2 -T -f mp4 -4 --start-at duration:1 -e qsv_h264 -b 3200 -x me=hex:trellis=4:subq=8:partitions=all:8x8dct:ref=6:keyint=25:keyint-min=20:bframes=4:weight-b:level-idc=40:b-pyramid=normal:direct-pred=auto:mixed-refs:deblock=-1,-1:nofast-pskip:nodct-decimate:b-adapt=2:threads=auto:la-depth=50 -E copy:ac3,faac -o "D:\Temp Conversion\working0\Forever_WLNEDT_2014_10_07_22_00_00-converted.mp4"
Nov 25, 2014 at 11:57 PM
rboy1 wrote:
I went through your logs, in none of your conversions the -A command is being used. See what's being executed, did you modify the correct profile?
Look at the post 2 up (the one at 7:20p). That one has the link to 3 logs for 'The Blacklist' (I also put in the picture showing the stream NAME being changed instead of the language). I just checked, and all 3 logs have "handbrake-audioac3=-A "English" -E copy:ac3,faac".

I removed the "-A English" in the post 1 up (the one at 9:01p). The one with 2 logs for "Forever".
I removed it because the "-A English" command changes the NAME of the audio stream not the LANGUAGE, which is messing everything up.

Check out the 3 "The Blacklist Logs" where "-A 'English'" is enabled, all the stream NAMES are "English" instead of "Stereo" and "Surround". Here is the link again: TEXT
Nov 26, 2014 at 12:39 AM
Check your logs in detail to get more insight into the process, in general look for an ERROR> - these are serious issues and should never exist. It isn't working because it never completes the encoding with handbrake, so here's what's happening:
1 . Your handbrake encoder hangs at the end, you're using an unstable version of a video driver. Try updating your video driver or uncheck hardware encoding to use software encoding
ERROR> 2014-11-23T21:17:45 MCEBuddy.AppWrapper.Handbrake --> Hardware encoding appears to have hung, no progress in the last 120 seconds.
This is likely due to an unstable Intel Display Driver. Try updating or using a stable Intel Display Driver.
Terminating process.
ERROR> --> Unrecoverable error encountered. Process likely hung, killing it
2 . It then falls back to ffmpeg encoder (as per the profile) but you've replaced the MCEBuddy build with your own / generic build. This doesn't have the Fraunhauffer AAC encoder (which MCEBuddy does a special build to support) so that fails:
2014-11-23T21:17:49 MCEBuddy.AppWrapper.FFmpeg --> [NULL @ 00000000050ed020] Unable to find a suitable output format for 'libfdk_aac'
2014-11-23T21:17:49 MCEBuddy.AppWrapper.FFmpeg --> libfdk_aac: Invalid argument
3 . Finally it falls back to mencoder and completes the conversion with mencoder.

Must say the fallback mechanisms work great but in your case it doesn't achieve your goal. I would suggest for now you set the order to handbrake only until you get this sorted out.
Nov 26, 2014 at 1:55 AM
Edited Nov 26, 2014 at 1:56 AM
Yeah, those were bad examples to use for the "A- 'English" fix. I'll find a different log that doesn't fail the handbrake conversion.

For the failed conversion, I tried to update the intel drivers to the ones you have on the webpage. But I have an i3-2100 and the current "up-to-date" ones are 9.something. The ones on your webpage are 10.something. I followed the instructions on your webpage but got the "Device driver is not recommended ..." error.
Nov 26, 2014 at 4:50 AM
Edited Nov 26, 2014 at 4:58 AM
Okay here: TEXT is a log file that successfully completed with HandBrake.

You can see that ffmpegmediainfo recognizes the 6 channel audio stream as 'eng'.
![Image](<iframe src="https://onedrive.live.com/embed?cid=CF40E047E855A57E&resid=CF40E047E855A57E%2114297&authkey=AI8jcR6qsgSr3q0" width="320" height="318" frameborder="0" scrolling="no"></iframe>)

However, handbrake shows 'Unknown'.
![Image](<iframe src="https://onedrive.live.com/embed?cid=CF40E047E855A57E&resid=CF40E047E855A57E%2114296&authkey=ANFWxIRmaIHOmo8" width="320" height="95" frameborder="0" scrolling="no"></iframe>)

All the '-A "English"' modifier does is change the stream NAME not the LANGUAGE.
![Image](<iframe src="http://1drv.ms/1HFieg0")

edit: BTW what am I doing wrong when trying to embed an image!?
Nov 26, 2014 at 7:12 AM
I see what you're trying. These are 2 different things:
  1. Is the track name, which you're setting using the Handbrake -A option
  2. Is the language identifier which is a MP4 format specific option. This can be set using AtomicParsley. You need to set the cprt atom using AtomicParsley (using custom commands) to set this identifier. See this page for details -> http://atomicparsley.sourceforge.net/ and https://github.com/beatgammit/atomicparsley/blob/master/src/main.cpp (line 461, search for language)
Nov 26, 2014 at 6:51 PM
Edited Dec 4, 2014 at 3:52 AM
Okay, I don't care at all about changing the track name, just the language.
Converted files:
Track 1 is h.264 video (language defaults to unknown)
Track 2 is ac3 6-ch audio (language defaults to unknown)
Track 3 is aac 2-ch audio (language defaults to unknown)
I would want tracks 1, 2 & 3 language to be set to "english".
So would this set the audio language to english?

CustomCommandPath="C:\Progra~1\MCEBuddy2x\atomicparsley\AtomicParsley.exe"
CustomCommandParameters=""%convertedfile%" --overWrite --3gp-language \"eng\" \"track\""
CustomCommandHangPeriod=20
CustomCommandCritical=false

Sorry, I have no familiarity with Atomicparsley

edit: forgot the end quote on the second line.
Nov 26, 2014 at 11:46 PM
I haven't used this function with AtomicParsley but you can try it out. Also check out the forum on how to use CustomCommands, specially how you use the quotes. I don't think you should escape the quotes.
Dec 4, 2014 at 3:52 AM
It didn't work. The logs say it is an "unrecognized command".

Tried posting on AVS and the Atomicparsley forums. No luck :-(

There has got to be a way to automatically change the language of all the video and audio tracks from "Unknown" to "English"!
Jan 17, 2015 at 2:05 AM
Wilky13 wrote:
It didn't work. The logs say it is an "unrecognized command".

Tried posting on AVS and the Atomicparsley forums. No luck :-(

There has got to be a way to automatically change the language of all the video and audio tracks from "Unknown" to "English"!
Anyone figure out how to get the output Video and Audio on the MP4 profile to set 'English' vice 'unknown' in the language?