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

Categories

Archives

Tags

apache2 Apple arduino ARM Automation backup bash Cisco Cluster Corosync Database Debian Debian squeeze DIY DNS Fedora FTP Fun Icinga Ipv6 KVM Linux LVM MAC OS X Monitoring MySQL Nagios Nginx openSUSE OpenVPN PHP Proxy Python python3 qemu RAID rsync Samba security ssh Ubuntu virtualization Windows Windows 7 Wordpress

Trackbacks

  1. Anonymous says:
    January 29, 2011 at 07:10

    Good post once again!…

Leave a Reply

Your email address will not be published. Required fields are marked *

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