Advertisement
noone1222

Untitled

Oct 26th, 2023
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. @echo off
  2. setlocal enabledelayedexpansion
  3.  
  4. REM Prompt the user for the input directory
  5. set /p "inputDir=Enter the directory where the MKV and SRT files are located: "
  6.  
  7. REM Check if the "added" directory exists in the input directory; if not, create it
  8. if not exist "!inputDir!\added" mkdir "!inputDir!\added"
  9.  
  10. REM Function to add subtitles to MKV files
  11. :ConvertToMKV
  12. for %%f in ("!inputDir!\*.mkv") do (
  13. set "videoFile=%%~nf.mkv"
  14. set "outputFile=!inputDir!\added\%%~nf-added-subtitle.mkv"
  15. if not exist "!outputFile!" (
  16. ffmpeg -hide_banner -loglevel panic -i "%%~f" -sub_charenc UTF-8 -f srt -i "!inputDir!\%%~nf.srt" -map 0:0 -map 0:1 -map 1:0 -c:v copy -c:a copy -c:s srt "!outputFile!"
  17. echo [Success] Converted "%%~nf.mkv" with subtitles to "!outputFile!"
  18. ) else (
  19. echo [Skipped] "!outputFile!" already exists
  20. )
  21. )
  22.  
  23. echo Conversion completed.
  24. pause
  25.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement