Created
June 26, 2025 16:13
-
-
Save tknr/12cf613d5d55365ced32c98376e6b819 to your computer and use it in GitHub Desktop.
mkv2mp4
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 | |
IFS=$'\n' | |
for mkv in `find . -name "*.mkv"`;do | |
echo ${mkv} | |
STREAM_NO=`ffprobe -hide_banner -v error -i ${mkv} -show_streams -of json | jq -c '.streams[] | select(.codec_name == "subrip")' | jq '.index'` | |
echo ${STREAM_NO} | |
ffmpeg -y -i ${mkv} -map 0:${STREAM_NO} ${mkv%%.mkv}.srt | |
nice -n 19 ffmpeg -hide_banner -y -i "${mkv}" -movflags +faststart -codec:v libx264 -vf pad="width=ceil(iw/2)*2:height=ceil(ih/2)*2" -preset:v fast -acodec aac -b:a 192k -aac_coder twoloop "${mkv%%.mkv}.mp4" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment