Audit your media files

Here is a little script you can use to audit all of your media files. Note you will need to get the Perl modules installed first which is pretty straight forward using cpan. Note that the mediainfo module does require that the mediainfo libraries are installed first. Note I ran this on Centos 5.

#!/usr/bin/perl

use File::DirWalk;

use Mediainfo;

my $dw = new File::DirWalk;

        print “filename, video_format, video_length, video_bitraten”;

        $dw->onFile(sub {

                my ($file) = @_;

                my ($ext) = $file =~ /(.[^.]+)$/;

                if ($ext eq “.mp4” or $ext eq “.wmv” or $ext eq “.ts” or $ext eq “.mov”) {

                        my $info = new Mediainfo(“filename” => $file);

                        print “$file, “;

                        print $info->{video_format}, “, “;

                        print $info->{video_length}, “, “;

                        print $info->{video_bitrate}, “, “;

                        print “n”;

                }

                return File::DirWalk::SUCCESS;

        });

$dw->walk($ARGV[0]);

exit;

Bookmark the permalink.

Comments are closed.