Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
409 views
in Technique[技术] by (71.8m points)

Trim a video and add the boomerang effect on it with FFmpeg

I have a given source video which is 30 seconds long in total. Now I want to trimm the first 5 seconds and apply the boomerang effect on it. That's the command where I am currently:

ffmpeg -i src.mp4 -y -an -filter_complex "[0]trim=start=0:end=5[a];[a]reverse[r];[a][r]concat,loop=0:250,setpts=N/30/TB" out.mp4

Im relatively new to ffmpeg and I'm trying to understand the principals, but I struggle with it a bit. After reading some docs, I understanded that the first brackets [0] are the source stream for the manipulation and the leading ending brackets are the output stream name, so I can continue to process it with other manipulations like concat etc.

That's what I tried with [a], which should act as the output stream of my trimed video. But this didn't worked well.

Another approach what I found is to use -ss 0 -t 5,but this would trim it at the end of the processing, what would be inefficient since ffmpeg would apply my manipulation on the complete 30 seconds and throw away the 25secs afterwards.

What did I understand wrong and how can I fix it ?

question from:https://stackoverflow.com/questions/65874316/trim-a-video-and-add-the-boomerang-effect-on-it-with-ffmpeg

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Something like this?

ffmpeg -i src.mp4 -filter_complex "
[0]trim=start=0:end=5[a];
[0]trim=start=0:end=5,reverse[b];
[a][b]concat
" -an out.mp4 -y -hide_banner

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

Just Browsing Browsing

[4] html - How to create even cell spacing within a

2.1m questions

2.1m answers

60 comments

57.0k users

...