1

I'm trying to create a batch file to process videos and rename the output file automatically.

I've got this so far:

@ECHO OFF
d:\audio\ffmpeg.exe -i "%~1" -vcodec copy -acodec libvo_aacenc -af volume=3.0 "%~1"
pause

The last "%~1" will overwrite the initial file. What I'd like is that they append something to the back of the file, for example:

filename.avi will return filename1.avi

How do I go about doing that?

2
  • Why the tilde in %~1? Shouldn't that just be %1? Anyway just try appending a 1 and make it %11. The % placeholder only goes up to 9, so two digits are not interpreted as a number > 10
    – Jan Doggen
    Commented Aug 22, 2013 at 7:58
  • Cos I'm drag-n-dropping a file onto the BAT and my video files have long path names with spaces in it. I tried added 1 behind, but ffmpeg does not recognize .avi1 as a file type and will break. Optimally I would like to concatenate the last 4 chars, edit the filename, append the last 4 chars back in.
    – kinobe
    Commented Aug 22, 2013 at 8:30

1 Answer 1

1

Appends random number to output file name.

set output=%~dpn1%random%%~x1
d:\audio\ffmpeg.exe -i "%~1" -vcodec copy -acodec libvo_aacenc -af volume=3.0 "%output%"
2
  • This worked! Thanks!.... now to figure out what you did there. I'd like to append a fixed wording like "fixed" to the end instead of random numbers.
    – kinobe
    Commented Aug 22, 2013 at 9:31
  • And it's as simple as removing %random% and replacing it with whatever I want :) thanks again!
    – kinobe
    Commented Aug 22, 2013 at 9:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .