Last active
August 15, 2019 11:45
-
-
Save plaffitt/13fd44c9a0b7266e33cad6c3f1a3d64c to your computer and use it in GitHub Desktop.
Convert movies to constant framerate with FFmpeg reading filenames on stdin
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 | |
dest=$1 | |
fps=$2 | |
if [[ -z "$dest" ]]; then | |
dest='.' | |
fi | |
if [[ -z "$fps" ]]; then | |
fps=60 | |
fi | |
IFS=$' \n' read -d '' -r -a filenames | |
for i in "${filenames[@]}"; do | |
filename=$(basename -- "$i") | |
extension="${filename##*.}" | |
filename="${filename%.*}" | |
echo "$i -> ${dest}/${filename}_${fps}_const.${extension}" | |
ffmpeg -i "$i" -filter:v fps=fps=$fps -strict -2 "${dest}/${filename}_${fps}_const.${extension}"; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment