Created
April 25, 2017 07:37
-
-
Save mclang/f04e916c8acfd09215150d3020d39149 to your computer and use it in GitHub Desktop.
Converts given mkv files with embedded subtitle _streams_ into _harsub_ mp4 files using ffmpeg. Uses hardlinking to overcome problem with spaces in filename of the source subtitle file.
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 | |
set -u | |
set -e | |
shopt -s nullglob | |
for MKV in "$@"; do | |
out="$(basename "$MKV" .mkv).mp4" | |
echo "CONVERTING '$MKV''" | |
cp -l "$MKV" input.mkv | |
ffmpeg -i input.mkv -c:a copy -c:v libx264 -preset veryslow -crf 23 -vf subtitles=input.mkv "$out" | |
rm -f input.mkv | |
echo "==> $out" | |
echo "" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment