Created
July 20, 2020 11:07
-
-
Save LukasKnuth/40c53447ff0c980297c010939a6b9cdd to your computer and use it in GitHub Desktop.
Encode to H265, no quality loss
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
#!/bin/bash | |
function encode { | |
# Add a "?" at the end of a "map" to say "if available" | |
# For a preview: add "-ss 0" before "-i" and "-t 120" before the output file. This gives a 2min sample | |
ffmpeg -hide_banner \ | |
-i "$1" \ | |
-map_metadata 0 \ | |
-map_chapters 0 \ | |
-metadata title="$2" \ | |
-map 0 \ | |
-map 0:s? \ | |
-c copy \ | |
-c:v libx265 -preset ultrafast -x265-params \ | |
crf=22:qcomp=0.8:aq-mode=1:aq_strength=1.0:qg-size=16:psy-rd=0.7:psy-rdoq=5.0:rdoq-level=1:merange=44 \ | |
"out/$3.1080p.h265.DTS.mkv" | |
} | |
function encode720 { | |
# Add a "?" at the end of a "map" to say "if available" | |
# On "-vf scale", the -n says "fit aspect ratio". The n says "but correct to have choosen number be dvisible by this number" | |
ffmpeg -hide_banner \ | |
-i "$1" \ | |
-vf scale=-2:720 \ | |
-map_metadata 0 \ | |
-map_chapters 0 \ | |
-metadata title="$2" \ | |
-map 0 \ | |
-map 0:s? \ | |
-c copy \ | |
-c:v libx265 -preset ultrafast -x265-params \ | |
crf=22:qcomp=0.8:aq-mode=1:aq_strength=1.0:qg-size=16:psy-rd=0.7:psy-rdoq=5.0:rdoq-level=1:merange=44 \ | |
"out/$3.720p.h265.DTS.mkv" | |
} | |
date | |
echo "---------- START -------------" | |
encode "file.mkv" "Movie Title (20xx)" "file_name" | |
echo "---------- END ---------------" | |
date | |
#shutdown -h now |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment