Last active
March 9, 2021 15:51
-
-
Save k06a/45f4ff4e52a7c0ad2add370ab1a315e7 to your computer and use it in GitHub Desktop.
H265 with ffmpeg
This file contains 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
# Installing ffmpeg with H265 support | |
brew tap varenc/ffmpeg | |
brew install varenc/ffmpeg/ffmpeg --with-fdk-aac --HEAD | |
# Installing mp4edit tool | |
brew install bento4 |
This file contains 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
#!/bin/sh | |
for input in "$@" | |
do | |
file=${input%.*} | |
output=$(basename -- "$file") | |
ffmpeg -i "$input" -movflags use_metadata_tags -map_metadata 0:g -map_metadata:s:v 0:s:v -map_metadata:s:a 0:s:a -tag:v hvc1 -c:v libx265 -c:a libfdk_aac -profile:a aac_he_v2 -x265-params crf=25 -preset ultrafast "$output-new.mp4" | |
touch -r "$input" "$output-new.mp4" | |
temp_file=$(mktemp) | |
mp4extract moov/meta "$input" "$temp_file" | |
mp4edit --insert moov:"$temp_file" "$output-new.mp4" "$output-newest.mp4" && rm "$output-new.mp4" | |
done |
This file contains 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
#!/bin/sh | |
for input in "$@" | |
do | |
file=${input%.*} | |
output=$(basename -- "$file") | |
ffmpeg -i "$input" -movflags use_metadata_tags -map_metadata 0 -map_metadata:s:v 0:s:v -map_metadata:s:a 0:s:a -tag:v hvc1 -c:v libx265 -c:a libfdk_aac -profile:a aac_he -x265-params crf=25 -preset ultrafast "$output-new.mp4" | |
touch -r "$input" "$output-new.mp4" | |
temp_file=$(mktemp) | |
mp4extract moov/meta "$input" "$temp_file" | |
mp4edit --insert moov:"$temp_file" "$output-new.mp4" "$output-newest.mp4" && rm "$output-new.mp4" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Updated gist to conform new ffmpeg Homebrew formula