Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question
    
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 Aug 22 '13 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 Aug 22 '13 at 8:30

1 Answer 1

up vote 1 down vote accepted

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%"
share|improve this answer
    
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 Aug 22 '13 at 9:31
    
And it's as simple as removing %random% and replacing it with whatever I want :) thanks again! –  kinobe Aug 22 '13 at 9:34

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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