16 lines
538 B
Bash
Executable File
16 lines
538 B
Bash
Executable File
#!/bin/bash
|
|
TMPFILE=$(mktemp)
|
|
LOGFILE="/tmp/2avc1.log"
|
|
|
|
BITRATE=$(ffprobe -v error -select_streams v:0 -show_entries stream=bit_rate -of csv=p=0 "$1")
|
|
|
|
if [ "$(is_cuda)" == "ok!" ]; then
|
|
echo "======== CUDA ========"
|
|
time ffmpeg -y -hwaccel cuda -i "$1" -f mp4 -vcodec h264_nvenc -acodec copy -b:v "$BITRATE" $TMPFILE
|
|
else
|
|
echo "======== VAPPI ========"
|
|
time ffmpeg -y -vaapi_device /dev/dri/renderD128 -hwaccel vaapi -i "$1" -f mp4 -vcodec h264 -acodec copy -b:v "$BITRATE" $TMPFILE
|
|
fi
|
|
|
|
backup_and_replace "$1" "$TMPFILE" "$LOGFILE"
|