Last active
March 6, 2021 10:14
-
-
Save Anan5a/26d26924de5baf29344e5469ac4ebd2c to your computer and use it in GitHub Desktop.
bash script for transcoding multiple video files in batch using ffmpeg, specifically for Animations/anime
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/bash | |
# Settings in this script is suitable for animes | |
#### | |
# To use simply put this script inside the folder where your source files are, edit dest variable to change destination folder | |
# TODO: add arguments for source and dest | |
#### | |
# Where to store encoded files | |
TAG="[Hulk] " #put your own if you like or remove the text | |
dest=/var/www/ripperR/ripper/files/clannad | |
bframes=6 | |
psy_rd=0.65 | |
aq_mode=3 | |
aq_strength=0.7 | |
pix_fmt=yuv420p10le #10bit | |
preset=slow | |
crf=25 | |
#audio, keep source configuration | |
acodec=libfdk_aac | |
#No subtitle settings, always copy subtitles to prevent breaking | |
for file in *.mkv | |
do | |
if [ -f "$dest/$TAG$file" ]; then | |
echo "ERROR: $dest/$TAG$file exists." | |
else | |
echo "Starting to encode file: $file" | |
ffmpeg -i "$file" -map 0 -c:v libx265 -x265-params bframes=$bframes:psy-rd=$psy_rd:aq-mode=$aq_mode:aq-strength=$aq_strength -pix_fmt $pix_fmt -preset $preset -crf $crf -c:a libfdk_aac -vbr 4 -c:s copy "$dest/$TAG$file" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
acodec is defined but not used