Add 560p AV1

This commit is contained in:
Jan Jastrow 2024-08-05 11:57:19 +02:00
parent 97ed016a6b
commit f7b2ac8036

View File

@ -95,6 +95,23 @@ ff-av1-scale720p() {
done 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 # Video helper
# #
@ -117,7 +134,7 @@ function ff-dts() {
# ffmpeg audio-to-ac3 # ffmpeg audio-to-ac3
function ff-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" 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 ## ffmpeg wma-to-m4a
@ -162,7 +179,7 @@ function ff-cutend {
# #
# ffmpeg fix 16:9 AR # 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" 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" mv "$1" "_$1" && mv "temp_$1" "$1"
} }
@ -179,7 +196,7 @@ function ff-ar4-3() {
mv "$1" "_$1" && mv "temp_$1" "$1" 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() { function ff-ar-custom() {
if [ $# -lt 3 ]; then if [ $# -lt 3 ]; then
>&2 echo "Not enough arguments (\$1 = 'file', \$2 '1/1', \$3 '4:3')" >&2 echo "Not enough arguments (\$1 = 'file', \$2 '1/1', \$3 '4:3')"