Add mac support
This commit is contained in:
parent
04d54485d9
commit
40275ad867
|
@ -1,15 +1,14 @@
|
|||
#!/bin/bash -x
|
||||
|
||||
# usage: change-length.sh 1.007 input.mp4 output.mp4 [--fast]
|
||||
# ^output.mp4 will be be 7% longer
|
||||
# --fast is faster, but slightly more risky
|
||||
# usage: change-length.sh 1.007 input.mp4 output.mp4 [0] [--fast]
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
RATIO=$1;
|
||||
IN_FILE=$2;
|
||||
OUT_FILE=$3;
|
||||
MODE=${4-"--slow"};
|
||||
IS_MAC=${4-"0"};
|
||||
MODE=${5-"--slow"};
|
||||
BITRATE=$(ffmpeg -i "$IN_FILE" 2>&1 | grep bitrate | awk -F", " '{print $3}' | sed 's/bitrate: //' | sed 's/ //' | sed 's/b\/s//' || echo "");
|
||||
|
||||
echo ratio set to "$RATIO"
|
||||
|
@ -51,8 +50,11 @@ slow () {
|
|||
|
||||
echo "running with filter $FILTER";
|
||||
|
||||
if [ "$IS_MAC" -eq 1 ]; then
|
||||
ffmpeg -c:v h264_videotoolbox -i "$IN_FILE" -b:v $BITRATE -filter_complex "$FILTER" "${OPTS[@]}" -c:v h264_vaapi "$OUT_FILE";
|
||||
else
|
||||
ffmpeg -hwaccel vaapi -hwaccel_output_format vaapi -vaapi_device /dev/dri/renderD128 -i "$IN_FILE" -b:v $BITRATE -filter_complex "$FILTER" "${OPTS[@]}" -c:v h264_vaapi "$OUT_FILE";
|
||||
# ffmpeg -i "$IN_FILE" -filter_complex "$FILTER" "${OPTS[@]}" "$OUT_FILE";
|
||||
fi;
|
||||
}
|
||||
|
||||
fast (){
|
||||
|
|
Loading…
Reference in New Issue
Block a user