Differences between current version and predecessor to the previous major change of DPG/makehdr.php.
Other diffs: Previous Revision, Previous Author
Newer page: | version 2 | Last edited on Monday, 11 August 2008 13:49:42 | by CyberLeo | |
Older page: | version 1 | Last edited on Sunday, 10 August 2008 13:56:07 | by CyberLeo | Revert |
@@ -12,11 +12,11 @@
$fps = array_shift($argv);
$hz = array_shift($argv);
$base = array_shift($argv);
-$asize = filesize("output
.mp2");
-$vsize = filesize("output
.m1v");
-$gsize = filesize("output
.gop");
+$asize = filesize(sprintf
("%s
.mp2", $base)
);
+$vsize = filesize(sprintf
("%s
.m1v", $base)
);
+$gsize = filesize(sprintf
("%s
.gop", $base)
);
if (!$asize || !$vsize || !$gsize) {
printf("Make sure you have %s.{mp2,m1v,gop} in the current directory!\n", $base);
return 1;
current version
#!/usr/bin/env php <?php // Load options if (count($argv) != 5) { echo "Usage: makehdr <frames> <fps> <Hz> <basename>\n"; return 1; } $name = array_shift($argv); $frames = array_shift($argv); $fps = array_shift($argv); $hz = array_shift($argv); $base = array_shift($argv); $asize = filesize(sprintf("%s.mp2", $base)); $vsize = filesize(sprintf("%s.m1v", $base)); $gsize = filesize(sprintf("%s.gop", $base)); if (!$asize || !$vsize || !$gsize) { printf("Make sure you have %s.{mp2,m1v,gop} in the current directory!\n", $base); return 1; } $astart = 36 + 12; $vstart = $astart + $asize; $gstart = $vstart + $vsize; $hdr = sprintf("DPG2%s", pack('lnnlllllllll', $frames, $fps, 0, $hz, 0, $astart, $asize, $vstart, $vsize, $gstart, $gsize, 3)); file_put_contents(sprintf("%s.hdr", $base), $hdr); printf("F:%u FPS:%u Hz:%u as:%u al:%u vs:%u vl:%u gs:%u gl:%u\n", $frames, $fps, $hz, $astart, $asize, $vstart, $vsize, $gstart, $gsize); printf("%s.hdr: %u bytes written\n", $base, strlen($hdr)); ?>