logo Sign In

Info: Getting 5.1 and stereo mixes from video file with each channel as separate audio file.

Author
Time
 (Edited)

So, I have these .MOV files, which have audio stored in them as 8 separate PCM mono files, where the first six are the channels of the 5.1 audio mix and the last two are the channels of the stereo mix - is there a way to use FFMpeg or AEC3TO or some such with a script to make AAC 5.1 and AAC 2.0 audio mixes from those files?

Ideally, I’d like to have a .bat file, where I would change the input file name to moviexy.mov and when I run it, it spits out moviexy5.1mix.aac and moviexy2.0mix.ac3.

I know that the order of the channels in the files is as follows:

  1. Front Left
  2. Front Right
  3. Front Center
  4. LFE
  5. Rear Left
  6. Rear Right
  7. Stereo Left
  8. Stereo Right

So far, I figured out, I could pull each file into Premiere and map the channels there, but it seems like an unnecessarily time-consuming manual process, because I have quite a few of those files, so I’d really like to find a batch solution.

Author
Time

I don’t really use ffmpeg much, so I can’t really comment on that, but eac3to can’t work with individual wav channels and output an aac file. You would have to merge the wav files to a six channel wav and a separate stereo wav somehow first.

You could try using the program AudioMuxer, it has some tools that might work.

If it were me, I would use some combination of wavewizard to merge the files and eac3to to do the conversion. It’s not automated but it doesn’t take that much effort. Watch out with wavewizard though, as it tends to write the riff headers incorrectly for multichannel wav files. I don’t think that will really matter when using eac3to, for what it’s worth.

Also, look for a GUI for eac3to called Useac3to, I find it makes re-encoding much less tedious than typing in the command lines for everything you want to do.

If I had some gum, I’d chew a hole into the sun…

Author
Time

Well, that’s the thing - I’m looking for a batch file where I’ll just change the file name and it will do it all for me - any other solution will not be less complicated than using Premiere to do it.

Author
Time

Here are a few options. Save the pastebin text as a batch file (*.bat) in your ffmpeg folder. You can paste a shortcut to the bat file anywhere else you may want to have it, and it should work fine.

I can’t vouch for the aac conversion quality of FFMPEG, so you may want to convert to Wav, then use eac3to to convert to aac.

For converting 8 mono channels within a container file to a 5.1 AAC and a 2.0 AAC:

http://pastebin.com/1TFRjeuW

For converting 8 mono channels within a container file to a new container with original video, a 5.1 AAC, and a 2.0 AAC:

http://pastebin.com/bCmpzYJ1

For converting 8 mono channels within a container file to a 5.1 16 Bit WAV and a Stereo 16 Bit WAV:

http://pastebin.com/bM3QPaCP

For converting 8 mono channels within a container file to a 5.1 24 Bit WAV and a Stereo 24 Bit WAV:

http://pastebin.com/vRRhtGkv

If I had some gum, I’d chew a hole into the sun…

Author
Time
 (Edited)

Amazing! Thanks! I’m just not sure how to work with these %% thingies exactly (yeah, I’m that much of a noob when it comes to these things). Could you maybe fill in one of these scripts, assuming that the file I want is called “movie.mov” and it’s in say “D:\Source” and I want my output files to be in “E:\Output”, so that I can see how to use these?
Thanks a lot! I really appreciate the help!
I’m actually probably gonna use the WAV option - I didn’t even know WAV could be 5.1.

Author
Time
 (Edited)

You actually don’t need to type anything into the file itself. Just save the text as is, as a .bat file. You just have to drag the file you want to convert and drop it on the .bat file. It will output your new files into the same directory as the original file.

Edit:
I’ve updated all of the files at the previous links above. They should work better, as they will let you drag and drop multiple files onto the batch file, and will create a new directory called “AAC” at the path of the original files.

Let me know if you can get this working.

If I had some gum, I’d chew a hole into the sun…

Author
Time
 (Edited)

Well, I don’t get it - when I run it I get:

‘ffmpeg’ is not recognized as an internal or external command,
operable program or batch file.
Press any key to continue . . .

Yet, in the very same directory, I have a batchfile using ffmpeg, which runs perfectly fine. I tested this on two different computers and get the exact same error on both.

Author
Time
 (Edited)

Which batch file did you try? Did you try the updated versions that I posted, or the originals? What version of Windows are you using?

I’ll double check everything on my end and send you a folder that should work.

I have updated the pastebin links again. I didn’t take into account that you may be working on different disk drives. They should work now, hopefully 😉

If I had some gum, I’d chew a hole into the sun…

Author
Time

Well, this time I got this:

A subdirectory or file AAC already exists.
ffmpeg version N-74427-gaffbecb Copyright © 2000-2015 the FFmpeg developers
built with gcc 4.9.3 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca –
enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-l
ibilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enab
le-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --en
able-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --ena
ble-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc
–enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enabl
e-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-lzma --ena
ble-decklink --enable-zlib
libavutil 54. 30.100 / 54. 30.100
libavcodec 56. 57.100 / 56. 57.100
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 33.100 / 5. 33.100
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.101 / 1. 2.101
libpostproc 53. 3.100 / 53. 3.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0000000004779140] Found duplicated MOOV Atom. Skipped
it
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from ‘H:\ToddOliver_1080p_178_16x9_2398_en8CH
_source_V1_PRO.mov’:
Metadata:
major_brand : qt
minor_version : 537199360
compatible_brands: qt
creation_time : 2013-08-08 19:09:55
Duration: 00:58:41.64, start: 0.000000, bitrate: 181375 kb/s
Stream #0:0(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels
(FL), s32 (24 bit), 1152 kb/s (default)
Metadata:
creation_time : 2013-08-08 19:09:57
handler_name : Apple Alias Data Handler
Stream #0:1(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels
(FR), s32 (24 bit), 1152 kb/s (default)
Metadata:
creation_time : 2013-08-08 19:09:57
handler_name : Apple Alias Data Handler
Stream #0:2(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, mono, s32
(24 bit), 1152 kb/s (default)
Metadata:
creation_time : 2013-08-08 19:09:57
handler_name : Apple Alias Data Handler
Stream #0:3(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels
(LFE), s32 (24 bit), 1152 kb/s (default)
Metadata:
creation_time : 2013-08-08 19:09:57
handler_name : Apple Alias Data Handler
Stream #0:4(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels
(BL), s32 (24 bit), 1152 kb/s (default)
Metadata:
creation_time : 2013-08-08 19:09:57
handler_name : Apple Alias Data Handler
Stream #0:5(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels
(BR), s32 (24 bit), 1152 kb/s (default)
Metadata:
creation_time : 2013-08-08 19:09:57
handler_name : Apple Alias Data Handler
Stream #0:6(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels
(DL), s32 (24 bit), 1152 kb/s (default)
Metadata:
creation_time : 2013-08-08 19:09:57
handler_name : Apple Alias Data Handler
Stream #0:7(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels
(DR), s32 (24 bit), 1152 kb/s (default)
Metadata:
creation_time : 2013-08-08 19:09:57
handler_name : Apple Alias Data Handler
Stream #0:8(eng): Video: prores (apch / 0x68637061), yuv422p10le(bt709), 192
0x1080, 172105 kb/s, SAR 1:1 DAR 16:9, 23.98 fps, 23.98 tbr, 24k tbn, 24k tbc (d
efault)
Metadata:
creation_time : 2014-01-17 01:21:45
handler_name : Apple Alias Data Handler
encoder : Apple ProRes 422 (HQ)
Stream specifier ‘:8’ in filtergraph description [0:7][0:8] amerge=inputs=2[20mi
x] matches no streams.
Press any key to continue . . .

Author
Time

FFMPEG’s internal AAC encoder is I think vastly improved by now.

Eac3to doesn’t have any internal AAC encoders so it has to use external ones.

Author
Time

So, with fresh eyes now, what I see in there is that the first audio track is 0:0 and 0:8 is the video track, so I guess what I need to do is change the script so that 0:1 is now 0:0, 0:2 is 0:1 and so forth, right?

Author
Time
 (Edited)

Ah, yes, I didn’t realize that your MOV files had the video track last.This should fix that. I’ll update all of the scripts.

@ECHO OFF
TITLE “Output 5.1 and Stereo AAC”
if [%1]==[] goto :eof
set Destination=%~d1%~p1
cd /d %Destination%
md AAC
cd /d “%~dp0”
:loop
ffmpeg -i “%~1” -filter_complex “[0:0][0:1][0:2][0:3][0:4][0:5] amerge=inputs=6[51mix]” -c:a aac -filter_complex “[0:6][0:7] amerge=inputs=2[20mix]” -c:a aac -map [51mix] “%Destination%\AAC%~n1”_5.1mix.aac -map [20mix] “%Destination%\AAC%~n1”_2.0mix.aac
shift
if not [%1]==[] goto loop

If I had some gum, I’d chew a hole into the sun…

Author
Time

Nice! Glad to help 😃

If I had some gum, I’d chew a hole into the sun…