| 1 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | =encoding utf8 | ||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | =head1 NAME | ||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | Quiq::File::Video - Informationen über Video-Datei | ||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | =head1 BASE CLASS | ||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | L<Quiq::Hash> | ||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | =cut | ||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | package Quiq::File::Video; | ||||||||||||||||||||||||||||
| 18 | 4 | ▶ | use base qw/Quiq::Hash/; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | 4 | ▶ | use v5.10; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 21 | 4 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 22 | 4 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | 4 | our $VERSION = '1.240'; | |||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | 4 | ▶ | use Quiq::Option; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 27 | 4 | ▶ | use Quiq::Ipc; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 28 | 4 | ▶ | use Quiq::Formatter; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | =head1 METHODS | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | =head2 Konstruktor | ||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | =head3 new() - Instantiiere Video-Datei-Objekt | ||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | =head4 Synopsis | ||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | $vid = $class->new($file,@opt); | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | =head4 Options | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | =over 4 | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | =item -verbose => $bool (Default: 1) | ||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | Gib das ffprobe-Kommando auf STDOUT aus. | ||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | =back | ||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | =head4 Description | ||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | Instantiiere ein Video-Datei-Objekt und liefere eine Referenz auf | ||||||||||||||||||||||||||||
| 55 | dieses Objekt zurück. | ||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | =cut | ||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 62 | 0 | my ($class,$file) = @_; | |||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | # Optionen | ||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | 0 | my $verbose = 1; | |||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | 0 | Quiq::Option->extract(\@_, | |||||||||||||||||||||||||||
| 69 | -verbose => \$verbose, | ||||||||||||||||||||||||||||
| 70 | ); | ||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||
| 72 | # Objekt instantiieren | ||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||
| 74 | 0 | return $class->SUPER::new( | |||||||||||||||||||||||||||
| 75 | file => $file, | ||||||||||||||||||||||||||||
| 76 | verbose => $verbose, | ||||||||||||||||||||||||||||
| 77 | width => undef, | ||||||||||||||||||||||||||||
| 78 | height => undef, | ||||||||||||||||||||||||||||
| 79 | aspectRatio => undef, | ||||||||||||||||||||||||||||
| 80 | bitrate => undef, | ||||||||||||||||||||||||||||
| 81 | framerate => undef, | ||||||||||||||||||||||||||||
| 82 | duration => undef, | ||||||||||||||||||||||||||||
| 83 | frames => undef, | ||||||||||||||||||||||||||||
| 84 | ); | ||||||||||||||||||||||||||||
| 85 | } | ||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||
| 87 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||
| 89 | =head2 Eigenschaften | ||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||
| 91 | =head3 file() - Dateiname | ||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||
| 93 | =head4 Synopsis | ||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||
| 95 | $file = $vid->file; | ||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||
| 97 | =head4 Description | ||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||
| 99 | Liefere den Dateinamen (Pfad) der Video-Datei. | ||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||
| 101 | =head3 width() - Breite | ||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||
| 103 | =head4 Synopsis | ||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||
| 105 | $width = $vid->width; | ||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||
| 107 | =head4 Description | ||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||
| 109 | Liefere die Breite des Video in Pixeln, z.B. 1920. | ||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||
| 111 | =cut | ||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||
| 113 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||
| 115 | 0 | ▶ | sub width { | ||||||||||||||||||||||||||
|
Subroutine
width: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 116 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||
| 118 | 0 | ▶ | return $self->memoize('width',sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 119 | 0 | my ($self,$key) = @_; | |||||||||||||||||||||||||||
| 120 | 0 | $self->analyzeFile; | |||||||||||||||||||||||||||
| 121 | 0 | return $self->get($key); | |||||||||||||||||||||||||||
| 122 | 0 | }); | |||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||
| 125 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||
| 127 | =head3 height() - Höhe | ||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||
| 129 | =head4 Synopsis | ||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||
| 131 | $height = $vid->height; | ||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||
| 133 | =head4 Description | ||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||
| 135 | Liefere die Höhe des Video in Pixeln, z.B. 1080. | ||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||
| 137 | =cut | ||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||
| 139 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||
| 141 | 0 | ▶ | sub height { | ||||||||||||||||||||||||||
|
Subroutine
height: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 142 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||
| 144 | 0 | ▶ | return $self->memoize('height',sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 145 | 0 | my ($self,$key) = @_; | |||||||||||||||||||||||||||
| 146 | 0 | $self->analyzeFile; | |||||||||||||||||||||||||||
| 147 | 0 | return $self->get($key); | |||||||||||||||||||||||||||
| 148 | 0 | }); | |||||||||||||||||||||||||||
| 149 | } | ||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||
| 151 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||
| 153 | =head3 size() - Breite und Höhe | ||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||
| 155 | =head4 Synopsis | ||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||
| 157 | ($width,$height) = $vid->size; | ||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||
| 159 | =head4 Description | ||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||
| 161 | Liefere die Breite und Höhe des Video in Pixeln, z.B. (1920,1080). | ||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||
| 163 | =cut | ||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||
| 165 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||
| 167 | 0 | ▶ | sub size { | ||||||||||||||||||||||||||
|
Subroutine
size: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 168 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 169 | 0 | return ($self->width,$self->height); | |||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||
| 172 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||
| 174 | =head3 aspectRatio() - Seitenverhältnis | ||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||
| 176 | =head4 Synopsis | ||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||
| 178 | $aspectRatio = $vid->aspectRatio; | ||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||
| 180 | =head4 Description | ||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||
| 182 | Liefere das Seitenverhältnis des Video, z.B. '16:9'. | ||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||
| 184 | =cut | ||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||
| 186 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||
| 188 | 0 | ▶ | sub aspectRatio { | ||||||||||||||||||||||||||
|
Subroutine
aspectRatio: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 189 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||
| 191 | 0 | my $width = $self->width; | |||||||||||||||||||||||||||
| 192 | 0 | my $height = $self->height; | |||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||
| 194 | 0 | ▶ | if ($width/16*9 == $height) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 195 | 0 | return '16:9'; | |||||||||||||||||||||||||||
| 196 | } | ||||||||||||||||||||||||||||
| 197 | elsif ($width/4*3 == $height) { | ||||||||||||||||||||||||||||
| 198 | 0 | return '4:3'; | |||||||||||||||||||||||||||
| 199 | } | ||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||
| 201 | 0 | return $width/$height; | |||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||
| 204 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||
| 206 | =head3 bitrate() - Bitrate | ||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||
| 208 | =head4 Synopsis | ||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||
| 210 | $bitrate = $vid->bitrate; | ||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||
| 212 | =head4 Description | ||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||
| 214 | Liefere die Bitrate des Video in Kilobit (kb/s), z.B. 30213. | ||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||
| 216 | =cut | ||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||
| 218 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||
| 220 | 0 | ▶ | sub bitrate { | ||||||||||||||||||||||||||
|
Subroutine
bitrate: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 221 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||
| 223 | 0 | ▶ | return $self->memoize('bitrate',sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 224 | 0 | my ($self,$key) = @_; | |||||||||||||||||||||||||||
| 225 | 0 | $self->analyzeFile; | |||||||||||||||||||||||||||
| 226 | 0 | return $self->get($key); | |||||||||||||||||||||||||||
| 227 | 0 | }); | |||||||||||||||||||||||||||
| 228 | } | ||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||
| 230 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||
| 232 | =head3 duration() - Dauer | ||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||
| 234 | =head4 Synopsis | ||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||
| 236 | $duration = $vid->duration; | ||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||
| 238 | =head4 Description | ||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||
| 240 | Liefere die Dauer des Video in Sekunden (millisekundengenau), | ||||||||||||||||||||||||||||
| 241 | z.B. 8.417. | ||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||
| 243 | =cut | ||||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||
| 245 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||
| 247 | 0 | ▶ | sub duration { | ||||||||||||||||||||||||||
|
Subroutine
duration: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 248 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||
| 250 | 0 | ▶ | return $self->memoize('duration',sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 251 | 0 | my ($self,$key) = @_; | |||||||||||||||||||||||||||
| 252 | 0 | $self->analyzeFile; | |||||||||||||||||||||||||||
| 253 | 0 | return $self->get($key); | |||||||||||||||||||||||||||
| 254 | 0 | }); | |||||||||||||||||||||||||||
| 255 | } | ||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||
| 257 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||
| 259 | =head3 frames() - Anzahl Frames | ||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||
| 261 | =head4 Synopsis | ||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||
| 263 | $frames = $vid->frames; | ||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||
| 265 | =head4 Description | ||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||
| 267 | Liefere die Anzahl der Frames des Video, z.B. 101. | ||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||
| 269 | =cut | ||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||
| 271 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||
| 273 | 0 | ▶ | sub frames { | ||||||||||||||||||||||||||
|
Subroutine
frames: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 274 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||
| 276 | 0 | ▶ | return $self->memoize('frames',sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 277 | 0 | my ($self,$key) = @_; | |||||||||||||||||||||||||||
| 278 | 0 | $self->analyzeFile; | |||||||||||||||||||||||||||
| 279 | 0 | return $self->get($key); | |||||||||||||||||||||||||||
| 280 | 0 | }); | |||||||||||||||||||||||||||
| 281 | } | ||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||
| 283 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||
| 285 | =head2 Interne Methoden | ||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||
| 287 | =head3 analyzeFile() - Analysiere Video-Datei | ||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||
| 289 | =head4 Synopsis | ||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||
| 291 | $vid->analyzeFile; | ||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||
| 293 | =head4 Description | ||||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||
| 295 | Analysiere die Video-Datei mit ffprobe und weise die ermittelten | ||||||||||||||||||||||||||||
| 296 | Eigenschaften an die Attribute des Objektes zu. | ||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||
| 298 | =cut | ||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||
| 300 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||
| 302 | 0 | ▶ | sub analyzeFile { | ||||||||||||||||||||||||||
|
Subroutine
analyzeFile: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||
| 303 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||
| 305 | 0 | ▶ | if (!defined $self->get('width')) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 306 | 0 | my $file = $self->file; | |||||||||||||||||||||||||||
| 307 | 0 | $file =~ s/([\$"])/\\$1/g; | |||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||
| 309 | # Dateiinformation in XML gewinnen | ||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||
| 311 | 0 | my $cmd = q|ffprobe -loglevel error -print_format xml|. | |||||||||||||||||||||||||||
| 312 | qq| -show_streams -select_streams v:0 '$file'|; | ||||||||||||||||||||||||||||
| 313 | |||||||||||||||||||||||||||||
| 314 | 0 | ▶ | if ($self->verbose) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 315 | 0 | print "$cmd\n"; | |||||||||||||||||||||||||||
| 316 | } | ||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||
| 318 | 0 | my ($xml) = Quiq::Ipc->filter($cmd); | |||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||
| 320 | # Breite, Höhe | ||||||||||||||||||||||||||||
| 321 | |||||||||||||||||||||||||||||
| 322 | 0 | my ($width) = $xml =~ /\bwidth="(\d+)"/; | |||||||||||||||||||||||||||
| 323 | 0 | my ($height) = $xml =~ /\bheight="(\d+)"/; | |||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||
| 325 | 0 | ▶ | if (!$width || !$height) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$width and $height
MC/DC0%0/2
$width and $height
$width
$height
Truth table0%0/3
A and B
A= $widthB= $height
| |||||||||||||||||||||||||||||
| 326 | 0 | $self->throw; | |||||||||||||||||||||||||||
| 327 | } | ||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||
| 329 | 0 | $self->set(width=>$width); | |||||||||||||||||||||||||||
| 330 | 0 | $self->set(height=>$height); | |||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||
| 332 | # Bitrate in kb | ||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||
| 334 | 0 | my ($bitrate) = $xml =~ /\bbit_rate="(\d+)"/; | |||||||||||||||||||||||||||
| 335 | 0 | $self->set(bitrate=>int $bitrate/1000); # ffmpeg rechnet offenbar so | |||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||
| 337 | # Framerate | ||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||
| 339 | # MEMO: manchmal gibt es das Feld frame_rate nicht, sondern | ||||||||||||||||||||||||||||
| 340 | # nur die r_frame_rate und avg_frame_rate. | ||||||||||||||||||||||||||||
| 341 | |||||||||||||||||||||||||||||
| 342 | 0 | my ($framerate) = $xml =~ /\b(?:avg_)?frame_rate="(.+?)"/; | |||||||||||||||||||||||||||
| 343 | 0 | ▶ | if ($framerate =~ m|/|) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 344 | 0 | my ($x,$y) = split m|/|,$framerate; | |||||||||||||||||||||||||||
| 345 | 0 | $framerate = Quiq::Formatter->normalizeNumber( | |||||||||||||||||||||||||||
| 346 | sprintf '%.2f',$x/$y); | ||||||||||||||||||||||||||||
| 347 | } | ||||||||||||||||||||||||||||
| 348 | 0 | $self->set(framerate=>$framerate); | |||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||
| 350 | # Dauer (millisekundengenau) | ||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||
| 352 | 0 | my ($duration) = $xml =~ /\bduration="([\d.]+)"/; | |||||||||||||||||||||||||||
| 353 | 0 | $duration = Quiq::Formatter->normalizeNumber( | |||||||||||||||||||||||||||
| 354 | sprintf '%.3f',$duration); | ||||||||||||||||||||||||||||
| 355 | 0 | $self->set(duration=>$duration); | |||||||||||||||||||||||||||
| 356 | |||||||||||||||||||||||||||||
| 357 | # Anzahl Frames | ||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||
| 359 | 0 | my ($frames) = $xml =~ /\bnb_frames="(\d+)"/; | |||||||||||||||||||||||||||
| 360 | 0 | $self->set(frames=>$frames); | |||||||||||||||||||||||||||
| 361 | } | ||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||
| 363 | 0 | return; | |||||||||||||||||||||||||||
| 364 | } | ||||||||||||||||||||||||||||
| 365 | |||||||||||||||||||||||||||||
| 366 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||
| 368 | =head1 VERSION | ||||||||||||||||||||||||||||
| 369 | |||||||||||||||||||||||||||||
| 370 | 1.240 | ||||||||||||||||||||||||||||
| 371 | |||||||||||||||||||||||||||||
| 372 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 373 | |||||||||||||||||||||||||||||
| 374 | Frank Seitz, L<http://fseitz.de/> | ||||||||||||||||||||||||||||
| 375 | |||||||||||||||||||||||||||||
| 376 | =head1 COPYRIGHT | ||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||
| 378 | Copyright (C) 2026 Frank Seitz | ||||||||||||||||||||||||||||
| 379 | |||||||||||||||||||||||||||||
| 380 | =head1 LICENSE | ||||||||||||||||||||||||||||
| 381 | |||||||||||||||||||||||||||||
| 382 | This code is free software; you can redistribute it and/or modify | ||||||||||||||||||||||||||||
| 383 | it under the same terms as Perl itself. | ||||||||||||||||||||||||||||
| 384 | |||||||||||||||||||||||||||||
| 385 | =cut | ||||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||
| 387 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 388 | |||||||||||||||||||||||||||||
| 389 | 4 | 1; | |||||||||||||||||||||||||||
| 390 | |||||||||||||||||||||||||||||
| 391 | # eof | ||||||||||||||||||||||||||||