Skip to content

Commit 1e964b1

Browse files
committed
IVF fix warnings, improve framerate
1 parent 3c7e76b commit 1e964b1

File tree

3 files changed

+23
-9
lines changed

3 files changed

+23
-9
lines changed

getid3/getid3.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ class getID3
387387
*/
388388
protected $startup_warning = '';
389389

390-
const VERSION = '1.9.24-202510171248';
390+
const VERSION = '1.9.24-202510231324';
391391
const FREAD_BUFFER_SIZE = 32768;
392392

393393
const ATTACHMENTS_NONE = false;
@@ -1951,6 +1951,12 @@ public function ChannelsBitratePlaytimeCalculations() {
19511951
if (!empty($this->info['playtime_seconds']) && empty($this->info['playtime_string'])) {
19521952
$this->info['playtime_string'] = getid3_lib::PlaytimeString($this->info['playtime_seconds']);
19531953
}
1954+
1955+
// Look up codec name if fourcc is set but codec is not
1956+
if (!empty($this->info['video']['fourcc']) && !isset($this->info['video']['codec'])) {
1957+
$this->include_module('audio-video.riff');
1958+
$this->info['video']['codec'] = getid3_riff::fourccLookup($this->info['video']['fourcc']);
1959+
}
19541960
}
19551961

19561962
/**

getid3/module.audio-video.ivf.php

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function Analyze() {
3333

3434
if (substr($IVFheader, 0, 4) == 'DKIF') {
3535

36-
// https://wiki.multimedia.cx/index.php/IVF
36+
// https://wiki.multimedia.cx/index.php/Duck_IVF
3737
$info['ivf']['header']['signature'] = substr($IVFheader, 0, 4);
3838
$info['ivf']['header']['version'] = getid3_lib::LittleEndian2Int(substr($IVFheader, 4, 2)); // should be 0
3939
$info['ivf']['header']['headersize'] = getid3_lib::LittleEndian2Int(substr($IVFheader, 6, 2));
@@ -51,10 +51,6 @@ public function Analyze() {
5151
$this->warning('Expecting IVF header version 0, found version '.$info['ivf']['header']['version'].', results may not be accurate');
5252
}
5353

54-
$info['video']['resolution_x'] = $info['ivf']['header']['resolution_x'];
55-
$info['video']['resolution_y'] = $info['ivf']['header']['resolution_y'];
56-
$info['video']['codec'] = $info['ivf']['header']['fourcc'];
57-
5854
$info['ivf']['frame_count'] = 0;
5955
$timestamp = 0;
6056
while (!$this->feof()) {
@@ -65,9 +61,17 @@ public function Analyze() {
6561
$info['ivf']['frame_count']++;
6662
}
6763
}
68-
if ($info['ivf']['frame_count'] && $info['playtime_seconds']) {
69-
$info['playtime_seconds'] = $timestamp / 100000;
70-
$info['video']['frame_rate'] = (float) $info['ivf']['frame_count'] / $info['playtime_seconds'];
64+
//if ($info['ivf']['frame_count'] && $timestamp) {
65+
// $info['playtime_seconds'] = $timestamp / 100000;
66+
// $info['video']['frame_rate'] = (float) $info['ivf']['frame_count'] / $info['playtime_seconds'];
67+
//}
68+
69+
$info['video']['resolution_x'] = $info['ivf']['header']['resolution_x'];
70+
$info['video']['resolution_y'] = $info['ivf']['header']['resolution_y'];
71+
$info['video']['fourcc'] = $info['ivf']['header']['fourcc'];
72+
if ($info['ivf']['header']['frame_count'] && $info['ivf']['header']['frame_rate']) {
73+
$info['video']['frame_rate'] = (float) $info['ivf']['header']['frame_rate'];
74+
$info['playtime_seconds'] = (float) $info['ivf']['frame_count'] / $info['ivf']['header']['frame_rate'];
7175
}
7276

7377
} else {

getid3/module.audio-video.riff.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2825,6 +2825,10 @@ public static function fourccLookup($fourcc) {
28252825
VLV1 VideoLogic/PURE Digital Videologic Capture
28262826
VP30 On2 VP3.0
28272827
VP31 On2 VP3.1
2828+
VP50 On2 VP5
2829+
VP60 On2 VP6
2830+
VP70 On2 VP7
2831+
VP80 On2 VP8
28282832
VP6F On2 TrueMotion VP6
28292833
VX1K Lucent VX1000S Video Codec
28302834
VX2K Lucent VX2000S Video Codec

0 commit comments

Comments
 (0)