B
B
bushart2015-06-09 15:45:00
Video processing
bushart, 2015-06-09 15:45:00

How to make the joint invisible when joining two videos using ffmpeg?

Probably many are familiar with the ping-pong-loop effect from the video from coub.com, when a section of the video reaches the end and smoothly starts playing backwards, and then returning to the beginning, it smoothly plays in forward order.
In my project I need to implement the same but on the server side.
In principle, I almost solved this problem using ffmpeg. First, I create a copy of the video backwards, merge it with the original video, and then merge the resulting enemy several times.
Everything would be fine, but I can’t achieve a smooth transition at the gluing points. I have already tried to cut 1 frame at the end of each fragment. It got better, but still not as smooth as on coub.com.
I tried two gluing options with an infinite number of parameters, but nothing works:
ffmpeg -f concat -i videos-list.txt -vcodec libx264 -y destination.mp4
and
ffmpeg -i source1.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts temp1.ts
ffmpeg -i source2.mp4 -c copy - bsf:v h264_mp4toannexb -f mpegts temp2.ts
ffmpeg -i 'concat:source1.mp4|source2.mp4' -c copy -bsf:a aac_adtstoasc destination.mp4

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question