Remove audio from video file with FFmpeg

How can I strip the audio track out of a video file with FFmpeg?

0

4 Answers

You remove audio by using the -an flag:

input_file=example.mkv output_file=example-nosound.mkv ffmpeg -i $input_file -c copy -an $output_file 

This ffmpeg flag is documented here.

5

You probably don't want to reencode the video (a slow and lossy process), so try:

input_file=example.mkv output_file=example-nosound.mkv ffmpeg -i $input_file -vcodec copy -an $output_file 

(n.b. some Linux distributions now come with the avconv fork of ffmpeg)

4
avconv -i [input_file] -vcodec copy -an [output_file] 

If you cannot install ffmpeg because of existing of avconv try that .

I put together a short code snippet that automates the process of removing audio from videos files for a whole directory that contains video files:

FILES=/{videos_dir}/* output_dir=/{no_audio_dir} for input_file in $FILES do file_name=$(basename $input_file) output_file="$output_dir/$file_name" ffmpeg -i $input_file -c copy -an $output_file done 

I hope this one helps!

You Might Also Like