How to rip the audio from a video?

喜欢而已 提交于 2019-12-01 18:22:50
mplayer <videofile> -dumpaudio -dumpfile out.bin

it will copy the raw audio stream, that should then be easily converted using sox, lame, vlc or whatnot. VLC has nice conversion options as well - and it sports a GUI. I don't know about extracting just the audio, but it should sure be capable of it

Use TAE https://github.com/tuna74/TunaAudioExtracter. It does everything you want.

Easiest way to do this using GStreamer is to create GStreamer pipeline with decodebin element using gst-launch command-line utility:

gst-launch-1.0 filesrc location=in.mp4 ! decodebin ! audioconvert ! lamemp3enc ! filesink location=out.mp3

In case your mp4 file contains audio track in mp3 format you may want to avoid re-encoding:

gst-launch-1.0 filesrc location=in.mp4 ! qtdemux ! audio/mpeg ! filesink location=out.mp3

If you want to use FFMPEG, you can use following command:

ffmpeg -i in.mp4 out.mp3

You can avoid re-encoding (in case audio track is in mp3) with -acodec copy option:

ffmpeg -i in.mp4 -acodec copy out.mp3
programmer44

hmm, for an easy python solution, you could always checkout the python video converter, on https://pypi.python.org/pypi/video-converter a sample code is as follows:

    from converter import Converter
    c = Converter()
    conv = c.convert('g.mp4', 'clip5.mp3', {'format':'mp3','audio':{'codec': 'mp3','bitrate':'22050','channels':1}})
    for timecode in conv:
        pass

where clip5.mp3 is the name of the output file,

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!