Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I went through the documentation and I can extract a wav file from an mp4 file with the command:

ffmpeg -i my_video.mp4 output_audio.wav

However, how can I control the quality of the wav file? (e.g. say I want to preserve the quality of the original audio as much as I can)

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

wav files typically contain uncompressed audio, and that is the default when producing a wav file using ffmpeg. So your command will already preserve the maximum quality, since there is no lossy compression (or compression of any kind) to reduce the quality.

Assuming that the original audio is compressed, you can keep the same quality without the large file size needed for uncompressed audio by just copying the original audio (without the video) to a new mp4 file:

ffmpeg -i my_video.mp4 -vn -acodec copy output_audio.mp4

You could also re-encode it or convert it to a different audio codec, but if that codec uses lossy compression then quality will be lost.

share|improve this answer
    
Thanks. What about sampling rate and # of bytes per second? How does ffmpeg choose these automatically? –  user815423426 Jun 20 '13 at 13:10
    
The sample rate will be the same as that of the input. Because it is uncompressed, the bitrate for the wav file is simply the sample rate × sample size × number of channels. If you wanted to reduce the quality you can ask ffmpeg to resample it to a lower rate, change it to 8-bit PCM, or downmix to mono, but it does not do that by default. –  mark4o Jun 20 '13 at 16:16
    
BTW you could also ask it to resample at a higher rate, but that would just increase the file size and not the quality, so there's not much point in that unless you need a specific sample rate. –  mark4o Jun 20 '13 at 16:25
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.