32 lines
718 B
Bash
Executable File
32 lines
718 B
Bash
Executable File
#!/bin/bash
|
|
# ssh-encode FILE SSH-ALIAS
|
|
FILE=$1
|
|
OTHER=$2
|
|
EXTENSION=".new.mp4"
|
|
# probably best this file is on a tmpfs mount as to reduce
|
|
# rw wear
|
|
TEMP="/tmp/"
|
|
|
|
|
|
if [[ -z $1 ]];
|
|
then
|
|
echo "Pass the file to encode as the first argument."
|
|
exit
|
|
fi
|
|
|
|
if [[ -z $2 ]];
|
|
then
|
|
echo "Pass the ssh alias of the remote device as the second argument."
|
|
exit
|
|
fi
|
|
|
|
# move file to other's temp drive
|
|
scp $FILE $OTHER:$TEMP
|
|
# use ffmpeg to encode on other computer
|
|
ssh $OTHER "ffmpeg -y -i $TEMP$FILE -vcodec h264_nvenc -acodec aac -pix_fmt yuv420p -g 15 -movflags frag_keyframe+empty_moov $TEMP$FILE$EXTENSION"
|
|
# move file back
|
|
scp $OTHER:$TEMP$FILE$EXTENSION .
|
|
# delete temp file
|
|
ssh $OTHER "rm $TEMP$FILE; rm $TEMP$FILE$EXTESION"
|
|
|