Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
|
![]() |
|
Thread Tools | Search this Thread | Display Modes |
![]() |
#22 | Link | ||
Registered User
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 3,062
|
Quote:
Quote:
Here is a "universal" template for my needs, it also reports the AspectRatio and the FrameRate_Mode. Under the label "outname" you can easily modify the format of the output to your needs, should be easy... ![]() https://www.sendspace.com/file/hof8bz Cheers manolito |
||
![]() |
![]() |
![]() |
#23 | Link |
Registered User
Join Date: May 2009
Location: Belgium
Posts: 1,741
|
Thanks.
I achieved to add VFR for VFR files, but the script also adds CFR for CFR files while I didn't specify it ; is there a way not to write anything for the FrameRate_Mode when it's CFR ? For example ; Code:
FOR /F %%a in ('MediaInfo.exe "--Inform=Video;%%FrameRate_Mode%%" %in%') DO SET fr_mode=%%a IF "%fr_mode%"=="Variable" SET type=VFR IF "%fr_mode%"=="Constant" SET type= Code:
IF "%fr_mode%"=="Constant" DO NOT SET type ![]() |
![]() |
![]() |
![]() |
#24 | Link | ||
Registered User
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 3,062
|
The FrameRate_Mode parameter returns CFR or VFR, not Constant or Variable. Use these lines:
Quote:
Quote:
|
||
![]() |
![]() |
![]() |
#25 | Link |
Registered User
Join Date: May 2009
Location: Belgium
Posts: 1,741
|
Thanks, I also had to remove 2 spaces : in front of %fr_mode% (second line) and in front of CFR (third line).
Otherwise, CFR was added anyway and a space was added in front of VFR (despite the fact that I removed the space in the "outname" line), now it's perfect ![]() |
![]() |
![]() |
![]() |
#26 | Link |
Registered User
Join Date: May 2009
Location: Belgium
Posts: 1,741
|
Hi manolito,
a few years later, I'm trying to do something else based on your script : change the extension using MediaInfo because I have some video files with wrong extensions and would like to correct them. I tried to modify your script and made this ; Code:
@ECHO off IF !%1==! GOTO syntax SET Work_Drive=%~d0 SET Work_PATH=%~p0 %Work_DRIVE% CD "%Work_PATH%" FOR /F %%a in ('MediaInfo.exe "--Inform=General;%%Format%%" %in%') DO SET Format=%%a IF NOT DEFINED Format GOTO next_file FOR /F %%a in ('MediaInfo.exe "--Inform=General;%%Format profile%%" %in%') DO SET ForProf=%%a IF "%Format%"=="MPEG-TS" SET Format=ts IF "%Format%"=="Matroska" SET Format=mkv IF "%Format%"=="Flash Video" SET Format=flv IF "%Format%"=="AVI" SET Format=avi IF "%Format%"=="MPEG-4" GOTO FormProf :FormProf IF "%ForProf%"=="Base Media" SET Format=mp4 IF "%ForProf%"=="QuickTime" SET Format=MOV :outname SET out_name=%in_name%.%Format% RENAME %in% "%out_name%" REM COPY /B %in% "%in_path%%out_name%" >NUL :next_file SHIFT IF NOT !%1==! GOTO syntax GOTO :EOF :syntax CLS ECHO. Echo Press a key to exit... PAUSE >nul I guess something's wrong with my code. mp4 and mov have both the same format for MediaInfo (MPEG-4), that's why I had to redirect them to "Format profile" (with "GOTO FormProf") which helps to distinguish them. Thanks for your help. ![]() Last edited by Music Fan; 9th June 2023 at 13:54. |
![]() |
![]() |
![]() |
#28 | Link |
Big Bit Savings Now !
Join Date: Feb 2007
Location: close to the wall
Posts: 1,401
|
Since all the sendspace links are dead now, can you put the scripts back up here in doom9 as plain code snippets ?
That would make it possible to troubleshoot & modify, and it would be nice to have them back available again.
__________________
"To bypass shortcuts and find suffering...is called QUALity" (Die toten Augen von Friedrichshain) "Data reduction ? Yep, Sir. We're working on that issue. Synce invntoin uf lingöage..." |
![]() |
![]() |
![]() |
#29 | Link |
Registered User
Join Date: May 2009
Location: Belgium
Posts: 1,741
|
Yes, here is the code that still works with a 2019 CLI MediaInfo version to add resolution in name ;
Code:
@ECHO off IF !%1==! GOTO syntax SET Work_Drive=%~d0 SET Work_PATH=%~p0 %Work_DRIVE% CD "%Work_PATH%" :loop SET in="%~1" SET in_path=%~dp1 SET in_name=%~n1 SET extension=%~x1 SET width= SET height= Set type= SET fr_mode= SET fps= FOR /F %%a in ('MediaInfo.exe "--Inform=Video;%%Width%%" %in%') DO SET width=%%a IF NOT DEFINED width GOTO next_file FOR /F %%a in ('MediaInfo.exe "--Inform=Video;%%Height%%" %in%') DO SET height=%%a FOR /F %%a in ('MediaInfo.exe "--Inform=Video;%%ScanType%%" %in%') DO SET type=%%a IF NOT DEFINED type SET type=p IF "%type%"=="Progressive" SET type=p IF "%type%"=="Interlaced" SET type=i IF "%type%"=="MBAFF" SET type=i IF "%type%"=="PAFF" SET type=i FOR /F %%a in ('MediaInfo.exe "--Inform=Video;%%FrameRate_Mode%%" %in%') DO SET fr_mode=%%a SET fr_mode=%fr_mode% IF "%fr_mode%"=="CFR" SET fr_mode= FOR /F %%a in ('MediaInfo.exe "--Inform=Video;%%FrameRate%%" %in%') DO SET fps=%%a IF NOT DEFINED fps GOTO outname :format_fps IF %fps:~-1%==0 SET fps=%fps:~0,-1%& GOTO format_fps IF %fps:~-1%==. SET fps=%fps:~0,-1% :outname SET out_name=%in_name% %width%.%height%%type%%fps%%fr_mode% REM ____________________________________________________________________________________________________________ REM Use next command to rename the source file(s), use the command after the next one to copy the source file(s) REM ____________________________________________________________________________________________________________ RENAME %in% "%out_name%%extension%" REM COPY /B %in% "%in_path%%out_name%%extension%" >NUL :next_file SHIFT IF NOT !%1==! GOTO loop GOTO :EOF :syntax CLS ECHO. ECHO. ECHO ERROR: No Input File Specified... ECHO. ECHO. ECHO. ECHO. ECHO. ECHO Syntax is: Rename_Properties.bat Input_file(s) ECHO. ECHO. ECHO You can also drag and drop or copy and paste one ECHO or multiple input file(s) on the Rename_Properties.bat file. ECHO. ECHO. ECHO Hint: Create a shortcut to Rename_Properties.bat on the desktop. ECHO Makes it easy to drop input files on the desktop icon... ECHO. ECHO. ECHO. ECHO. Echo Press a key to exit... PAUSE >nul Last edited by Music Fan; 12th June 2023 at 11:13. |
![]() |
![]() |
![]() |
#30 | Link |
Big Bit Savings Now !
Join Date: Feb 2007
Location: close to the wall
Posts: 1,401
|
Many thanks, Music Fan !
__________________
"To bypass shortcuts and find suffering...is called QUALity" (Die toten Augen von Friedrichshain) "Data reduction ? Yep, Sir. We're working on that issue. Synce invntoin uf lingöage..." |
![]() |
![]() |
![]() |
#32 | Link |
Big Bit Savings Now !
Join Date: Feb 2007
Location: close to the wall
Posts: 1,401
|
Not yet, sitting deep in repairs...
__________________
"To bypass shortcuts and find suffering...is called QUALity" (Die toten Augen von Friedrichshain) "Data reduction ? Yep, Sir. We're working on that issue. Synce invntoin uf lingöage..." |
![]() |
![]() |
![]() |
#33 | Link |
Registered User
Join Date: May 2009
Location: Belgium
Posts: 1,741
|
Hi, I made some modifications and there is a little progress.
But curiously, the code only works with ts, avi and mkv but not with mp4, mov, wmv and flv for which extension is removed ![]() Same problem with a more recent MediaInfo CLI version. Code:
@ECHO off IF !%1==! GOTO syntax SET Work_Drive=%~d0 SET Work_PATH=%~p0 %Work_DRIVE% CD "%Work_PATH%" :loop SET in="%~1" SET in_path=%~dp1 SET in_name=%~n1 SET extension= FOR /F %%a in ('MediaInfo.exe "--Inform=General;%%Format%%" %in%') DO SET Format=%%a IF NOT DEFINED Format GOTO next_file FOR /F %%a in ('MediaInfo.exe "--Inform=General;%%Format profile%%" %in%') DO SET Format profile=%%a IF "%Format%"=="MPEG-TS" SET extension=ts IF "%Format%"=="Matroska" SET extension=mkv IF "%Format%"=="Flash Video" SET extension=flv IF "%Format%"=="AVI" SET extension=avi IF "%Format%"=="MPEG-4" GOTO FormProf :FormProf IF "%Format profile%"=="Base Media" SET extension=mp4 IF "%Format profile%"=="Base Media / Version 2" SET extension=mp4 IF "%Format profile%"=="QuickTime" SET extension=MOV :outname SET out_name=%in_name% RENAME %in% "%out_name%.%extension%" REM COPY /B %in% "%in_path%%out_name%.%extension%" >NUL :next_file SHIFT IF NOT !%1==! GOTO syntax GOTO :EOF :syntax CLS ECHO. Echo Press a key to exit... PAUSE >nul |
![]() |
![]() |
![]() |
#34 | Link |
Registered User
Join Date: May 2009
Location: Belgium
Posts: 1,741
|
I still made a little modification and now the extension is not removed anymore for mp4, mov, wmv and flv files but is not corrected either, very strange
![]() Code:
@ECHO off IF !%1==! GOTO syntax SET Work_Drive=%~d0 SET Work_PATH=%~p0 %Work_DRIVE% CD "%Work_PATH%" :loop SET in="%~1" SET in_path=%~dp1 SET in_name=%~n1 SET extension=%~x1 FOR /F %%a in ('MediaInfo.exe "--Inform=General;%%Format%%" %in%') DO SET Format=%%a IF NOT DEFINED Format GOTO next_file FOR /F %%a in ('MediaInfo.exe "--Inform=General;%%Format profile%%" %in%') DO SET Formatprofile=%%a IF "%Format%"=="MPEG-TS" SET extension=.ts IF "%Format%"=="Matroska" SET extension=.mkv IF "%Format%"=="Flash Video" SET extension=.flv IF "%Format%"=="AVI" SET extension=.avi IF "%Format%"=="Windows Media" SET extension=.wmv IF "%Format%"=="MPEG-4" GOTO FormProf :FormProf IF "%Formatprofile%"=="Base Media" SET extension=.mp4 IF "%Formatprofile%"=="Base Media / Version 2" SET extension=.mp4 IF "%Formatprofile%"=="QuickTime" SET extension=.MOV :outname SET out_name=%in_name% RENAME %in% "%out_name%%extension%" REM COPY /B %in% "%in_path%%out_name%%extension%" >NUL :next_file SHIFT IF NOT !%1==! GOTO loop GOTO :EOF :syntax :syntax CLS ECHO. ECHO. ECHO ERROR: No Input File Specified... ECHO. ECHO. ECHO. ECHO. ECHO. ECHO Syntax is: rename_extension_k.bat Input_file(s) ECHO. ECHO. ECHO You can also drag and drop or copy and paste one ECHO or multiple input file(s) on the rename_extension_k.bat file. ECHO. ECHO. ECHO Hint: Create a shortcut to rename_extension_k.bat on the desktop. ECHO Makes it easy to drop input files on the desktop icon... ECHO. ECHO. ECHO. ECHO. Echo Press a key to exit... PAUSE >nul |
![]() |
![]() |
![]() |
Thread Tools | Search this Thread |
Display Modes | |
|
|