Ffmpeg interpreting argument as string

Questions involving a Windows version of FFmpeg.
Post Reply
Posts: 1
Joined: Fri Mar 15, 2019 2:32 pm

Ffmpeg interpreting argument as string

Post by JohannGerhard » Fri Mar 15, 2019 2:42 pm

First of all I am sorry if this is not the right place to ask, to be honest I am not even entirely sure if this is an issue with ffmpeg or cmd, as my grasp of cmd is limited to say the least. I am grateful for any answers or hints towards solving my issue. That out of the way, here's my issue:

I want ffmpeg to be started via a .bat file and loop over every file within the folder, replacing the metadata within the file with the filename.

Here's how the .bat is currently structured:

Code: Select all

for %%A IN (*.webm) DO (
$FILEPATH$ -i "%%A" -c copy -metadata title=%%~nfx "%%A" -y
Note that $FILEPATH$ is the filepath of ffmpeg on my computer.
The issue I have is that I want to give ffmpeg the "title=" argument with the filename. If I use %%A it works, but the metadata is now "filename.webm" instead of "filename". Therefore I looked into arguments to use to get the filename without the extension. Apparently ~nfx does that. If I run this .bat though, it interprets the command as a string and replaces every metadata title with "%~nfx".

Is there a way to solve this issue? I feel like it shouldn't be too complicated but I am clearly out of my league here.
Again, thanks for any help.

Post Reply