home ~ socials ~ projects ~ rss

Get Crop Of Black Bars In One Line

April 2021

This crops off black bars automatically.

TODO: write up notes on how it works and put in example without the gif stuff

TODO: Put in -ss 30 or the like at the start since opening splash screens may not have the bars

ffmpeg -i "input.mp4" -t 1 -vf cropdetect -f null - 2>&1 | awk '/crop/ { print $NF }' | tail -1 | xargs -I{} ffmpeg -ss 25 -t 9.2 -i "input.mp4" -vf "{},fps=11,scale=380:-2:flags=lanczos,split[s0][s1];[s0]palettegen=max_colors=52[p];[s1][p]paletteuse" -y "output.gif"
end of line
Share link:
https://www.alanwsmith.com/en/01/f4/8c/f1/?get-crop-of-black-bars-in-one-line