4
How to check automatically and customizable via Shell/Programming Language the integrity (file Incomplete/Corrupted) of video files (.avi
, .mp4
, .mkv
among others) ?
OBS: Having as limiting factor the lack of a HASH prior files.
4
How to check automatically and customizable via Shell/Programming Language the integrity (file Incomplete/Corrupted) of video files (.avi
, .mp4
, .mkv
among others) ?
OBS: Having as limiting factor the lack of a HASH prior files.
5
Since there is no HASH prior (when there was certainty of the state of the file) it is necessary to use a Third Party program FFMPEG and a script executed via Powershell
that automates the execution of checking the video files of a given folder:
Script:
$logPath = "C:\Users\User\projeto1\error.log"
$videosFolder = "C:\Users\User\videos"
$ffmpegPath = "C:\ffmpeg\bin\ffmpeg.exe"
$arquivos = Get-ChildItem -path $videosFolder |
Where-Object {
($_.extension -eq ".mp4" -or $_.extension -eq ".mkv")
}
foreach($item in $arquivos){
"+#+#+ " + $item.FullName >> $logPath
&$ffmpegPath -v error -i $item.FullName -f null 2 >> $logPath 2>&1
}
FFMPEG
and where the LOG file will be created with the errors of each video.mp4
and .mkv
)FFMPEG
passing some control parameters such as how verbose the check should be.Notes:
The check is frame by frame so the errors are by frame.
It was arranged so that errors were printed below the file name. (There may be no errors, or there may be several errors in each frame which generates a huge Log file).
NEVER let the errors be displayed in the default output, always leave to be stored in the Log file.
I added a string +#+#+ differentiated at the beginning of each file path to facilitate the search.
Test Data:
4 files have been tested:
Test time:
Log file size: 19 MB
Browser other questions tagged video powershell ffmpeg
You are not signed in. Login or sign up in order to post.
I changed the title, because automatic and customizable are already practically "embedded" within the "programming"
– Guilherme Nascimento
No preblema @Guilhermenascimento
– Ricardo