So I have been trying filter out H265/HEVC and only show videos that are not the previous codec and then execute a command that I have that will transcode the video using my settings.
Every time I find a solution or a way I may manipulate into how I want it done, it doesn't work. Either an error of some kind or where it's outdated and that's not how it is done now.
But it should be something like this:
find /mnt/videos -type f *.mp4 exec $filtercmd; $transcodecmd
The command should only print the file's absolute path, that way I can have it be used by the second command so that it can be transcoded.
I would prefer using ffprobe
as it seems to be a cleaner method. And I hate to basically ask someone write up a command or script but I just don't have the knowledge for something like this. Also it would be nice if this was written with the purpose of being on a schedule.
Thanks in advance!
EDIT:
I think I may have found a solution.
#!/bin/bash
# Reset
Color_Off='\033[0m' # Text Reset
# Regular Colors
Red='\033[0;31m' # Red
Green='\033[0;32m' # Green
# Bold
BRed='\033[1;31m' # Red
BGreen='\033[1;32m' # Green
for i in $(find /mnt/movies/ -type f -name '*.mkv' -o -name '*.mp4' -o -name '*.wmv' -o -name '*.flv' -o -name '*.webm' -o -name '*.mov'); do
ffprobe -v error -select_streams v:0 -show_entries stream=codec_name -of default=noprint_wrappers=1:nokey=1 "${i}"
if [[ $1 == 'h264' ]]; then
echo "Video is a ${BGreen}H264${Color_off} video file"
python sickbeard_mp4_automator/manual.py -i "$i" -a
elif [[ $1 == hevc ]]; then
echo "Video is alread transcoded to ${BRed}HEVC${Color_Off}"
fi
done
But it seems to be escaping the spaces. Can't seem to get it to quit. What do you guys think?