Zend certified PHP/Magento developer

How can I batch convert a directory of subfolders, maintaining similar filestructure for the output

Right now I am converting using the following in Command Prompt:

FOR /F "tokens=*" %G IN ('dir /b /s *.mp4') DO (ffmpeg -i "%G" -c:v libvpx-vp9 -crf 30 -b:v 0 -b:a 128k "%~nG.webm" & del "%~G")

However, this spits out all output files into the top level of the directory. I’d like the outputs to be sent to their original subdirectories.