Last active
October 26, 2023 22:40
-
-
Save nimahkh/36c0dac31d9cb5363cf356095014524f to your computer and use it in GitHub Desktop.
add srt subtitle into mkv video with FFMPEG- put all off your mkv and srt files with same names ina folder and run sh command. all of the converted files will be in the added folder inside the current folder.
This file contains 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 | |
#author: [email protected] | |
#ffmpeg command from : https://gist.github.com/kurlov/32cbe841ea9d2b299e15297e54ae8971 | |
NOCOLOR='\033[0m'; | |
RED='\033[0;31m'; | |
GREEN='\033[0;32m'; | |
[ -d added ] || mkdir added | |
addToMKV(){ | |
for i in ./*.mkv | |
do | |
if [ -f "added/${i%.*}-added-subtitle.mkv" ]; then | |
echo -e "${RED}${i%.*}-added-subtitle.mkv Exists in added directory${NOCOLOR}" | |
else | |
ffmpeg -hide_banner -loglevel panic -i "$i" -sub_charenc 'UTF-8' -f srt -i "${i%.*}.srt" -map 0:0 -map 0:1 -map 1:0 -c:v copy -c:a copy -c:s srt "added/${i%.*}-added-subtitle.mkv"; | |
echo -e "${GREEN}${1} converted successfully ${i%.*}-with-subtitle.mkv${NOCOLOR}"; | |
fi | |
done | |
} | |
echo -e "Converting is starting:"; | |
addToMKV |
sureshharan7
commented
May 31, 2020
via email
Thank u very much
…On Thursday, May 28, 2020, Bosturk ***@***.***> wrote:
***@***.**** commented on this gist.
------------------------------
How to use this. I couldnt understand this. If u have any youtube channel
please upload a video about this. Or else please give a step by step
procedure of how to use this
This is made for linux, but you can run it using wsl on windows (
https://www.windowscentral.com/install-windows-subsystem-linux-windows-10
).
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<https://gist.github.com/36c0dac31d9cb5363cf356095014524f#gistcomment-3320994>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/APWLWPYVPLEUKBKC2KUK2PLRTYJ6PANCNFSM4NIYZGTQ>
.
Thank you very much. Now I can watch movies in my tv with subtitles.
works like magic pot, for some video you would probably need to map another audio channel which is -map 0:1
How to use this. I couldnt understand this. If u have any youtube channel please upload a video about this. Or else please give a step by step procedure of how to use this
This is made for linux, but you can run it using wsl on windows (https://www.windowscentral.com/install-windows-subsystem-linux-windows-10).
I made a version for windows.
copy the code to notepad and save as "add_sub.bat"
then execute.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment