Posts mit dem Label tracks werden angezeigt. Alle Posts anzeigen
Posts mit dem Label tracks werden angezeigt. Alle Posts anzeigen

Freitag, 14. Juni 2013

Validating audio and subtitle track availability in collections

Archiving a full set of episodes of a TV-series has some challenges: missing episodes, bad quality, recording issues - and language and subtitles. You may have missed one episode on your preferred HDTV channel and got one in SD lacking subtitles and original language.

Below script (yes, I know it's ugly) will dump language information for audio tracks and subtitle tracks from a MKV file in a sorted order. This allows a quick and easy check if your archived episodes have all the same language information.

#!/usr/bin/perl

while (<>) {
last unless /\S/;
$lines .= $_;
}

@tracks = split /A track/, $lines;

@audiotracks = grep/type: audio/, @tracks;
@subtracks = grep /type: subtitles/, @tracks;

foreach (@audiotracks) {
push(@atracks, $1) if / Language: (\w{3})/;
}
foreach (@subtracks) {
push(@stracks, $1) if / Language: (\w{3})/;
}

print "Audiotracks:\t";
foreach (sort(@atracks)) {
print "$_ ";
}
print "\n";

print "Subtitles:\t";
foreach (sort(@stracks)) {
print "$_ ";
}
print "\n";
Save this file as /usr/bin/mkvinfo.pl and make it executable. Move to the folder holding the archived MKV recordings and use a simple wrapper script:

for i in *.mkv; do
        echo "Checking $i"
        mkvinfo "$i" | /usr/bin/mkvinfo.pl
done
 
As result you will get a list of filenames (your mkv files) and indented a list of audio and subtitles tracks. By visual comparison you can easily spot a missing track and re-record that episode with a Record task in MythTV.