1

The case: There's a program called gMKVExtractGUI which demuxes MKV videofiles. You can rightclick any MKV, and the program opens that video. It can then extract the subtitles. It doesn't work on MP4 files.

I made a batchfile with an FFmpeg command line that DOES extract subtitles from MP4 video files. The batchfile contains the following command:

ffmpeg -i Film(20xx).mp4 -map 0:3 Film(20xx).srt

But in order to do that, the name of the right-clicked movie needs to be 'passed on' to the batch file.

This question might SEEM like the one below, but it is not. Windows: How to add batch-script action to Right Click menu

Using Default Programs Editor from that question solves the problem of adding a command to the context menu. However, it does not solve the problem of making that batch file work on the rightclicked MP4 video-file, in question.

Questions:

  • How do I pass on the movie file name to the batch file?
  • What can I use from the quoted question to help me
  • If this approach is flawed, what would be a good way of extracting subtitles from MP4's by using the context-menu?

Thanks....

Please remember that I am relatively new, so be kind. Even though some members here have down-voting as a hobby, (especially questions they don't immediately understand), if you do that, you can at least MOTIVATE why you down-vote.

EDIT

Dear Wasif: When I just wanted to test your command in the batchscript with the variable **"%~1"**, it produced an error message: **%~1: No such file or directory** When I ran the the command line with the fixed names (rather than the variables) of video and subtitle, it DID extract the subtitle.

So, I'm not filling that variable **"%~1"**. Ideas on how to fill it? Where do I define (declare?) the variable? In the batchfile?

Here's the command line output in DOS:

    e:\subbedMP4> b:\Programs\ffmpeg.exe -i "%~1" -map 0:3 "%~dpn1Film(20xx).srt"
    ffmpeg version git-2020-08-31-4a11a6f Copyright (c) 2000-2020 the FFmpeg developers
      built with gcc 10.2.1 (GCC) 20200805
      configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libsrt --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libgsm --enable-librav1e --enable-libsvtav1 --disable-w32threads --enable-libmfx --enable-ffnvcodec --enable-cuda-llvm --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf
      libavutil      56. 58.100 / 56. 58.100
      libavcodec     58.101.101 / 58.101.101
      libavformat    58. 51.101 / 58. 51.101
      libavdevice    58. 11.101 / 58. 11.101
      libavfilter     7. 87.100 /  7. 87.100
      libswscale      5.  8.100 /  5.  8.100
      libswresample   3.  8.100 /  3.  8.100
      libpostproc    55.  8.100 / 55.  8.100
    %~1: No such file or directory
e:\subbedMP4>

1 Answers1

0

Yes, first change the batch file like this:

ffmpeg -i "%~1" -map 0:3 "%~dpn1Film(20xx).srt"

Then the .REG file will be:

Windows Registry Editor 5.00

[HKEY_CLASSES_ROOT.mp4] "MUIVerb"="Extract subtitles" "Position"="Bottom"

[HKEY_CLASSES_ROOT.mp4\command] @=""FULL PATH OF THE BATCH SCRIPT" "%1""

wasif
  • 9,176