2

I want to create seamless loops with FFMPEG but am unsure of the right way of approaching it.

If I can pseudocode it out for y'all would someone be able to help me with the correct invocation?

ffmpeg -i input.mp4 --get-midway-point --put-second-half-of-film-first --put-first-half-of-film-second --overlap-part1-and-part2-by-n-milliseconds ---transition-transparency-from-100-to-0-over-n-milliseconds -o output.mp4

I'm sort of presuming that it's possible but I'm really stumped.

Giacomo1968
  • 53,069
  • 19
  • 162
  • 212
Flowdeeps
  • 21
  • 1
  • Currently this requires scripting, so answer depends on your OS or preferred scripting language. Or wait for the pending [crossfade filter patch](https://lists.ffmpeg.org/pipermail/ffmpeg-devel/2019-October/252027.html) to get applied and it will make things easier. – llogan Oct 28 '19 at 18:29
  • Aha, great. So I should break it down into each task and make a shell script or python script then. Thanks for answering, I'll be sure to report back if I get it worked out. – Flowdeeps Nov 01 '19 at 14:44
  • @llogan Please post your comment as an answer. – Giacomo1968 Nov 01 '19 at 14:52
  • @JakeGould Sure, but I was waiting for the OP to tell me the OS so I could possibly come up with a turnkey answer. – llogan Nov 01 '19 at 16:46
  • @llogan You should just post an answer and edit for the OS specifics after that is clarified. Take credit! – Giacomo1968 Nov 01 '19 at 18:42

1 Answers1

1

This needs to be scripted, but I'm unsure of your OS/shell/scripting language so I can't give you a turnkey answer to copy and paste. Here are the basic steps:

  1. Get duration of input.

  2. Divide the result in half. Example using bc.

  3. Create segments with (a)trim filters.

  4. Crossfade

llogan
  • 57,139
  • 15
  • 118
  • 145