Log in

View Full Version : Automatic Same Name


jay123210599
5th November 2024, 16:27
When doing any operation in ffmpeg, how do I automatically make the output file have the same name as the input file?

For example, I remux a single mkv file to mp4, and I want the output mp4 to have the same name as the input mkv.

Using a script is not allowed.

Selur
11th November 2024, 21:13
What OS?
Isn't anything called in a bash (on Windows) or a terminal (Linux/Mac) basically a script?
if you know the name and can use a environment variable probably do something like:
set p=INPUT_NAME && call ffmpeg -i "YOUR_PATH_TO/%p%.mkv" "OUTPUT_PATH/%p%.mkv"
(INPUT_NAME, YOUR_PATH_TO and OUTPUT_PATH are variables that need to be set)

Cu Selur

jay123210599
13th November 2024, 02:32
What OS?
Isn't anything called in a bash (on Windows) or a terminal (Linux/Mac) basically a script?
if you know the name and can use a environment variable probably do something like:
set p=INPUT_NAME && call ffmpeg -i "YOUR_PATH_TO/%p%.mkv" "OUTPUT_PATH/%p%.mkv"
(INPUT_NAME, YOUR_PATH_TO and OUTPUT_PATH are variables that need to be set)

Cu Selur

I'm in Windows, and I don't want to use scripts. This is for cases like ffmpeg.

Z2697
13th November 2024, 04:05
i'm in windows, and i don't want to use scripts. This is for cases like ffmpeg.

no.
:)

I think the only case where FFmpeg will parse formatted filename is with image2 muxer/demuxer

StainlessS
13th November 2024, 11:59
Is the OP wanting some kind of ffmpeg GUI ?
(requirement seems a little 'fuzzy')

hello_hello
13th November 2024, 18:17
You could try AnotherGUI. https://www.videohelp.com/software/AnotherGUI

Use the Executables menu to tell AnotherGUI where ffmpeg is.
A preset for remuxing a file as an MP4 might look like this (added to the First Pass section of the preset configuration), but of course it can be a preset for performing any type of ffmpeg conversion.

-i "<FullSourceFileName>" -y -threads 1 -vcodec copy -acodec copy "<OutputPath><OutputFileName>.mp4"

Once you've created the preset, select it and drag and drop a file or files onto AnotherGUI (any file type that can be remuxed as an MP4), then click "Go". The default output name is the same as the input.

jay123210599
17th November 2024, 15:08
I don't want a GUI. I want to put in something that will get me the same name for the output from the input, like %d or something.

tebasuna51
19th November 2024, 09:31
If you don't want GUI's or scripts you can run that command line in a folder with the mkv's you want convert to mp4:

FOR %I in (*.mkv) DO "YOUR_PATH_TO\ffmpeg.exe" -i "%I" "%~nI.mp4"

jay123210599
21st November 2024, 14:13
If you don't want GUI's or scripts you can run that command line in a folder with the mkv's you want convert to mp4:

FOR %I in (*.mkv) DO "YOUR_PATH_TO\ffmpeg.exe" -i "%I" "%~nI.mp4"

What if I have only a single mkv I want to convert to mp4?

GeoffreyA
22nd November 2024, 09:08
It will work for a single file.