I'm using the following command in a batch file that I double-click in the folder containing the resp. webm video and m4a audio files:
for %%a in ("*.webm") do "C:\AVConvert\ffmpeg.exe" -i "%%~fa" -i "%%~na.m4a" -c:v copy -c:a copy -map 0:0 -map 1:0 "%%~na.mkv"
It works great and muxes webm with m4a audio into one mkv file. It even automatically batch-converts multiple webm/m4a files present in the same folder. Now, I wanna make the batch file available as one of multiple conversion options in the right-click context menu of media files in Windows Explorer.
Background: I have created a collection of ffmpeg batch files similar to the one above to convert between various media file types or losslessly extract audio streams from videos (among other features). For convenience, I organized the access to the batch files in cascaded context menu entries in the context menu of media files.
For now, all the batch files which are triggered when a user clicks on a context menu entry are of the following format: "C:\AVConvert\ffmpeg.exe" -i "%~1" -map_metadata 0 -codec:a pcm_s24le -write_bext 1 "%~d1\%~p1\%~n1.wav"
. The batch files work in whatever directory the media files are right-clicked and with as many files as the user had selected prior to triggering the right-click conversion option. Output folder is always the same as the input folder.
All batch files reside in C:\AVConvert\Batches
, ffmpeg.exe is located in C:\AVConvert\
. Various registry entries make the resp. batch files available in media file context menues. Problem is that the batch file containing the for
loop above doesn't work when triggered via the context menu entry.
cd /d "%~dp1"
[HKEY_CLASSES_ROOT\SystemFileAssociations\.webm\Shell\4AVConvertMuxVA\Shell\01_M4A\command] @="C:\\AVConvert\\Batches\\WEBMV+M4AA.bat \"%V\""
. All other batch files I'm using don't have afor
loop but rely on the user's file selection which I'd also prefer for the muxing script but"C:\AVConvert\ffmpeg.exe" -i "%~1" -i "%~n1.m4a" -c:v copy -c:a copy -map 0:0 -map 1:0 "%~n1.mkv"
does nothing at all.