How can we extract audio from video file (MPEG-4 format)?
What is convenient form of storing the extracted audio data for further analysis? (edit: In other words: is it better to use PCM format or something like WAV if I want to get audio sound level?)
From other questions about this topic I learned that ffmpeg is a right tool to do this.
Regarding your first question:
You can indeed do this with ffmpeg, but I can only give you the command line form. You might want to fiddle with the output format, but have a look at the man page at http://linux.die.net/man/1/ffmpeg, or the official ffmpeg (audio) documentation at https://www.ffmpeg.org/ffmpeg.html#Audio-Options
ffmpeg -i mpeg-4videofilename -vn -ac 2 -ar 44100 -ab 320k -f mp3 output.mp3
Explanation of the command line options:
You can use the following command:
ffmpeg -i input.mp4 -vn -acodec pcm_s16le -ac 2 -ar 44100 out.wav
-vn: no video
-acodec: audio codec selection.
pcm_sl6le: 2 bytes samples in little endian format
-ac: number of audio channels
-ar: audio sample rate
out.wav output wav file
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With