4 ms·
Really nice. > The corresponding command-line arguments are pretty gnarly: ffmpeg -i input.mp4 -i overlay.png -filter_complex "[0]trim=start_frame=10:end_
by johnchristopher 7y ago
Really nice.
> The corresponding command-line arguments are pretty gnarly:
ffmpeg -i input.mp4 -i overlay.png -filter_complex "[0]trim=start_frame=10:end_frame=20[v0];\
[0]trim=start_frame=30:end_frame=40[v1];[v0][v1]concat=n=2[v2];[1]hflip[v3];\
[v2][v3]overlay=eof_action=repeat[v4];[v4]drawbox=50:50:120:120:red:t=5[v5]"\
-map [v5] output.mp4
I have actually written scripts that would generate such horrors but north of 2000 characters :].
> If you're like me and find Python to be powerful and readable, it's easier with ffmpeg-python:
import ffmpeg
in_file = ffmpeg.input('input.mp4')
overlay_file = ffmpeg.input('overlay.png')
(
ffmpeg
.concat(
in_file.trim(start_frame=10, end_frame=20),
in_file.trim(start_frame=30, end_frame=40),
)
.overlay(overlay_file.hflip())
.drawbox(50, 50, 120, 120, color='red', thickness=5)
.output('out.mp4')
.run()
)
- adriantam 7y agoI am not surprised for a script north of 2000 characters for this. Check out Fred's ImageMagick scripts (http://www.fmwconcepts.com/imagemagick/index.php http://www.fmwconcepts.com/imagemagick/index.php). In the similar concept, they are long shell scripts generating an imagemagick command