Last active
August 30, 2022 11:38
-
-
Save lene/0573537444abe4be6b2ca9b9358f65d1 to your computer and use it in GitHub Desktop.
re-encode videos to H.265, specifying source and target container format (fish shell)
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
set FROM_EXT mp4 | |
set TO_EXT mkv | |
set ABR 128k | |
set CRF 22 | |
for i in *.$FROM_EXT | |
set BASENAME (basename $i .$FROM_EXT) | |
set DIRNAME (dirname $i) | |
nice -n 19 time ffmpeg -i "$DIRNAME/$BASENAME.$FROM_EXT" -vcodec libx265 -crf $CRF -ac 2 -c:a libmp3lame -b:a $ABR output.$TO_EXT; and \ | |
mv output.$TO_EXT "$DIRNAME/$BASENAME.$TO_EXT"; and \ | |
rm "$i" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Audio is recoded too - target audio is hardcoded to mp3 stereo here (
-ac 2
: 2 channels,-c:a libmp3lame
: use mp3lame encoder for audio).