1
0

ffmpeg 複数のmovファイルをコマンドでまとめて連結させる

Last updated at Posted at 2024-06-20

目的

特定のディレクトリにある40個の動画ファイルを連結させたかった

準備

コマンド

$ ls -1v *.mov | sed 's/^/file /' > filelist.txt
$ ffmpeg -f concat -safe 0 -i filelist.txt -c copy output.mov

補足

$ ls -1v *.mov | sed 's/^/file /' > filelist.txt
  • ls -1v *.mov: .mov ファイルを名前順にリスト表示
  • sed 's/^/file /': 各ファイル名の前に file を追加
  • > filelist.txt: リストを filelist.txt に保存
filelist.txt
file aaa.mov
file bbb.mov
file ccc.mov
$ ffmpeg -f concat -safe 0 -i filelist.txt -c copy output.mov
  • -f concat: 連結モードを指定
  • -safe 0: ファイル名にスペースが含まれている場合でも安全に処理
  • -i filelist.txt: 入力リストファイル
  • -c copy: エンコードせずにコピー
  • output.mov: 出力ファイル名
1
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
1
0