FFmpeg: Extract Audio Only from Media File Using Best Presets

audiodebianffmpegvideo editing

I was reading Cut part from video file from start position to end position with FFmpeg a few days back and I tried the following and it worked. While the video part was good, I am not sure if the audio could be made better or not. This is how I went about it

$ ffmpeg -ss 00:11:50 -i input.mkv -t 165 -c:v libx264 -preset slower -crf 22 -c:a copy output.mkv

I was cutting a portion of a video for my own requirements. Something like a clip or something from a movie or an audio/video piece that is nice, quirky etc.

Is there a better way?

I am using ffmpeg 4.2.2 on Debian testing which will eventually become Debian Bullseye (11.0)

Best Answer

No, there is no better way.

When you copy the audio stream with -c:a copy, you are not doing any re-encoding, so you are getting the exact same quality in the source. The only way to improve the quality further beyond what the source provides is by using sound editing software to remove noise or use other features.

You didn't mention why you re-encoded the video, and in case you only want to cut the video, a better way would be to remove the re-encoding and do

$ ffmpeg -ss 00:11:50 -i input.mkv -t 165 -c copy output.mkv

Related Question