0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

FFmpegでMP4動画の音声だけを一括削除する方法(再エンコードなし・高速処理)

0
Posted at

動画の映像はそのままに、音声だけを削除したいことがあったのでメモ。

FFmpegを使うと、再エンコードせずに音声トラックだけを削除できるため、高速かつ画質劣化なしで処理できます。

単体ファイルの場合

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

オプション解説

  • -c copy

    • 映像・音声を再エンコードせずにコピー
  • -an

    • 音声トラックを削除

この方法では映像データはそのまま保持されるため、処理時間も短く画質劣化もありません。


フォルダ内のMP4を一括処理

カレントディレクトリ内のMP4ファイルをまとめて処理する場合は以下。

for f in *.mp4; do
  ffmpeg -i "$f" -c copy -an "${f%.mp4}_mute.mp4"
done

実行すると、

movie01.mp4
movie02.mp4
movie03.mp4

が

movie01_mute.mp4
movie02_mute.mp4
movie03_mute.mp4

として出力されます。


任意のフォルダを指定する場合

for f in /path/to/folder/*.mp4; do
  ffmpeg -i "$f" -c copy -an "${f%.mp4}_mute.mp4"
done

サブフォルダも含めて処理したい場合

find /path/to/folder -name "*.mp4" -exec sh -c '
  ffmpeg -i "$1" -c copy -an "${1%.mp4}_mute.mp4"
' _ {} \;

注意点

この方法は「音声トラックを削除」するものであり、「無音の音声トラックを残す」わけではありません。

動画プレイヤー上では「音声なし動画」として扱われます。


まとめ

音声だけ削除したい場合は、

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

だけ覚えておけばOKです。

  • 再エンコードなし
  • 画質劣化なし
  • 高速処理
  • 一括処理も簡単

動画編集ソフトを立ち上げるほどではない、ちょっとした素材整理に便利でした。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?