Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@Anan5a
Last active March 6, 2021 10:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Anan5a/26d26924de5baf29344e5469ac4ebd2c to your computer and use it in GitHub Desktop.
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
#!/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
@LetrixZ
Copy link

LetrixZ commented Jan 3, 2021

acodec is defined but not used

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment