2

I need to reverse the input video and concat it then the loop the output video twice. I was able to achieve reversing and concat it with original video using

ffmpeg -i input.mkv -filter_complex "[0:v]reverse,fifo[r];[0:v][r] concat=n=2:v=1 [v]" -map "[v]" output.mkv

But i want to stream_loop it 3 times. And also i like to know, if there's any better ways to do it. The video will be a small one(4 seconds max.) and without audio.

Shahal
  • 1,008
  • 1
  • 11
  • 29

1 Answers1

3

After the first command,

ffmpeg -i input.mkv -filter_complex "[0:v]reverse,fifo[r];[0:v][r] concat=n=2:v=1 [v]" -map "[v]" output.mkv

you can run

ffmpeg -stream_loop 2 -i output.mkv -c copy output3.mkv

To do it in one go,

ffmpeg -i input.mkv -filter_complex "[0:v]reverse,split=3[r1][r2][r3];[0:v][r1][0:v][r2][0:v][r3] concat=n=6:v=1[v]" -map "[v]" output.mkv

With recent versions of ffmpeg, you shouldn't need fifo filters.

Gyan
  • 85,394
  • 9
  • 169
  • 201
  • Thanks. I got another command to do this. But like to know which is faster and stable. `ffmpeg -i input.mkv -filter_complex "[0]reverse[r];[0][r]concat,loop=3:250,setpts=N/30/TB" output.mp4` – Shahal Sep 13 '19 at 09:42
  • Using the stream loop after your original command is the fastest. My one-pass command doesn't require the user to know the frame count or framerate, so I prefer it. – Gyan Sep 13 '19 at 11:56
  • okay. thanks. If you are using ffmpeg on Android can you suggest me any doc for it's integration. I've generated all *.so files for arm64-v8a, armeabi & armeabi-v7a, but don't know how to integrate it to Android. – Shahal Sep 13 '19 at 12:44