View Full Version : How to save audio from MKV clip to MP3?
Frankenscript
28th December 2013, 19:17
Hi folks,
Sorry if this belongs in one of the subforums... wasn't sure which to use since this touches several areas.
I have an MKV video clip, that I'd like to extract the DTS or AC3 audio from, and save as an MP3 for eventual use as a phone ringtone.
I don't seem to have the right utility to do the job, but figure it's a basic task lots of others here have done. Can you please recommend which tool to use?
I started with a TV episode (45 minutes in MKV format) and used MKVMerge to split out the 25 seconds or so I wanted. So, the result is a 25 second MKV file, with the audio track, and either with or without the video track depending on what I select to keep in MKVmerge. But, I have not found a utility that will import the MKV (audio or audio/video) and export an MP3. Tried Handbrake, Vidcoder, Videopad. All of them are designed to work with video, and barf if I want to work with just audio.
I'd appreciate any help. Thanks!
Marc
Guest
28th December 2013, 19:51
I started with a TV episode (45 minutes in MKV format) Where did you get that MKV file?
Frankenscript
28th December 2013, 19:58
It was ripped from a Bluray that I own by MakeMKV. It's got H264 video and in this case DTS audio. However, sometimes I might be interested in doing the same thing with AC3 (DD) audio or on MKVs from DVD that are Mpeg2 video.
I'm sure there's a simple utility that will take a plain audio track and save as MP3, I just haven't yet found it! :o
Guest
28th December 2013, 20:02
Demux the audio ES from the MKV (e.g., with DGDecNV) and then transcode as needed (e.g., with BeSweet).
Frankenscript
28th December 2013, 20:04
OK, thanks for the help. I'll investigate the process you posted and report back, hopefully with success, so others with the same issue can easily find the answer. I appreciate your help!
Marc
Guest
28th December 2013, 20:07
You can also demux the ES with mkvextract as well.
Frankenscript
28th December 2013, 20:49
STill working on it. I've got the demuxed audio, but since it's .DTS, BeSweet won't work on it. I'll poke around for a more up to date transcoder.
Guest
28th December 2013, 20:52
One option for you:
eac3to foo.dts foo.ac3
Frankenscript
28th December 2013, 21:28
Thanks neuron2! I greatly appreciate your continued help.
Turns out the easy way to do it once I had the .dts demuxed stream was to use Wavepad's free trial. I was able to input the .dts file and save as an .mp3 with no problems.
I did poke around a bit with besweet but found the format of the inputs and switches and stuff more trouble than I wanted to spend too much time on.
I've now got my .mp3 ready for transfer to my phone.
For anyone that later reads this, here's the final process I used:
1. Starting with an MKV, I extracted just the segment I wanted using MakeMKV's splitting feature, and including just the audio track.
2. Demuxed to a .dts file using MKVExtractGUI
3. Opened the .dts file in WavePAd (had to tell it to show all files first), then saved as .mp3
Done!
Marc
foxyshadis
4th January 2014, 02:54
FWIW, Audacity (http://audacity.sourceforge.net) with the FFMpeg import/export library (http://lame1.buanzo.com.ar/#lamewindl) can read dts files. That way you're not stuck once the free trial runs out.
Reino
5th January 2014, 14:15
If you decide to use ffmpeg or AviSynth, extraction is not necessarily needed.
I've used a 90min. MKV[H.264+DTS(x3)] file for testing from which I want to extract a 1m:48s section from the 3rd audiostrack starting at 44m:33s.
ffmpeg
ffmpeg.exe -ss 00:44:00 -i "video.mkv" -ss 00:00:33 -t 00:01:48 -map 0:3
-af "aresample=matrix_encoding=dplii" -ac 2 -c:a libmp3lame -q:a 6 "audio_segment.mp3"
-ss 00:44:00 - Seek fast to 44m.
-ss 00:00:33 - Seek accurate to the remaining 33s.
-t 00:01:48 - Stop extraction after 1m:48s.
-map 0:3 - Designate audiotrack 3 as source. We're not interested in the rest.
-af "aresample=matrix_encoding=dplii" -ac 2 - Downmix 5.1 to stereo (Dolby Pro-logic 2). Assuming the source is 5.1, otherwise you can omit this part.
-c:a libmp3lame -q:a 6 - Encode to mp3 at V6 (~115kbit/s)
AviSynth
FFAudioSource("video.mkv", track=3)
#flr = GetChannel(1, 2)
#fcc = GetChannel(3, 3)
#lrc = MixAudio(flr, fcc, 0.3254, 0.2301)
#bl = GetChannel(5)
#br = GetChannel(6)
#sl = MixAudio(bl, br, 0.2818, 0.1627)
#sr = MixAudio(bl, br, -0.1627, -0.2818)
#blr = MergeChannels(sl, sr)
# = MixAudio(lrc, blr, 1.0, 1.0)
AudioTrim(2673,2781)
and to encode the audio it produces:
avs2pipemod.exe -wav "avisynth-script.avs" | lame.exe -V 6 - "audio_segment.mp3"
or
ffmpeg.exe -i "avisynth-script.avs" -c:a libmp3lame -q:a 6 "audio_segment.mp3"I don't know why, but in both cases (mkv as well as avs as input) ffmpeg produced a 1m:48.024s mp3. Luckily with avs2pipemod it's the expected 1m:48.000s.
SeeMoreDigital
5th January 2014, 17:08
I suggest you use LameXP (http://forum.doom9.org/showthread.php?t=157726) to re-encode your DTS file to MP3...
Frankenscript
12th January 2014, 18:04
Great additional details. Thanks guys.
Frankenscript
6th February 2014, 12:34
so what method worked? I hope you can share your experience so we can learn from it.
Post #9 showed how I succeeded the first time. Since then, using the helpful input of the forum denizens here, I've found it is simpler just to open the MKV in Audacity, trim it to size, and save the file out in the format I need.
As a side note, all of this was to prep a file as ringtone for my new work iPhone (coming from a blackberry). My personal phone is an Android, and I use clips all the time as MP3 files. MP3 worked in the BB too. But little did I know that the much vaunted media device, the iPhone, can't use MP3s as ringtones. I had to convert them over to m4r and do all sorts of gymnastics in iTunes. On my Android, I just mailed the file to myself, saved it in the ringtones folder, and was done. This situation reminded me why I prefer Android...
I hope this thread helps others!
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.