Fixed names for when files have spaces in them

This commit is contained in:
Oliver Atkinson 2023-12-30 16:30:57 -07:00
parent 632653808b
commit 78237afa2a

View File

@ -1,6 +1,5 @@
#!/bin/bash
__usage="Usage: $(basename $0) FILE [ssh alias]
Options:
[FILE], Input video file
[ssh alias], The alias setup in ~/.ssh/config (default location)
@ -26,19 +25,19 @@ then
fi
FILE=$1
BASE=$(basename $FILE)
BASE=$(basename "$FILE")
OTHER=$2
EXTENSION=".new.mp4"
TEMP="/tmp/"
TEMP="/tmp/" # don't put in a dir with spaces
# move file to other's temp drive
scp $FILE $OTHER:$TEMP
scp "$FILE" $OTHER:$TEMP
# use ffmpeg to encode on other computer
ssh $OTHER "ffmpeg -y -i $TEMP$BASE -vcodec hevc $TEMP$BASE$EXTENSION"
ssh $OTHER "ffmpeg -y -i $TEMP\"$BASE\" -vcodec hevc -filter:v scale=-2:720 $TEMP\"$BASE\"$EXTENSION"
# move file back
scp $OTHER:$TEMP$BASE$EXTENSION $FILE$EXTENSION
scp $OTHER:$TEMP"$BASE"$EXTENSION "$FILE"$EXTENSION
# delete temp file
ssh $OTHER "rm $TEMP$FILE; rm $TEMP$FILE$EXTENSION"
ssh $OTHER "rm $TEMP\"$FILE\"; rm $TEMP\"$FILE\"$EXTENSION"
if [[ $3 == "-d" ]];
rm $FILE