Get Video Duration

  • I have an Excel list of videos that are all stored in one folder (G:\Video\Special)

    I am trying to find a way that will go down the list of names in Excel, find the duration of the video in the file, and list it next to the file name in Excel. At current count, there are over 850 files in that one folder.

  • I have attached a generic file lister that may be more than you need but it will derive a list of video files and a bunch of related information like duration, aspect ratio, etc etc. It can also be used to list eg image files, audio files or just as a general file lister (depending on what you value select in the "Extra Data to Show" drop list).


    It takes as input the folder that contains the files to be listed and the folder where you want to write the output file to. For video files, the output filename is in the format of Video List dd-mm-yy.xlsx


    There is one small catch to this. It requires the MediaInfo DLL to extract the metadata from the files. More specifically, it requires the 32bit version of the DLL (the macro is only written for 32 bit version of Excel).

    The 32 bit MediaInfo DLL for Windows can be obtained from here: https://mediaarea.net/en/MediaInfo/Download/Windows


    Best to just grab the DLL file in zip format as you will need to place this file on the windows path somewhere (eg: C:\Windows\System32). Also, the file needs to be renamed to MediaInfo32.DLL to work with this macro (to avoid confusion in case you have the 64 bit version of the MediaInfo GUI installed).


    If you want to place the file in another folder, you will need to modify the MediaInfoLibDLL class module and adjust all the declarations eg:

    From:

    Code
    Private Declare PtrSafe Function MediaInfo_New Lib "MediaInfo32.dll" () As LongPtr

    To:

    Code
    Private Declare PtrSafe Function MediaInfo_New Lib "C:\Temp\MediaInfo32.dll" () As LongPtr


    If you're comfortable doing that, this will provide a decent list of file details.


    There are a bunch of other options that you can play around with but hopefully most of them are self-evident.


    ListFiles v2.5.xlsb

  • I found this some time ago, but I can't locate where now. I've not tried it


  • Thank you for your suggestions. I found an app that does it for me. It works on 64 bit and gives me detailed h:mm:ss.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!