VideoHelp Forum




+ Reply to Thread
Results 1 to 6 of 6
  1. H* ***s

    please I wonder if is possible to do a batch that calculate the total duration of a variable number of video files that are in a folder

    Quote Quote  
  2. thanks *** but seems don't recognize .MXF files, and possibly I need to put the value in a enviroment variable.

    Maybe with ffprobe? but I'm not able
    Quote Quote  
  3. Something like this:

    Code:
    @echo off
    SET Mediainfo="G:\Program Files\MediainfoCLI\Mediainfo.exe"
    set /A total_milliseconds=0
    for %%F in (*.mxf) do (call :RUNTIME1 "%%F")
    echo.
    echo Total milliseconds = %total_milliseconds%
    echo.
    pause
    exit 0
    
    :RUNTIME1
    
    set /A duration_milliseconds=0
    %Mediainfo% --Inform=Video;%%Duration%% %1 > temp.tmp
    set /p duration_milliseconds=<temp.tmp
    echo %1 : %duration_milliseconds% milliseconds
    set /A total_milliseconds=%total_milliseconds%+%duration_milliseconds%
    EXIT /B
    Quote Quote  
  4. Member
    Join Date
    Aug 2010
    Location
    San Francisco, California
    Search PM
    Here's a way to do it with ExifTool, assuming exiftool.exe is in your search path. totSecs will give you total seconds and totalDuration will give total formatted time.

    Code:
    @echo off
    set /p targDir=Target directory: 
    cd /d %targDir%
    set totSecs=0
    for %%F in (*.*) do (
    	for /f "tokens=1-3 delims=: usebackq" %%X in (`exiftool -duration -s3 "%%F"`) do (
    		set /a "totSecs += %%X*3600 + (1%%Y %% 100)*60 + (1%%Z %% 100)"
    	)
    )
    set /a hours=%totSecs%/3600
    set /a mins=(%totSecs% %% 3600)/60
    set /a secs=%totSecs% %% 60
    set totalDuration=%hours%:%mins%:%secs%
    Quote Quote  
  5. ********************************
    Image
    [Attachment 42376 - Click to enlarge]
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!