M
M
MusicMan_082014-11-21 09:25:20
Video processing
MusicMan_08, 2014-11-21 09:25:20

Mediainfo script?

There is a Windows computer, it has a folder with video files (about 30 TB). Mostly files of the same type (codec, resolution, etc.), but there are about 10 files that have a different resolution. Decided to use mediainfo to identify these wrong files. The script looks like this:

set mediainfo=C:\Program Files\MediaInfo\CLI\MediaInfo.exe
set input_folder=C:\test_videos

For %%x in ("%input_folder%\*.*") Do (
"%mediainfo%" --Inform=General;%%FileName%%, "%%~x">>"C:\test_videos\output.csv"
"%mediainfo%" --Inform=Video;%%Width%%:%%Height%%, "%%~x">>"C:\test_videos\output.csv"
)

But I ran into a very slow script, as it writes the name of the clip in csv first, then the video resolution, and so on for each file. Please help me to remake the script so that only information on incorrect files is written to the csv file. Or maybe someone will suggest a faster and more correct way?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
3
386DX, 2014-11-21
@386DX

View search plugins of Total Commander, as a rule, there are settings for searching metadata in files

S
Sergey Lerg, 2014-11-21
@Lerg

Here is a bash script that will be slightly faster

#!/bin/sh

normalRes="1920x1080"
dir=$1

for f in $(find $dir -name "*.*"); do
  res="$(mediainfo '--Inform=Video;%Width%x%Height%' $f)"
  if [ "$res" != "$normalRes" ]; then
    echo $f
  fi
done

I don't know how to convert it to windows, but you can install cygwin. In normalRes you write the resolution of most files, the output will be the names of those files whose resolution is different from this value.
In the parameters to the script, the directory in which to search is passed.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question