ffmpeg でビデオをループ再生する方法

ffmpeg でビデオをループ再生する方法

長いビデオがあります5s。最終的なビデオは60s長くなるはずです。結果のビデオは「ピンポン」ループになるはずです。つまり、5 秒が 60 秒に達するまで前後に再生されるはずです。

これを実行する魔法を知っている人はいますかffmpeg?

私のffmpegバージョン:

ffmpeg version 3.0.2 Copyright (c) 2000-2016 the FFmpeg developers
  built with Apple LLVM version 7.3.0 (clang-703.0.29)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/3.0.2 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-opencl --enable-libx264 --enable-libmp3lame --enable-libxvid --enable-vda
  libavutil      55. 17.103 / 55. 17.103
  libavcodec     57. 24.102 / 57. 24.102
  libavformat    57. 25.100 / 57. 25.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 31.100 /  6. 31.100
  libavresample   3.  0.  0 /  3.  0.  0
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100

答え1

使用

ffmpeg -i input.mp4 \
       -filter_complex "[0]reverse[r];[0][r]concat,loop=5:250,setpts=N/25/TB" output.mp4

ではloop=5:2505はループ数、250は ですframe rate x double length of clip。 はsetptsフレーム ドロップを回避するために適用され、 の値は25クリップのフレームレートに置き換える必要があります。

関連情報