1

I've been searching around for this for some time but can't find a working solution. I found this question, which is close, but not exactly what I need.

I'm windows and ffmpeg to convert movs to mp4. What I would like to have is a cmd file on my desktop on which I can drop my mov from any folder and the cmd file will create an mp4 with the same name in the same folder as the original mov, except the extension should be mp4.

My cmd file looks like this:

@echo off ffmpeg -i %1 -s 1920x1080 -c:v libx264 -preset slow -bf 2 -crf 18 -pix_fmt yuv420p -movflags faststart -r 25 -profile:v baseline -level 3.0 -c:a aac -b:a 192k %1.mp4 pause

This creates the file Test.mov.mp4. I tried -f mp4 "%1~nf.mp4" instead of %1.mp4 but this outputs Test.mov~nf.mp4.

3
  • Use %~n1.mp4.
    – Gyan
    Nov 1, 2019 at 6:55
  • Ah thank you! Now I sort of get it. Although I had to add the path as well, so now I have %~p1%~n1.mp4 and it works!
    – MikeKnight
    Nov 1, 2019 at 21:19
  • You can add that as your answer.
    – llogan
    Nov 4, 2019 at 19:10

1 Answer 1

1

With Gyan's help I was able to get it to work. %~n1.mp4 will get the filename and substitute the file extension with mp4. To get the correct path as well, I added %~p1. So all in all I now use %~p1%~n1.mp4 and it works exactly as intended.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.