Custom Column: Media Integrity Check with ffmpeg

Discuss and share scripts and script files...
Post Reply
python80
Posts: 16
Joined: 08 Jul 2022 05:49

Custom Column: Media Integrity Check with ffmpeg

Post by python80 »

We can see media errors in a log file with ffmpeg.

My video file: file.mp4

Code: Select all

ffmpeg -v error -i file.mp4 -f null - 2>error.log
How can I see error.log in a custom column?
Also I don't want to see lines which includes "Application provided invalid, non monotonically increasing dts to muxer in stream 0:".
Can we delete them with regular expressions?

Maybe like this:

Code: Select all

"^.*Application provided invalid, non monotonically increasing dts to muxer in stream 0.*$"

Code: Select all

(?-is)^(?=.*Application provided invalid, non monotonically increasing dts to muxer in stream 0).+\R
Is it possible?

Thanks for reading, sorry for bad English.

highend
Posts: 13333
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Custom Column: Media Integrity Check with ffmpeg

Post by highend »

Possible? Sure

But running ffmpeg over every file will be slow...

Apart from that:
runret()
regexreplace()
One of my scripts helped you out? Please donate via Paypal

python80
Posts: 16
Joined: 08 Jul 2022 05:49

Re: Custom Column: Media Integrity Check with ffmpeg

Post by python80 »

highend wrote: 13 Oct 2023 23:56 Possible? Sure

But running ffmpeg over every file will be slow...
Yes, I know it. ffmpeg will check media completely.
highend wrote: 13 Oct 2023 23:56 Apart from that:
runret()
regexreplace()
I can't do it. :(
How should the script be?

highend
Posts: 13333
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Custom Column: Media Integrity Check with ffmpeg

Post by highend »

Provide a .mp4 file (upload it on google drive, dropbox...) with errors and post the link
One of my scripts helped you out? Please donate via Paypal

python80
Posts: 16
Joined: 08 Jul 2022 05:49

Re: Custom Column: Media Integrity Check with ffmpeg

Post by python80 »

highend wrote: 14 Oct 2023 00:13 Provide a .mp4 file (upload it on google drive, dropbox...) with errors and post the link
https://drive.google.com/file/d/1c5TqlW ... sp=sharing

Code: Select all

X:\ffmpeg\x64>ffmpeg -v error -i "X:\S01EP01_Corrupt.mp4" -f null - 2>error.log
error.log:

Code: Select all

[h264 @ 000001d746536080] illegal short term buffer state detected
[h264 @ 000001d746545840] illegal short term buffer state detected
[h264 @ 000001d746545840] co located POCs unavailable
[h264 @ 000001d7465477c0] mmco: unref short failure
[null @ 000001d746a10540] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 600 >= 600
[h264 @ 000001d746535780] reference picture missing during reorder
[h264 @ 000001d746535780] Missing reference picture, default is 65674
[h264 @ 000001d746535c00] reference picture missing during reorder
[h264 @ 000001d746535c00] Missing reference picture, default is 65696
[h264 @ 000001d746536080] reference picture missing during reorder
[h264 @ 000001d746536080] Missing reference picture, default is 65698

highend
Posts: 13333
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Custom Column: Media Integrity Check with ffmpeg

Post by highend »

Adapt the path to ffmpeg and the folder where the logs should be stored

Code: Select all

$ffmpeg    = "D:\Tools\@Command Line Tools\yt-dlp\ffmpeg\bin\ffmpeg.exe";
    $logPath   = "D:\Temp";
    $base      = gpc(<cc_item>, "base");
    $logFile   = trim($logPath, "\", "R") . "\" . $base . ".log";
    $batchFile = "%TEMP%\~xy_ffmpeg.bat";

    $batchContent = lax("$ffmpeg" -v error -i "<cc_item>" -f null - 2>"$logFile");
    writefile($batchFile, $batchContent, , "utf8");
    run "$batchFile", "%TEMP%", 2, 0;

    $content = "";
    if (exists($logFile) == 1) {
        $content = readfile($logFile, , , 65001);
        $content = regexreplace($content, "^.*?Application provided invalid, non monotonically increasing dts to muxer in stream.*?(\r?\n|$)");
    }
    return $content;
I would set the trigger to "Click" for the definition of the custom column but ofc it's your choice...
Item filter should be set to only video file types you'd like to check
2023-10-14_080910.png
2023-10-14_080910.png (28.39 KiB) Viewed 592 times
One of my scripts helped you out? Please donate via Paypal

Post Reply