labrat
labrat

Reputation: 111

batch file for encoding videos with ffmpeg - "variable": %%a

what is the meaning of '%%a' and '%%~na' in this expression: http://www.pasteall.org/58875?

for %%a in ("*.*") do ffmpeg -i "%%a" "newfiles\%%~na.mp4"pause

I want to batch encode a couple of video files. all are in the same folder with nothing else in it. I found explanations which tell that it is a variable. but for what does a variable like this stand?

working on win 7 ult 64bit.

Upvotes: 1

Views: 2289

Answers (3)

Smriti Vyas Tris
Smriti Vyas Tris

Reputation: 1

for %%a in (".mp4")do ffmpeg -y -i "%%a" -i"%%a" -filter_complex "[0:v:0]pad=iw2:ih[bg]; [bg][1:v:0]overlay=w" -preset ultrafast output"%%a".mp4

Upvotes: 0

prudviraj
prudviraj

Reputation: 3744

%%a is a special parameter , which will be substituted by the value of a FOR loop, the IN ( ....) clause is evaluated and %%a set to a different value in each iteration.

Upvotes: 1

SomethingDark
SomethingDark

Reputation: 14305

%%~na will return the file name without the path or extension of a file returned by a for loop.

From the output of for /?:

%~I         - expands %I removing any surrounding quotes (")
%~fI        - expands %I to a fully qualified path name
%~dI        - expands %I to a drive letter only
%~pI        - expands %I to a path only
%~nI        - expands %I to a file name only
%~xI        - expands %I to a file extension only
%~sI        - expanded path contains short names only
%~aI        - expands %I to file attributes of file
%~tI        - expands %I to date/time of file
%~zI        - expands %I to size of file

Upvotes: 3

Related Questions