1
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?

More than 1 year has passed since last update.

ffmpegで動画を同期しながら並べる

Last updated at Posted at 2022-12-14

録画開始時間の異なるがサイズの同じ動画が複数あり、それらを時刻を合わせた状態で動画を並べるのに手こずった備忘録として。
開始時間の差分はマニュアルで算出しパラメータとして渡しています。

vstack, hstackはデフォルトで2つの動画を並べる。

2動画を縦に並べる。

ffmpeg -i video1.mp4 -i video2.mp4 -filter_complex "[0:v][1:v]vstack" -map "[v]" output.mp4

2動画を横に並べる。

ffmpeg -i video1.mp4 -i video2.mp4 -filter_complex "[0:v][1:v]hstack" -map "[v]" output.mp4

2動画を同期しながら横に並べる。

ffmpeg -i video1.mp4 -i video2.mp4 -filter_complex "[0:v]setpts=PTS-STARTPTS[v1];[1:v]trim=start='00\:00\:10'setpts=PTS-STARTPTS[v2];[v1][v2]hstack" -map "[v]" output.mp4

[v1]と[v2]はそれぞれ名前をつけているだけ。

3動画を同期して横に並べる。

ffmpeg -i video1.mp4 -i video2.mp4 -i video3.mp4 -filter_complex\
 "[0:v]setpts=PTS-STARTPTS[v0];\
  [1:v]trim=start='00\:00\:10'setpts=PTS-STARTPTS[v1];\
  [2:v]trim=start='00\:00\:20'setpts=PTS-STARTPTS[v2];\
  [v0][v1][v2]hstack=inputs=3[v]" -map "[v]" output.mp4

xstackの例

参考

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?