Skip to content

Instantly share code, notes, and snippets.

@k06a
Last active March 9, 2021 15:51
Show Gist options
  • Save k06a/45f4ff4e52a7c0ad2add370ab1a315e7 to your computer and use it in GitHub Desktop.
Save k06a/45f4ff4e52a7c0ad2add370ab1a315e7 to your computer and use it in GitHub Desktop.
H265 with ffmpeg
# Installing ffmpeg with H265 support
brew tap varenc/ffmpeg
brew install varenc/ffmpeg/ffmpeg --with-fdk-aac --HEAD
# Installing mp4edit tool
brew install bento4
#!/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
#!/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
@k06a
Copy link
Author

k06a commented Dec 13, 2017

In case of MONO audio use aac_he profile instead of aac_he_v2

@k06a
Copy link
Author

k06a commented May 21, 2018

Nice way to pick voices: https://superuser.com/a/835585/126537

ffmpeg -i <input_file> -af "highpass=f=200, lowpass=f=3000" <output_file>

@k06a
Copy link
Author

k06a commented Apr 1, 2019

Updated gist to conform new ffmpeg Homebrew formula

@k06a
Copy link
Author

k06a commented Oct 28, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment