Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # ffmpegのメモ.md
- ## 連番動画→mp4 (H265)
- H.264 → libx264、H.265 → libx265 に対応。
- $ ffmpeg -framerate 30 -i path/to/dir/%05d.png -vcodec libx265 -pix_fmt yuv420p -r 30 output.mp4
- リサイズ (-1は縦横比を合わせる指定)
- $ ffmpeg -framerate 30 -i path/to/dir/%05d.png -vf scale=320:-1 -vcodec libx265 -pix_fmt yuv420p -r 30 output.mp4
- 品質 (固定品質, crfの数値が小さくなると高品質。デフォルトは23)
- $ ffmpeg -framerate 30 -i path/to/dir/%05d.png -vf scale=320:-1 -vcodec libx265 -crf 10 -pix_fmt yuv420p -r 30 output.mp4
- ## 動画→gifアニメ
- $ ffmpeg -i input.mp4 -vf scale=320:-1 -r 15 output.gif
- カラーパレットを使う方法。きれいにgifアニメができる
- $ ffmpeg -i input.mp4 -vf "palettegen" -y palette.png
- $ ffmpeg -i input.mp4 -i palette.png -lavfi "fps=15,scale=320:-1:flags=lanczos [x]; [x][1:v] paletteuse=dither=bayer:bayer_scale=5:diff_mode=rectangle" -y output.gif
- 時間を指定する(3秒目から10秒間)
- $ ffmpeg -i input.mp4 -vf "palettegen" -y palette.png
- $ ffmpeg -i input.mp4 -i palette.png -ss 3 -t 10 -lavfi "fps=10,scale=320:-1:flags=lanczos [x]; [x][1:v] paletteuse=dither=bayer:bayer_scale=5:diff_mode=rectangle" -y output.gif
- 5倍速再生 (PTF/5.0)
- $ ffmpeg -i input.mp4 -vf "palettegen" -y palette.png
- $ ffmpeg -i input.mp4 -i palette.png -lavfi "fps=%5,scale=640:-1:flags=lanczos,setpts=PTS/5.0 [x]; [x][1:v] paletteuse=dither=bayer:bayer_scale=5:diff_mode=rectangle" -y output.gif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement