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を使った動画作成メモ

0
Posted at

ffmpegメモ

まずはコード

ffmpeg -framerate 240 \
-i imageout/image%06d.png \
-vf "select='not(mod(n\,4))',setpts=N/(60*TB)" \
-r 60 \
-c:v libx264 \
-pix_fmt yuv420p \
-movflags +faststart \
./videoout/animation.mp4

ファイルの並べ方

連番で出力しておけば勝手にうまくやってくれる。

/imageout
 |-image000000.png
 |-image000001.png
 |-image000002.ong
 .
 .
 .
/videoout
 |-animation.mp4

諸々の形式指定

(1)

ffmpeg -framerate 240 

連番ファイルを240fpsの動画にする。基本は入力と出力を指定してこのコマンドを打てばそれでいい。すなわち、以下が基本形。

ffmpeg -framerate 240 -i imageout/image%06d.png ./videoout/animation.mp4

(2)

-vf "select='not(mod(n\,4))',setpts=N/(60*TB)"

間引き。
000000,000001,000002,000003...と言う連番ファイルのうち、000000,000004,000008,000012...と、4枚に一枚だけ使う。その上で、間引きした後のフレーム間隔をsetpts=N/(60*TB)で揃える。(今場合もとのfpsが240で、240/4=60なので、60が入っている。)

(3)

-r 60 \
-c:v libx264 \
-pix_fmt yuv420p \
-movflags +faststart \

-r=60はフレームレート指定。その他はおまじない程度に思っておくとい。

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?