zeldor.biz

Linux, programming and more

Copyright © 2025
Log in

Convert mp4 to mp3

June 23, 2010 by Igor Drobot 1 Comment

In this little tutorial I show you how to convert mp4 to mp3.

First method:

1
vlc some-video.mp4 --sout '#transcode{acodec=mp2a, ab=96}:std{access=file, dst= "my_new.mp3", mux=ts}'

vlc some-video.mp4 --sout '#transcode{acodec=mp2a, ab=96}:std{access=file, dst= "my_new.mp3", mux=ts}'

Second one:

Your copy of FFmpeg needs to be capable of outputting mp3:

1
ffmpeg -formats | grep libmp3lame

ffmpeg -formats | grep libmp3lame

1
ffmpeg -i 2Invention_Lonely_Star.MP4 -acodec libmp3lame -ab 128k 2Invention.mp3

ffmpeg -i 2Invention_Lonely_Star.MP4 -acodec libmp3lame -ab 128k 2Invention.mp3

Or a loop for more than one file:

1
for f in *.mp4; do ffmpeg -i $f -acodec libmp3lame -ab 128k $(echo $f | sed 's/\.mp4$/\.mp3/'); done

for f in *.mp4; do ffmpeg -i $f -acodec libmp3lame -ab 128k $(echo $f | sed 's/\.mp4$/\.mp3/'); done




Convert to WAV:

1
mplayer -ao pcm 2Invention_Star.MP4 -ao pcm:file="2Invention_Star.wav"

mplayer -ao pcm 2Invention_Star.MP4 -ao pcm:file="2Invention_Star.wav"

A little convert loop:

1
2
3
4
5
6
7
#!/bin/bash
# 
# m4a2wav
# 
for i in *.m4a; do
    mplayer -ao pcm "$i" -ao pcm:file="${i%.m4a}.wav"
done

#!/bin/bash # # m4a2wav # for i in *.m4a; do mplayer -ao pcm "$i" -ao pcm:file="${i%.m4a}.wav" done

Filed Under: Linux Tagged With: Convert mp4, mp3, mp4 to mp3, Ubuntu

Yeaaah Cookie! We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.Ok