Skip to main content

Topic: Extracting Soundtrack From Movie? (Read 11384 times) previous topic - next topic

0 Members and 1 Guest are viewing this topic.
Extracting Soundtrack From Movie?
I'm trying to figure out a way to extract audio from the two front speakers from a movie as an MKV file that I have. The audio is in 5.1 surround. I am completely new to this and would like a detailed how to process. Thank you

  • saratoga
  • [*][*][*][*][*]
Extracting Soundtrack From Movie?
Reply #1
This looks like what you want:

http://www.videohelp.com/tools/MKVExtractGUI

  • gib
  • [*][*][*]
Extracting Soundtrack From Movie?
Reply #2
Since you specifically want to extract the two front channels, I'd suggest you use eac3to.  It's a command-line program and very powerful.  With it you could very easily extract and downmix the 5.1 audio to stereo and output it to, say, flac.  Or if you truly want just the front channels and not a downmix, you could take the 5.1 track, output each channel as a separate flac, then use any audio editor to create a stereo track from the two front channels. 

Extracting Soundtrack From Movie?
Reply #3
So I have the ac3 file of the audio on the DVD (all 5 channels). When I go into EAC3to, I open it in the source file section, and nothing is grayed out except "PCM and TrueHD Options", "DTS Rate", "Channel Order Mode", and everything under "Set Custom Channel Order". Also, I just realized that the soundtrack also plays through the surround L & R channels. Sorry if I'm a little gray with the details, this is the first time I've attempted something like this.

  • CoRoNe
  • [*][*][*]
Extracting Soundtrack From Movie?
Reply #4
If you'd ask me, I would use Avisynth, FFmpegSource and avs2pipemod. This way you don't even have to extract the soundtrack from the MKV-container.

Open Notepad and enter:
Code: [Select]
FFMpegSource2("<path>\movie.mkv", atrack=-1)
GetChannel(1,2)
Save as "movie_soundtrack.avs".
=====================================
In case your movie has multilingual soundtracks and let's say it's the 2nd audiotracks you want. And in case conversations are only on the center-channel, you could go for this:
Code: [Select]
FFMpegSource2("<path>\movie.mkv", atrack=2)
flr = GetChannel(1, 2)
fcc = GetChannel(3, 3)
MixAudio(flr, fcc, 0.5858, 0.4142)
=====================================

Make sure you've downloaded your desired audio-encoder. Open a command-prompt (cmd.exe) and enter:
Code: [Select]
"<path>\avs2pipemod.exe" -wav "<path>\movie_soundtrack.avs" > "<path>\movie_soundtrack.wav"
or
"<path>\avs2pipemod.exe" -wav "<path>\movie_soundtrack.avs" | "<path>\oggenc2.exe" -q0 - -o "<path>\movie_soundtrack.ogg"
or
"<path>\avs2pipemod.exe" -wav "<path>\movie_soundtrack.avs" | "<path>\opusenc.exe" --bitrate 64 - "<path>\movie_soundtrack.opus"
etc.
DC-Bass Source Mod: http://reino.degeelebosch.nl

  • o-l-a-v
  • [*][*][*]
Extracting Soundtrack From Movie?
Reply #5
Use "TAudioConverter".
Drag the film into the program. Choose "Extract Audio".

Extracting Soundtrack From Movie?
Reply #6
CoRoNe:

I was able to create the movie_soundtrack.WAV file with the first piece of code you gave me to feed into the cmd prompt. BUT the wav file is empty. It's 0 bytes and doesn't play.
  • Last Edit: 27 May, 2013, 07:21:00 AM by db1989

Extracting Soundtrack From Movie?
Reply #7
Since you specifically want to extract the two front channels, I'd suggest you use eac3to.  It's a command-line program and very powerful.  With it you could very easily extract and downmix the 5.1 audio to stereo and output it to, say, flac.  Or if you truly want just the front channels and not a downmix, you could take the 5.1 track, output each channel as a separate flac, then use any audio editor to create a stereo track from the two front channels.

What options would I use to extract the 2 front channel flacs?

  • CoRoNe
  • [*][*][*]
Extracting Soundtrack From Movie?
Reply #8
All I can say is: Make sure you've entered all the correct <path>'s and check whether your avs-file plays correctly in MPC-HC (or any other DirectShow player). It then has to work.
DC-Bass Source Mod: http://reino.degeelebosch.nl

Extracting Soundtrack From Movie?
Reply #9
All I can say is: Make sure you've entered all the correct <path>'s and check whether your avs-file plays correctly in MPC-HC (or any other DirectShow player). It then has to work.

That must have been the problem then. But it's now saying that it failed to load avisynth.dll ...

Extracting Soundtrack From Movie?
Reply #10
All I can say is: Make sure you've entered all the correct <path>'s and check whether your avs-file plays correctly in MPC-HC (or any other DirectShow player). It then has to work.

I fixed the dll error. But I'm having one that says there is no function named FFMpegSource2.

  • Kohlrabi
  • [*][*][*][*][*]
  • Global Moderator
Extracting Soundtrack From Movie?
Reply #11
Is there a specific reason why you ignore the simple and straightforward solution presented by saratoga and instead go for the (obviously) complicated multi-tool and multi-step solution by CoRoNe? FWIW, you could also check out the newer version of MKVextractGUI.
  • Last Edit: 28 May, 2013, 03:37:22 AM by Kohlrabi
It's only audiophile if it's inconvenient.

Extracting Soundtrack From Movie?
Reply #12
Is there a specific reason why you ignore the simple and straightforward solution presented by saratoga and instead go for the (obviously) complicated multi-tool and multi-step solution by CoRoNe? FWIW, you could also check out the newer version of MKVextractGUI.

I keep getting an error when I open MVExtract that says
"Put me in mkvtoolnix dr, please! In case if you don't have it - just press 'OK' to get it from www.bunkus.org/videotools/mkvtoolnix/win32/"
I'm not sure how to fix this error, as the download files presented at this website are MKVMergeGUIs and I cannot put MKVExtract into MKVMerge...

  • CoRoNe
  • [*][*][*]
Extracting Soundtrack From Movie?
Reply #13
simple and straightforward solution presented by saratoga...[/url].
Solution to what? Not his question at least.

Dr. Horrible, just in case; for FFmpegSource you have to download either ffms-2.17.7z or ffms2-2.18-rc1.7z . Then you have to extract the content to your Avisynth-plugins directory. Then try again.
DC-Bass Source Mod: http://reino.degeelebosch.nl

  • gib
  • [*][*][*]
Extracting Soundtrack From Movie?
Reply #14
What options would I use to extract the 2 front channel flacs?

Haven't been on the last couple days.  Sorry.  Anyway, it sounds like you're using a GUI for eac3to.  I don't, so I couldn't tell you what to do in one.  But here's what you'd do at the command line in two easy steps:

Step 1:  Let's analyze the file (you said it was an .mkv): 

eac3to [filename].mkv

After the brief analysis, eac3to will output a list of the contents of the file.  It will look something like this:
Code: [Select]
MKV, 1 video track, 1 audio track, 1 subtitle track, 0:25:29, 24p /1.001
1: h264/AVC, English, 1488x1080 24p /1.001
2: AC3, 5.1 channels, 640kbps, 48kHz
3: Subtitle (SRT), English

We can see the video is track 1, the audio is track 2, and the subtitles are track 3.  I will use track 2 in my examples, but substitute whatever number is the audio track for your file.

Step 2:  Now that we know what track to work with, let's decode the ac3 track and output it as individual .wav files per channel: 

eac3to [filename].mkv 2: blah.wavs

With this command we're telling eac3to to work with track 2, decode and output the audio to multiple .wav files named blah (eac3to will add the channel to the name automatically).  It will look something like this:
Code: [Select]
MKV, 1 video track, 1 audio track, 1 subtitle track, 0:25:29, 24p /1.001
1: h264/AVC, English, 1488x1080 24p /1.001
2: AC3, 5.1 channels, 640kbps, 48kHz
3: Subtitle (SRT), English
a02 Writing WAVs...
a02 Creating file "blah.C.wav"...
a02 Creating file "blah.L.wav"...
a02 Creating file "blah.R.wav"...
a02 Creating file "blah.SR.wav"...
a02 Creating file "blah.LFE.wav"...
a02 Creating file "blah.SL.wav"...
Video track 1 contains 36656 frames.
eac3to processing took 35 seconds.
Done.

And that's it, you're done.  Now you can discard the channels you don't need (LFE, SR, SL) and do whatever you want with the L and R channels.  Just in case this doesn't suit you and what you really want is a downmix of the 5.1 audio, use this command:

eac3to [filename].mkv 2: blah.flac -down2 -mixlfe

This will downmix the multichannel audio, including the LFE, to stereo and output a neat and tidy flac. 

Hope this helps.

  • gib
  • [*][*][*]
Extracting Soundtrack From Movie?
Reply #15
Is there a specific reason why you ignore the simple and straightforward solution presented by saratoga...

For what it's worth, I don't think MKVExtractGUI will really do what the OP wants.  It looks like it's just a GUI interface for MKVToolnix and doesn't offer any decoding/transcoding functionality from what I can tell (didn't look too close, so I could be wrong). 

As an aside, MKVToolnix has it's own GUI anyway (mmg.exe).

Extracting Soundtrack From Movie?
Reply #16
What options would I use to extract the 2 front channel flacs?

Haven't been on the last couple days.  Sorry.  Anyway, it sounds like you're using a GUI for eac3to.  I don't, so I couldn't tell you what to do in one.  But here's what you'd do at the command line in two easy steps:

Step 1:  Let's analyze the file (you said it was an .mkv): 

eac3to [filename].mkv

After the brief analysis, eac3to will output a list of the contents of the file.  It will look something like this:
Code: [Select]
MKV, 1 video track, 1 audio track, 1 subtitle track, 0:25:29, 24p /1.001
1: h264/AVC, English, 1488x1080 24p /1.001
2: AC3, 5.1 channels, 640kbps, 48kHz
3: Subtitle (SRT), English

We can see the video is track 1, the audio is track 2, and the subtitles are track 3.  I will use track 2 in my examples, but substitute whatever number is the audio track for your file.

Step 2:  Now that we know what track to work with, let's decode the ac3 track and output it as individual .wav files per channel: 

eac3to [filename].mkv 2: blah.wavs

With this command we're telling eac3to to work with track 2, decode and output the audio to multiple .wav files named blah (eac3to will add the channel to the name automatically).  It will look something like this:
Code: [Select]
MKV, 1 video track, 1 audio track, 1 subtitle track, 0:25:29, 24p /1.001
1: h264/AVC, English, 1488x1080 24p /1.001
2: AC3, 5.1 channels, 640kbps, 48kHz
3: Subtitle (SRT), English
a02 Writing WAVs...
a02 Creating file "blah.C.wav"...
a02 Creating file "blah.L.wav"...
a02 Creating file "blah.R.wav"...
a02 Creating file "blah.SR.wav"...
a02 Creating file "blah.LFE.wav"...
a02 Creating file "blah.SL.wav"...
Video track 1 contains 36656 frames.
eac3to processing took 35 seconds.
Done.

And that's it, you're done.  Now you can discard the channels you don't need (LFE, SR, SL) and do whatever you want with the L and R channels.  Just in case this doesn't suit you and what you really want is a downmix of the 5.1 audio, use this command:

eac3to [filename].mkv 2: blah.flac -down2 -mixlfe

This will downmix the multichannel audio, including the LFE, to stereo and output a neat and tidy flac. 

Hope this helps.

thank you so much! It worked perfectly. I can't thank you enough!

  • gib
  • [*][*][*]
Extracting Soundtrack From Movie?
Reply #17
No problem.  Glad I could help.