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. Domains: forum.doom9.org / forum.doom9.net / forum.doom9.se |
|
|
#1 | Link |
|
brontosaurusrex
Join Date: Oct 2001
Posts: 2,392
|
mediainfo from batch
if i run mediainfo.exe (winxp) from cli:
mediainfo --Inform=General;%Duration/String3% del01.wav it will nicely return: 00:03:25.160 --- how to use that as batch?, example: test.bat mediainfo --Inform=General;%Duration/String3% %1 so i would run as: test del01.wav (nothing is working, escaping with carrots, escaping with %, nothing...)
__________________
certain other member |
|
|
|
|
|
#4 | Link |
|
Skittle
Join Date: Mar 2008
Posts: 539
|
I just made this script, it works exactly as it should
Code:
set file="E:\Movies\BeerFest.mkv" set mediainfo="C:\Program Files (x86)\StaxRip\Applications\MediaInfo\mediainfo\mediainfo.exe" %mediainfo% --Inform=General;%%Duration/String3%% %file% pause Code:
01:56:26.146 You can also parse the output using "for /f" Can you post your script? Last edited by RunningSkittle; 22nd July 2008 at 18:46. |
|
|
|
|
|
#6 | Link | |
|
Registered User
Join Date: Mar 2008
Posts: 93
|
Quote:
looks good - hope it helps the guy/gal out |
|
|
|
|
|
|
#7 | Link |
|
brontosaurusrex
Join Date: Oct 2001
Posts: 2,392
|
i still don't get it how %% didn't work for me, it is working now, shrug, here is what i did now:
main, audiodur.bat Code:
@echo off t:\path\mediainfo --Inform=General;%%Duration/String3%% %1 > t:\tmp\tmpdur.txt set /P somestring=<t:\tmp\tmpdur.txt del t:\tmp\tmpdur.txt :: drop ms part of the string ::set somestring=%somestring:~0,-4% echo %somestring% %~n1%~x1 Code:
@ECHO OFF for /f "delims=+++++" %%i in (%1) DO t:\path\audiodur.bat "%%i" >>durlist.txt
__________________
certain other member Last edited by smok3; 23rd July 2008 at 08:36. |
|
|
|
|
|
#8 | Link |
|
Skittle
Join Date: Mar 2008
Posts: 539
|
To avoid creating a temporary file, use the "usebackq" option
Code:
@echo off set file="D:\Movies\BeerFest.mkv" set mediainfo="C:\mediainfo\mediainfo.exe" for /f "usebackq" %%a in (`"%mediainfo% --Inform=General;%%Duration/String3%% %file%"`) do set duration=%%a echo %duration% pause |
|
|
|
|
|
#9 | Link | |
|
brontosaurusrex
Join Date: Oct 2001
Posts: 2,392
|
total commander with option %L provides ascii file-list (one file per line) and then i loop thought those (this list is the list of files selected in active pane of the total commander gui).
Quote:
__________________
certain other member Last edited by smok3; 23rd July 2008 at 13:47. |
|
|
|
|
|
|
#10 | Link |
|
Skittle
Join Date: Mar 2008
Posts: 539
|
"usebackq", use-back-quotes lets "for /f" parse the output of a command in a "back quoted" string. for example
Code:
for /f "usebackq" %%a in `"command"` do echo %%a in this case, it parses the output of "%mediainfo% --Inform=General;%%Duration/String3%% %file%" This is useful because you cant do: Code:
set duration="%mediainfo% --Inform=General;%%Duration/String3%% %file%"
Last edited by RunningSkittle; 23rd July 2008 at 14:11. |
|
|
|
|
|
#12 | Link |
|
Registered User
Join Date: Mar 2005
Location: Portugal
Posts: 908
|
hi everyone
can anyone tell me how to parse/retrieve the framerate from a video file? i have a semi automatic script that at the end uses mp4box to mux 264+aac into mp4 container but it needs to know the fps. is this possible? |
|
|
|
|
|
#13 | Link |
|
Registered User
Join Date: Feb 2002
Location: Berlin, Germany
Posts: 23
|
The following example works for me:
Code:
set mediainfo_exe=c:\Programme\MediaInfo_CLI_0.7.11\MediaInfo.exe set mp4box_exe=C:\Programme\mp4box\MP4Box.exe set inputvideo=C:\tmp\fps_test.264 set outputvideo=C:\tmp\fps_test_muxed.mp4 "%mediainfo_exe%" --Inform=Video;%%FrameRate%% "%inputvideo%" > "analyze.txt" set /p video_fps=<"analyze.txt" del "analyze.txt" "%mp4box_exe%" -add "%inputvideo%" -fps %video_fps% -new "%outputvideo%" |
|
|
|
|
|
#15 | Link |
|
Registered User
Join Date: Mar 2003
Posts: 191
|
Apologies in bumping such a really old post, but I am trying to achieve something similar but don't understand enough about the syntax.
I want to create a csv file which contains a breakdown of a folder's filenames, durations and filesizes. I can get as far as: Code:
mediainfo.exe "--Inform=General;%FileName%,%Duration/String%,%FileSize%" <PATH TO A FILE> >e:\output.csv Many Thanks for any pointers! |
|
|
|
|
|
#16 | Link |
|
Registered User
Join Date: Feb 2002
Location: Berlin, Germany
Posts: 23
|
Hi dvdboy,
This is a really helpful site. And here a two working examples from a .bat file: Example 1 - analyzes all files in a directory Code:
set mi_exe=C:\tmp\MediaInfo_CLI_0.7.59_Windows_i386\MediaInfo.exe
set input_folder=C:\test_videos
For %%x in ("%input_folder%\*.*") Do (
"%mi_exe%" --Inform=General;%%FileName%%,%%Duration/String%%,%%FileSize%% "%%~x">>"E:\output.csv"
)
Code:
set mi_exe=C:\tmp\MediaInfo_CLI_0.7.59_Windows_i386\MediaInfo.exe
set input_folder=C:\test_videos
For /R "%input_folder%" %%x in ("*.*") Do (
"%mi_exe%" --Inform=General;%%FileName%%,%%Duration/String%%,%%FileSize%% "%%~x">>"E:\output.csv"
)
Please note that in a .bat file you have to add another "%" to the MediaInfo-Informstring, so "%Duration/String%" becomes "%%Duration/String%%". With the redirect symbol ">>" the Info from MediaInfo for a single file will be appended to the file "E:\output.csv". |
|
|
|
|
|
#18 | Link | |
|
Registered User
Join Date: Dec 2014
Posts: 7
|
Quote:
%%a doesn't seem to contain anything for me Code:
%mediainfo% --Inform=General;%%Duration/String3%% %file% |
|
|
|
|
|
|
#19 | Link |
|
Registered User
Join Date: Jun 2002
Location: On thin ice
Posts: 6,854
|
with powershell it looks like so:
Code:
PS D:\Video> get-mediainfo D:\Temp\Video\Eli.mp4 | select -ExpandProperty Duration_String3 00:00:43.420 PS D:\Video> $duration = get-mediainfo D:\Temp\Video\Eli.mp4 | select -ExpandProperty Duration_String3 PS D:\Video> $duration 00:00:43.420
__________________
https://github.com/stax76/software-list https://www.youtube.com/@stax76/playlists |
|
|
|
![]() |
|
|