Hello, I am trying to write a .bat File but Facing issue on output filename and trying to find solution about how to place input filename on output
Simply I am Dragging file on Batch Script and Press enter and ffmpeg handle restCode:set /p input= ffmpeg.exe -i %input% -vf "drawtext=fontsize=22:fontfile=C\\:/Windows/fonts/arial.ttf:fontcolor=white:text='NBMedia':bordercolor=black:borderw=2:x=w-tw-10:y=h-th-10, -vf crop=w=1920:h=808:x=0:y=132" -c:v libx264 -b:v 1200k -maxrate 1200k -bufsize 1200k "inputfilename_New.mp4" Pause
but I want to know Which Cmd can automatically place input file name on output filname
if my input filename =123.mp4, Then I want "123_New.Mp4" on Output Filename
But When i drag file on .bat file then my file will be added with Complete File Path and Name, So simply I Can't add "%input%_New.mp4" on Filename
I had found a Code on another Forum"
this code is Generating Randon Number Which is good and it won't overwrite My Previous encoded Video,Code:%~dpn1%random%%~x1
But I Want input Filename, so it will easy to find or organize Media Files
Thanks
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays! or rip iTunes movies!
+ Reply to Thread
Results 1 to 11 of 11
Thread
-
-
-
https://forum.videohelp.com/threads/398507-Top10-Commands-for-Lossless-Video-manipulat...e)#post2592949
"%%~nf_New.mp4" in a .bat file -
-
ffm4b.bat in provided link can handle a single file input from a prompt: you paste in the input path (or drag and drop if you prefer).
"%%~nf" is filename without extension in .bat
if your issues persist use echo command to figure out what's wrong. -
You're command line has many errors. You're not taking a filename via drag/drop, you're taking input from the keyboard. If you want drag/drop the input filename is %1 and the output file name is "%~dpn1_new.mp4".
Another problem with your script is the second -vf. You need to chain all the video filters into one vf. If you do that in the order the fitlers appear you will add a watermark to the lower right of the 1920x1080 frame then crop it away. You should crop first, add the watermark after:
Code:ffmpeg.exe -i %1 -vf "crop=w=1920:h=808:x=0:y=132,drawtext=fontsize=22:fontfile=C\\:/Windows/fonts/arial.ttf:fontcolor=white:text='NBMedia':bordercolor=black:borderw=2:x=w-tw-10:y=h-th-10" -c:v libx264 -b:v 1200k -maxrate 1200k -bufsize 1200k "%~dpn1_new.mp4"
-
Hi, Will you Please Write a Batch Script code, Which Can give option to support Drag and Drop File,
This above cmd work When I Simply drop file on that batch script,
But When I open that Batch, It won't have option to Drag File on Windows
Something Like
Code:@echo off {File Drag and Drop cmd Which Can Define input File as %1} : {Drag File Here : (as Text)} ffmpeg.exe -i %1 -vf "crop=w=1920:h=808:x=0:y=132,drawtext=fontsize=22:fontfile=C\\:/Windows/fonts/arial.ttf:fontcolor=white:text='NBMedia':bordercolor=black:borderw=2:x=w-tw-10:y=h-th-10" -c:v libx264 -b:v 1200k -maxrate 1200k -bufsize 1200k "%~dpn1_new.mp4"
Thanks -
drag&Drop feature makes sense only to be performed on windows explorer Icon/text or desktop with icons, when Windows os can take over and pass path of dragging file as argument %1 and run script. Because windows software is in focus at that time.
When you open that bat to edit, windows is out. When you have that bat file open for editing and it is in focus it is not run by Windows.
But you can just have SHORTCUT for that BAT file on desktop at all times even if physically it is somewhere else, also a text editor opened to edit that BAT and also windows explorer opened with bunch of video files .Last edited by _Al_; 5th Dec 2020 at 23:40.
-
-
Something like:
Code:@echo off goto :loop :encode ffmpeg.exe -i %1 -vf "crop=w=1920:h=808:x=0:y=132,drawtext=fontsize=22:fontfile=C\\:/Windows/fonts/arial.ttf:fontcolor=white:text='NBMedia':bordercolor=black:borderw=2:x=w-tw-10:y=h-th-10" -c:v libx264 -b:v 1200k -maxrate 1200k -bufsize 1200k "%~dpn1_new.mp4" return :loop cls echo Enter filename and press Enter set /p NAME= call :encode %NAME% goto :loop
Similar Threads
-
ffmpeg in bat file
By windranger in forum Video ConversionReplies: 5Last Post: 25th Jul 2020, 02:27 -
ffmpeg bat to mux multible audio and video
By alkoon in forum Newbie / General discussionsReplies: 3Last Post: 5th Jun 2020, 11:20 -
BAT File Problem Adding Image To Audio Using ffMPEG
By Col in forum AudioReplies: 5Last Post: 7th Feb 2018, 10:43 -
Can I use ffmpeg to create a script to download links from a .txt file?
By Serenity23 in forum Video Streaming DownloadingReplies: 0Last Post: 1st Dec 2016, 21:55