Skip to content

Instantly share code, notes, and snippets.

@mamemomonga
Last active October 17, 2023 04:31
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mamemomonga/2b8a7471ba9abf9b2af4c3b4d55f4cca to your computer and use it in GitHub Desktop.
Save mamemomonga/2b8a7471ba9abf9b2af4c3b4d55f4cca to your computer and use it in GitHub Desktop.
ffmpegメモ

ffmpegメモ

1080Pの動画の 70秒目から5秒ぶん切り出し、音声なし720Pに変換する

$ ffmpeg -ss 70 -i infile.mp4 -t 5 -vf scale=1280:-1 -an outfile.mp4

映像音声2倍速

-vf setpts=PTS/2.0 -af atempo=2.0 

1:35(min:sec) を 95(sec)に変換

perl -E '@c=split(/:/,$ARGV[0]);say ($c[0]*60+$c[1])' 1:35

オーディオのみのビデオを作る

  • ビデオはブルーバックに「Audio Only」の文字を表示する
  • フォントはHelveticaNeue(Mac用)

コマンド

$ ffmpeg \
  -f lavfi -y -i color=size=640x360:duration=1:rate=1:color=blue \
  -i "入力オーディオ.wav" \
  -map 0:v -map 1:a \
  -vf "drawtext=fontfile=/System/Library/Fonts/HelveticaNeue.ttc:fontsize=30:fontcolor=white:x=(w-text_w)/2:y=(h-text_h)/2:text='Audio Only'" \
  -ab 160k \
  "出力ビデオ.mp4"

デインターレス

  • デインターレス(プログレッシブ・x2フレームレート)

コマンド

$ ffmpeg -i BDMV.mov -vf yadif=mode=1:parity=-1:deint=1 outfile.mp4
  • デインターレス(プログレッシブ・x2フレームレート)
  • h264 40Mbps, FLAC

コマンド

$ ffmpeg -i BDMV.mov -vf yadif=mode=1:parity=-1:deint=1 -c:v h264 -b:v 40M -c:a flac outfile.mp4
  • デインターレス(プログレッシブ・x2フレームレート)
  • 720p h264 4Mbps
  • 音声なし

コマンド

$ ffmpeg -i BDMV.mov -vf yadif=mode=1:parity=-1:deint=1,scale=1280:-1 -c:v h264 -b:v 4M -an outfile.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment