I'm recording screencasts and some part of the recorded screencasts I would like to speed up using a command line tool like ffmpeg.
I know that it is possible to use ffmpeg to speed up an entire video with a command like (source)
ffmpeg -i input.mkv -filter:v "setpts=0.5*PTS" output.mkv
Is it possible to only apply the speedup in certain regions in the video. Eg. from 10 to 15 seconds and again from 50 to 60 seconds? Something similar seems to be possible using the program slowmoVideo.
Speeding up/slowing down video This can be done via two methods: using the setpts video filter (which requires re-encoding) or by erasing the timestamps by exporting the video to a raw bitstream format and muxing to a container while creating new timestamps.
How to change the frame rate. There are two ways to change the output frame rate: With the -r option used as an output option. With the fps filter.
FFmpeg offers the overlay filter as a way to overlay images (or even other videos) onto video streams. To centre overlay/watermark on a video, use this command: ffmpeg -i inputvideo.avi -i watermarklogo.png -filter_complex \ "overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2" -codec:a copy output.flv.
Example : I want to speed up the first 4 seconds of my video.
ffmpeg -i input.mp4 -t 4 slow.mp4
ffmpeg -i input.mp4 -ss 00:00:04 part-2.mp4
ffmpeg -i slow.mp4 -filter:v "setpts=0.5*PTS" part-1.mp4
ffmpeg -f concat -i <(for f in ./part-*.mp4; do echo "file '$PWD/$f'"; done) -c copy output.mp4
Resources from ffmpeg documentation:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With