Page 1 of 1
Custom Column: Media Integrity Check with ffmpeg
Posted: 13 Oct 2023 22:53
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.
Re: Custom Column: Media Integrity Check with ffmpeg
Posted: 13 Oct 2023 23:56
by highend
Possible? Sure
But running ffmpeg over every file will be slow...
Apart from that:
runret()
regexreplace()
Re: Custom Column: Media Integrity Check with ffmpeg
Posted: 14 Oct 2023 00:11
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?
Re: Custom Column: Media Integrity Check with ffmpeg
Posted: 14 Oct 2023 00:13
by highend
Provide a .mp4 file (upload it on google drive, dropbox...) with errors and post the link
Re: Custom Column: Media Integrity Check with ffmpeg
Posted: 14 Oct 2023 01:09
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
Re: Custom Column: Media Integrity Check with ffmpeg
Posted: 14 Oct 2023 08:07
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
Re: Custom Column: Media Integrity Check with ffmpeg
Posted: 06 Oct 2025 09:15
by Native2904
@Highend
Hello, I discovered this script and wanted to give it a try... to check films before uploading them to the NAS and avoid any nasty surprises.
Even though the script wasn't for me, could you have a look and see if you can find any errors?
I don't really trust ChatGPT when it comes to XY and its scripts.
Code: Select all
[in#0] Error opening input: Invalid argument
Error opening input file .
Error opening input files: Invalid argument
XYplorer_VcMJsJrMey.jpg
This is the adjusted script:
Code: Select all
$ffmpeg = "c:\Youtube\ffmpeg.exe";
$logPath = "c:\Youtube\Log\";
$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;
Being ignorant, I thought that perhaps it was because I wasn't saving the log data in the folder:
and that the script was then colliding with this line:
Code: Select all
$batchFile = ‘%TEMP%\~xy_ffmpeg.bat’;
?
Re: Custom Column: Media Integrity Check with ffmpeg
Posted: 06 Oct 2025 09:36
by highend
Show the content of %TEMP%\~xy_ffmpeg.bat
Re: Custom Column: Media Integrity Check with ffmpeg
Posted: 06 Oct 2025 11:07
by Native2904
Sry, but %TEMP% means C:\Windows\Temp ?
Nothing is created in this regard.
Tempordner.jpg
XYplorer_PkD847wUJR.jpg
Re: Custom Column: Media Integrity Check with ffmpeg
Posted: 06 Oct 2025 11:26
by highend
Just enter it into XY's address bar and hit enter:
%TEMP%\~xy_ffmpeg.bat
Re: Custom Column: Media Integrity Check with ffmpeg
Posted: 06 Oct 2025 11:35
by Native2904
Re: Custom Column: Media Integrity Check with ffmpeg
Posted: 06 Oct 2025 11:37
by Native2904
highend wrote: ↑06 Oct 2025 11:26
Just enter it into XY's address bar and hit enter:
%TEMP%\~xy_ffmpeg.bat
"c:\Youtube\ffmpeg.exe" -v error -i "C:\Users\Home\Downloads\S01EP01_Corrupt.mp4" -f null - 2>"C:\Windows\Temp\S01EP01_Corrupt.log"