16 - . ,
. 16- .
, MPEG ES.
, ,
. 4 - 0. ,
, , ,
1280x720 432x240.
. 16-
.
32- - ,
, ,
. ( 2 ,
, , 2 , .)
- .
, , .
0xffffffff
.
.
16- ,
.
, , :
0:
1:
2:
0x80:
0x82:
0xc6821001:
MPEG4 VOP ().
0 , . VOP
4- 0x00 0x00 0x01 0xb6.
0 0x80 , 2
0x82, - MPEG4. -
. vop_time_increment
1 ( "" ),
0, . .
, VOL. , MPEG4
, , , ,
... , ,
.
,
VOL. VOL
MPEG4, 1280x720 0
0x80 . !
. ,
. , ,
, , , .
.
, ,
vop_time_increment. -
.
Windows ,
,
.
, , .
./streamget < camera.raw | mplayer -demuxer mpeg4es - .
mkvol: VOB MPEG4 stdout
use strict;
@ARGV==2 or die "Usage: $0 width height\n";
my $bits = '';
$bits .= '00000000000000000000000100000000';
$bits .= '00000000000000000000000100100000';
$bits .= '0';
$bits .= '00010001';
$bits .= '1';
$bits .= '0010';
$bits .= '000';
$bits .= '0001';
$bits .= '0';
$bits .= '00';
$bits .= '1';
$bits .= sprintf '%016b', 30;
$bits .= '1';
$bits .= '0';
$bits .= '1';
$bits .= sprintf '%013b', $ARGV[0];
$bits .= '1';
$bits .= sprintf '%013b', $ARGV[1];
$bits .= '1';
$bits .= '0';
$bits .= '1';
$bits .= '00';
$bits .= '0';
$bits .= '0';
$bits .= '0';
$bits .= '1';
$bits .= '1';
$bits .= '0';
$bits .= '0';
$bits .= '0';
$bits .= '0';
$bits .='0'; $bits .= '1' while length($bits)%8;
print pack "B*", $bits;
streamget: VOL
use strict;
sub fullread;
@ARGV==0 || "@ARGV" eq 'secondary' or die "Usage: $0 [secondary] < camera.raw";
my @wanted = (0,0x80);
@wanted = (2,0x82) if @ARGV;
fullread(my $fileheader, 16, 1);
my ($version, $width, $height, $swidth, $sheight, @mysterystuff) =
unpack "Nv4C4", $fileheader;
if(!@ARGV) {
system("./mkvol $width $height");
} else {
system("./mkvol $swidth $sheight");
}
while(fullread(my $buf, 16)) {
my ($tag, $plen, $mystery1, $mystery1) = unpack "VVVV", $buf;
fullread(my $pbuf, $plen, 1);
if($tag ~~ @wanted) {
print $pbuf;
}
}
sub fullread
{
my ($buf, $len, $mandatory) = @_;
my $n = read(STDIN, $_[0], $len);
if(!defined($n)) {
die "stdin: $!\n";
}
if($n==0) {
return 0 if !$mandatory;
die "stdin: unexpected EOF\n"
}
if($n<$len) {
die "stdin: unexpected EOF\n"
}
return 1;
}