/usr/share/doc/libvideo-fourcc-info-perl/examples/peekvideo.pl is in libvideo-fourcc-info-perl 1.005-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | #!/usr/bin/perl
# bin/peekvideo
# Determine information about a given media file
#
# $Id: peekvideo.pl 9530 2009-10-04 04:37:16Z FREQUENCY@cpan.org $
use strict;
use warnings;
use Pod::Usage;
use Video::Info;
use Video::FourCC::Info;
=head1 NAME
peekvideo - determine a codec used by a given file
=head1 VERSION
Version 1.1 ($Id: peekvideo.pl 9530 2009-10-04 04:37:16Z FREQUENCY@cpan.org $)
=cut
use version; our $VERSION = qv('1.1');
=head1 SYNOPSIS
Usage: peekvideo.pl filename [...]
Given a single path referring to a file containing video data, this script
will determine the codec required for the media to play.
=head1 DESCRIPTION
This is a simple script that determines information such as the common name
of the codec required for the given media to play. It is convenient to use
for troubleshooting video files that do not play for one reason or another.
=cut
my @files = @ARGV;
# if no parameters are passed, give usage information
unless (@files) {
pod2usage(msg => 'Please supply at least one filename to analyze');
exit();
}
foreach my $file (@files) {
my $video;
eval {
$video = Video::Info->new(-file => $file);
};
if ($@) {
printf {*STDERR} "Problem determining information about '%s':\n", $file;
print 'In Video::Info: ', $@;
next;
}
# Check if we have a FourCC
unless (length($video->vcodec) == 4) {
printf {*STDERR} "Video::Info returns '%s', which is not a FourCC\n",
$video->vcodec;
next;
}
my $codec;
eval {
$codec = Video::FourCC::Info->new($video->vcodec);
};
if ($@) {
printf {*STDERR} "Codec '%s' is unregistered or unknown\n",
$video->vcodec;
next;
}
printf "File '%s' uses codec '%s': \n", $file, $video->vcodec;
# Check if we have description entity information
if (defined $codec->description) {
printf " Description: %s\n", $codec->description;
}
# Check if we have owner entity information
if (defined $codec->owner) {
printf " Registered by: %s\n", $codec->owner;
}
# Check if we have registration date information
if (defined $codec->registered) {
print ' Registered on: ';
if (ref($codec->registered)) {
## no critic(ProhibitNoisyQuotes)
# this is incorrectly reported as a noisy quote
print $codec->registered->ymd('-');
}
else {
print $codec->registered;
}
print "\n";
}
# Other information from Video::Info
printf " Dimensions: %d x %d\n", $video->width, $video->height;
printf " Duration: %s\n", $video->MMSS;
printf " Picture: %d frames at %.2f frames/sec\n",
$video->vframes, $video->fps;
printf " Audio: %s, %d kbps at %d Hz\n", $video->acodec,
$video->arate / 1000, $video->afrequency;
}
=head1 AUTHOR
Jonathan Yu E<lt>jawnsy@cpan.orgE<gt>
=head1 SUPPORT
For support details, please look at C<perldoc Video::FourCC::Info> and
use the corresponding support methods.
=head1 LICENSE
This has the same copyright and licensing terms as L<Video::FourCC::Info>.
=head1 SEE ALSO
L<Video::Info>,
L<Video::FourCC::Info>
=cut
|