I’m a hobbyist media collector and I recently started a project of mine, being a self-hosted media server with my owned media. I’ve been doing everything manually for a while but started getting into shell scripting for it to automate a lot of typing. In my script for compressing seasons of series I can’t get the script to detect spaces and hyphens on the file name.
There’s my script:
echo "Warning! Please ensure before running this script that the files you'd like to convert are in the following format: 'series_name - SXXEYY' and mind that by running this script you're aware that the uncompressed files are goint to be automatically deleted. If you change your mind press 'Ctrl + C' to cancel or press [ENTER] to continue:"
read
echo "Enter destination of the input folder:"
read input
echo "Enter series name(how it's written inside the folder):"
read series_name
echo "Enter season number:"
read season_no
echo "Enter number of episodes in the season:"
read ep_no
echo "Enter destination of the output folder:"
read output
for i in $(seq -f "%02g" 1 $ep_no); do
input_file="$input/"$series_name - S${season_no}E${i}.mkv""
output_file="$output/"$series_name - S${season_no}E${i}.mkv""
ffmpeg -i "$input_file" -c:v libx264 -crf 22 -c:a copy -c:s copy -map 0 "$output_file"
done
rm -rf "$input"
clear
echo "Done :)"
and here’s how I save my files:
nesco@nesker:~/uncompressed/Rome$ ls
'Rome - S01E01.mkv' 'Rome - S01E02.mkv'
I’m currently extracting the raw files again because last time I ran the script it did not detect and erased the folder
user24908321 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.