Hello everyone,
I recently started to get into scripting for my encodes. As I am new to this, I found an example that I could use and it seems to work well. The issue I'm having is this...the first encode job runs and produces the file encoded1.mp4, but when the second encode job runs it uses the same output filename (encoded1.mp4). I would like the script to be able to copy the source filename to the destination filename so I can encode multiple episodes with this script. Can anyone help me out with this? I am currently learning more about scripting but have just started, so hopefully someone can take a look and help me out with this. It would be greatly appreciated.
Steps to reproduce the problem (If Applicable):
HandBrake version (e.g., 1.0.0):
Compiled from source
Code: Select all
user@server:~$ handbrake --version
Cannot load libnvidia-encode.so.1
Cannot load libnvidia-encode.so.1
Cannot load libnvidia-encode.so.1
Cannot load libnvidia-encode.so.1
[11:42:46] hb_init: starting libhb thread
[11:42:46] thread 7fd039cc4700 started ("libhb")
HandBrake 20200422135042-cd25206-master
HandBrake has exited.
Operating system and version (e.g., Ubuntu 16.04 LTS, macOS 10.13 High Sierra, Windows 10 Creators Update):
Debian 10.3 (headless)
Script
Link to script
Code: Select all
#!/bin/bash
SRC="/home/user/data/file_storage/user/Movie Rips/vids"
DEST="/home/user/data/file_storage/user/encoded_media/farscape"
DEST_EXT=mp4
HANDBRAKE=HandBrakeCLI
PRESETFILE="/home/user/data/file_storage/user/Handbrake Presets/v2_h264_sdmovies.json"
PRESET="v2_h264_sdmovies"
for FILE in "$SRC"/*
do
filename=$(basename $FILE)
extension=${filename##*.}
filename=${filename%.*}
$HANDBRAKE -i "$FILE" -o "$DEST"/"$filename".$DEST_EXT --preset-import-file "$PRESETFILE" --preset "$PRESET"
done