如何使用 ffmpeg 来回循环播放视频

sou*_*ver 7 video ffmpeg

我有一个很5s长的视频。最后的视频应该很60s长。生成的视频应该是一个“乒乓”循环,这意味着我的 5s 应该来回播放,直到达到 60s。

有人知道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
Run Code Online (Sandbox Code Playgroud)

Gya*_*yan 13

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

在 中loop=5:2505是循环数,250frame rate x double length of clip。将setpts被施加到避免帧滴,并且该值25应与夹子的帧率来代替。