t3hPeNgU1NoFd00m
t3hPeNgU1NoFd00m

Reputation: 3

ffmpeg: Output to the same folder as source with recursive input?

I have a lot of gifs I want converted to webms in many sub directories, and I have this script which will do it, but it will output to the directory where the script is located:

for /r %%a in ("*.gif") do ffmpeg -i "%%a" -c:v libvpx -crf 12 -b:v 4000k "%%~na.webm"
pause

I've tried a bunch of things, but I can't figure out how to get the output to land in the same sub directory as the input file so I can maintain the folder structure.

Edit: it's a Windows batch file I'm using.

Upvotes: 0

Views: 2103

Answers (1)

Squashman
Squashman

Reputation: 14340

You are missing two command modifiers for your output filename.

"%%~dpna.webm"

Upvotes: 1

Related Questions