Created
July 17, 2019 17:30
-
-
Save hernan43/b58b2b99fcb112c12bddc6bb936d8574 to your computer and use it in GitHub Desktop.
I record all of my Retroarch gameplay footage into a captures directory. It starts as MKV but I like to upscale(nearest neighbor) to 5x and re-encode 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
#!/bin/sh | |
FFMPEG=/usr/bin/ffmpeg | |
SCALE=5 | |
MKV_FILES=`ls /mnt/captures/**/*.mkv` | |
for FILE in $MKV_FILES; do | |
DIRNAME=`dirname $FILE` | |
OUTPUT_FILENAME=$DIRNAME/`basename -s .mkv $FILE`.mp4 | |
if [ -w $OUTPUT_FILENAME ];then | |
echo "$OUTPUT_FILENAME exists removing..." | |
rm $OUTPUT_FILENAME | |
echo "Removed." | |
fi | |
$FFMPEG -i $FILE -f mp4 -pix_fmt yuv420p -vcodec libx264 -preset fast -acodec aac -vf scale=iw*$SCALE:ih*$SCALE:force_original_aspect_ratio=decrease -sws_flags neighbor $OUTPUT_FILENAME && rm $FILE | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment