Recently I did many tests and figured out the optimal settings for VVC conversion. I want to create two executables, fftest and ffconvert. These are meant to work alongside the FFMPEG-VVC project. fftest will create a whole battery of test files by the simple act of dragging and dropping the file to be tested onto fftest.exe. ffconvert will also work via drag and drop and will create a vvc/aac mkv file including any subs if available. These two files will effectively be just batch scripts running invisibly, I make them exe because I can add icons and include temporary files that way, like the required ffmpeg.exe file. I'm more than familiar with DOS and with ffmpeg and the FFMPEG-VVC project, but the thing I'm having trouble figuring out is how to make the batch files detect the name of the file being dropped and use it in my commands. I never did that before, but it's literally the last piece in my puzzle. Can someone provide an example?
+ Reply to Thread
Results 1 to 5 of 5
-
Last edited by imkira3; 7th Oct 2023 at 17:56.
-
Example: https://forum.videohelp.com/threads/377677-Video-batch-files#post2469186
Dropped filepath would be referd to as %1, but perhaps better way is to use "%~1" if dealing with filepaths.
It is basically a first argument. If dropping two files, you'd use %1 and %2 in your script. -
-
Hmmm okay, I tried a small test command to see if I understood the concept properly. It works fine, but with one slight error. The input file was called Test.avi but the output file is Test.avi.mkv instead of Test.mkv. Did I do something wrong?
Code:ffmpeg -i "%~1" -c:v copy "%~1.mkv" pause
Code:ffmpeg -i "%~1" -c:v copy "%~n1.mkv" pause
Last edited by imkira3; 8th Oct 2023 at 00:09.
-
if dealing with an unknown number of dropped files you just might use something like this:
Code:@echo off rem processing unknown number of arguments :get_argument if "%~1"=="" (goto end) else (call :process "%~1") shift goto get_argument :process <filepath> echo processing "%~1" ffmpeg -i "%~1" -c:v copy "%~n1.mkv" goto :eof :end echo No more arguments, press any key to exit ... & pause>nul & exit
Code:call :process "D:\my_file.mp4"
That text between <> characters is just a note, in our case <filepath>, to keep a track what type of argument that passed %1 actually is. It is really helpful if there is many arguments or there are subroutines within subroutines. I know subroutines could be deep as six or seven (subroutines within subroutines) and it is still ok. Not sure what is maximum.
command "shift" just shifts arguments, %2 becomes %1, %3 becomes %2 etc.Last edited by _Al_; 8th Oct 2023 at 13:06.
Similar Threads
-
[FFMPEG BATCH SCRIPT] Remux MP4 to MKV removing all details data!
By Cauptain in forum Video ConversionReplies: 3Last Post: 12th Aug 2021, 03:38 -
ffmpeg Burn ASS Subtitle Batch Script
By Daringbaaz in forum Newbie / General discussionsReplies: 3Last Post: 12th Jun 2021, 01:45 -
Batch Script for FFMPEG TIFF Conversion
By Jolly Green in forum ProgrammingReplies: 5Last Post: 30th Sep 2020, 14:11 -
Useful FFmpeg Windows Batch Script
By Guanadon in forum Newbie / General discussionsReplies: 0Last Post: 22nd Sep 2020, 10:48 -
Need help writing an ffmpeg script to batch split many video files by size
By manav in forum Newbie / General discussionsReplies: 11Last Post: 6th Aug 2020, 17:37