Page 1 of 1

Column MediaInfo

Posted: 05 Mar 2026 18:44
by DarKHawK
Hi,

I have a lot of video files that may contain slop data.
I need to create a column that subtracts video stream size and audio stream size from total file size.
Tried Ai and it failed miserably.

Thank you.

Re: Column MediaInfo

Posted: 05 Mar 2026 20:24
by highend

Code: Select all

    $filePath = <cc_item>;
    $fileSize = filesize($filePath);

    $mediaInfo = "<xydrive>\Tools\@CLI Tools\MediaInfo\MediaInfo.exe";
    $result    = runret("""$mediaInfo"" --Inform=file://D:\all_streams.txt ""$filePath""");

    $sizeTotal = 0;
    foreach($line, $result, <crlf>, "e") {
        $size = gettoken($line, 2, ":", "t");
        if ($size) { $sizeTotal += $size; }
    }
    if ($sizeTotal) { return formatbytes($fileSize - $sizeTotal); }
    return "---";
While D:\all_streams.txt contains:

Code: Select all

Video;Video:%StreamSize%\r\n
Audio;Audio:%StreamSize%\r\n

Re: Column MediaInfo

Posted: 05 Mar 2026 20:52
by DarKHawK
Thanks for the reply.

It returns ---

If I run \MediaInfo.exe" --Inform=file://D:\all_streams.txt "filename.mp4"
It returns:
Video:739649416
Audio:22230207

Edit:

Sorry, my bad, some files have "Source stream size" instead of "Stream size"

Thanks a lot