diff --git a/zsh/ffmpeg b/zsh/ffmpeg index db40979..bf86517 100644 --- a/zsh/ffmpeg +++ b/zsh/ffmpeg @@ -95,6 +95,23 @@ ff-av1-scale720p() { done } +# Recompress input MP4 to 560p AV1 MP4 (copy audio) +ff-av1-scale560p() { + for input in *.mp4; do + if [[ -f "$input" ]]; then + tempfile="temp_${input%.mp4}" + ffmpeg -hide_banner -loglevel info -i "$input" -vf format=yuv420p10le,scale=960:-2 -c:v libsvtav1 -preset 6 -crf 23 -g 30 -svtav1-params tune=0 -c:a copy -c:s copy "$tempfile.mp4" + if [[ $? -eq 0 ]]; then + mv "$input" "_$input" + mv "$tempfile.mp4" "$input" + echo "Conversion successful: $input" + else + echo "Conversion failed for: $input" + fi + fi + done +} + # # Video helper # @@ -117,7 +134,7 @@ function ff-dts() { # ffmpeg audio-to-ac3 function ff-audio-to-ac3() { ffmpeg -hide_banner -loglevel error -i "$1" -movflags faststart -map 0 -c:v copy -c:s copy -c:a ac3 -b:a 448k "temp_$1" - mv "$1" "_$1" && mv "temp_$1" "$1" + mv "$1" "_$1" && mv "temp_$1" "$1" } ## ffmpeg wma-to-m4a @@ -162,7 +179,7 @@ function ff-cutend { # # ffmpeg fix 16:9 AR -function ff-ar16-9() { +function ff-ar16-9() { ffmpeg -hide_banner -loglevel error -i "$1" -c copy -map 0 -bsf:v "h264_metadata=sample_aspect_ratio=4/3" -aspect 16:9 -pix_fmt yuv420p -movflags faststart "temp_$1" mv "$1" "_$1" && mv "temp_$1" "$1" } @@ -179,7 +196,7 @@ function ff-ar4-3() { mv "$1" "_$1" && mv "temp_$1" "$1" } -# ffmpeg fix AR ($1 = file, $2 1/1, $4:3) +# ffmpeg fix AR ($1 = file, $2 1/1, $4:3) function ff-ar-custom() { if [ $# -lt 3 ]; then >&2 echo "Not enough arguments (\$1 = 'file', \$2 '1/1', \$3 '4:3')"