[Rx] Lossless Ripping of Audio from MP4


I have some video files in MP4 format. I want rip out the audio (.M4a) without re-encoding. This method uses a command line program and a batch file, but YOU CAN DO IT!

How to Rip M4a Audio from MP4

1. Install FFmpeg (Windows version).


According to the website, “FFmpeg is the leading multimedia framework, able to decode, encode,
, mux, demux, stream, filter and play pretty much anything
that humans and machines have created.”

Notice that they never claim that it would be easy to do all this stuff. 

2. Dump Executables into Directory (optional)

If you want to run a program everywhere, you need to set up an environmental variable. I’m on Windows 7 and it’s sort of a pain. So, I created a directory on my main drive called “C:\OpenPaths” where I dump all my command line programs. FFmpeg has a couple of files the bin directory that I copied over: FFmpeg.exe and FFprobe.exe.


3. Convert Single File

Just to make things clean and easy, I set up some directories.


The main directory is 24_DEVELOPRx with a MP4 VIDEO sub-folder. In the sub-folder, I put a 551MB MP4 video. This is how to rip out the audio from MP4.

Double-Click and go into the folder MP4 VIDEO. I have a file called HugeVideo.mp4. If you’re following along, find your own MP4 and use your filename accordingly.

In any open space in the MS-Explorer window, [shift+right click] and select Open command window here in the drop-down menu.


Enter this on the command line:

C:\OpenPaths\ffmpeg.exe -i HugeVideo.mp4 -c:a copy -vn -sn HugeVideo.m4a

C:\OpenPaths\ is where you have your ffmpeg.exe on you computer.

After pressing enter on the command line, the ripping will happen very quickly in the terminal window and you should end with something that looks like:


In the MP4 directory, you’ll have a new, much smaller .m4a file.


Nifty, no?

4. Convert Whole Directory

If you’ve already created your version of the HugeVideo.m4a file and want to see how to convert a whole folder, delete the .m4a file.


First, we need to create the FolderMP4toM4A.bat file. All you need to do is to copy the text below into a notepad or equivalent text editor and save it with the .bat extension.


set thisdir=%1
For /R %thisdir% %%J IN (*.mp4) do ( "C:\OpenPaths\ffmpeg.exe" -i "%%J" -c:a copy -vn -sn "%%J".m4a

Change C:\OpenPaths\ is where you have your ffmpeg.exe on you computer.

Now, all you have to do is drag the folder on to the batch file.


This will open a command window and for each .mp4 file, a m4a file will be ripped.

5. Convert to MP3 (extra!)

FFmpeg is a great tool and can also do conversions. Remember conversions do take longer.

For a single file on the command line:

C:\OpenPaths\ffmpeg.exe -i HugeVideo.mp4 -vn HugeVideo.mp3

And for a drag-n-drop MP4 video to MP3 audio folder batch file:


set thisdir=%1
For /R %thisdir% %%J IN (*.mp4) do (
"C:\OpenPaths\ffmpeg.exe" -i "%%J" -vn "%%J".mp3)

Wow. FFmpeg is a powerful program.