Created
November 5, 2024 10:10
-
-
Save guessi/c879ad3dd8141c136b2cc914bbaf7262 to your computer and use it in GitHub Desktop.
resize video with ffmpeg
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
INPUT="${1}" | |
OUTPUT="${2}" | |
SIZE="1920:1080" # horizontal | |
# SIZE="1080:1920" # vertical | |
BITRATE_V="4800k" | |
# https://trac.ffmpeg.org/wiki/Encode/H.265 | |
ffmpeg -i ${INPUT} \ | |
-c:v libx265 -vtag hvc1 -x265-params pass=1 \ | |
-b:v "${BITRATE_V}" -vf "scale=${SIZE}" \ | |
-an \ | |
-map_metadata 0 \ | |
-preset slower \ | |
-f null /dev/null | |
ffmpeg -i ${INPUT} \ | |
-c:v libx265 -vtag hvc1 -x265-params pass=2 \ | |
-b:v "${BITRATE_V}" -vf "scale=${SIZE}" \ | |
-c:a copy \ | |
-map_metadata 0 \ | |
-preset slower \ | |
${OUTPUT} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment