Collected tips on audio processing with ffmpeg.

Remove audio from a video

To remove audio from a video file, i.e., muting the video, run the following command:

ffmpeg -i input.mp4 -c copy -an input-silent.mp4

Ref:

Extract audio from ffmpeg

ffmpeg -i input.mp4 -vn -acodec copy out.acc
  • -vn: do not use video
  • -acodec copy: copy the audio stream (equivalent to -codec:a copy, see stream specifier)

Extract audio in a time range

ffmpeg -i input.mp4 -vn -acodec copy -ss 00:01:00 -t 30 out.aac
  • -ss: the start time to process the video, in above case, we start from 1 minute
  • -t: the video duration to process, in this case, we process 30 seconds of video.

There is also a -to option which specifies the stop time to process the video. So the above command can also be written as:

ffmpeg -i input.mp4 -vn -acodec copy -ss 00:01:00 -to 00:01:30 out.aac

Ref: