Created
January 11, 2023 23:21
-
-
Save gibatronic/f152319bdcfa71ec14b14c26a55f7801 to your computer and use it in GitHub Desktop.
Slide an image to the left using ffmpeg
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# Slide an image to the left using ffmpeg | |
# | |
# Usage: | |
# ./slide photo_input.jpg video_output.mp4 | |
# | |
# See: | |
# https://ffmpeg.org/ffmpeg-filters.html#overlay-1 | |
# https://easings.net/ | |
# | |
main() { | |
local photo_input=$1 | |
local video_output=$2 | |
local duration='10' # in seconds | |
local fps='30' | |
local width='2160' | |
local height='3840' | |
ratio="t/${duration}" | |
easing="-(cos(PI*(${ratio}))-1)/2" # in-out-sine | |
overlay="(W-w)*(${easing}):(H-h)/2" | |
ffmpeg -f lavfi -i "\ | |
color=black:r=${fps}:d=${duration}:s=${width}x${height}[background]; \ | |
movie=${photo_input}[overlay]; \ | |
[background][overlay]overlay='${overlay}' \ | |
" -y "${video_output}" | |
} | |
main "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this one grew to be its own project: fotofx