' Extract subtitles (SRT files) from video (MKV file) - Requires ffmpeg.exe (https://ffmpeg.org)
' Video

Set WshShell = CreateObject("Wscript.Shell")
Set fso = WScript.CreateObject("Scripting.Filesystemobject")
Set toolkit = CreateObject("VbsEdit.Toolkit")

ffmpeg = "c:\ffmpeg.org\bin\ffmpeg.exe"
OnErrorResumeNext
ffmpeg = wshshell.RegRead("HKEY_CURRENT_USER\Software\Adersoft\Vbsedit\Ffmeg_location")
OnErrorGoTo 0
IfNot(fso.FileExists(ffmpeg)) Then
  ffmpeg_files=toolkit.OpenFileDialog("","ffmpeg (*.exe)|*.exe",False,"Locate ffmpeg.exe")
  If UBound(ffmpeg_files)<0 Then
    WScript.Quit
  EndIf
  ffmpeg = ffmpeg_files(0)
  If fso.FileExists(ffmpeg) Then
    wshshell.RegWrite "HKEY_CURRENT_USER\Software\Adersoft\Vbsedit\Ffmeg_location",ffmpeg
  EndIf  
EndIf


files=toolkit.OpenFileDialog("","MKV Files (*.mkv)|*.mkv",False,"Open a video file")
If UBound(files)<0 Then
  Wscript.Quit
EndIf

videoFile = files(0)

srtFile = toolkit.SaveFileDialog("c:\","test.srt","SRT Files (*.srt)|*.srt","Save SRT file as")

If LCase(Right(srtFile,4))=".srt"Then
  srtFile = Left(srtFile,Len(srtFile)-4)
EndIf

For i=0 To 10
  suffixe=""
  If i>0 Then
    suffixe = "_" & i
  EndIf
  cmd= """" & ffmpeg & """ -i """ & videoFile & """ -map 0:s:" & i & " """ & srtFile & suffixe & ".srt"""
  WScript.Echo cmd
  wshshell.Run cmd,1,True
Next

search for scripts

VbsEdit contains all these sample scripts!


Download Now!



Download   Home   Scripts

Copyright © 2001-2022 adersοft