Re: [PHP] Decompressing a string with zlib problems
by Graham Anderson other posts by this author
Oct 28 2005 2:31PM messages near this date
Re: [PHP] Decompressing a string with zlib problems
|
Re: [PHP] Decompressing a string with zlib problems
Well, maybe QT has a very wacked out version of zLib ?
This is what I sent to the Quicktime API list:
//----------------------------------------------------------------------
----------
Ok, here we go :)
Isn't looking through reams of hex data a blast ?
Kind of like a hot poker in the eye ;)
curl -l -i "http://www.siren.cc/siren/reel/Library/php/zlib.php"
Here are two versions of the SAME test movie exported from Livestage:
One version has compressed movie headers
The other version has uncompressed movie headers
With zLib, I am using gzcompress at compression level 6, and
gzuncompress.
All the string data below was converted from hex with the pack()
function.
The actual php script I wrote for this test is way way below.
The upshot:
1)Using zlib to compress and decompress a movie header seems to work
fine :)
2)Attempting to 'gzuncompress' a movie header that was compressed in
Livestage gives an error.
I doubt this is fault of Livestage which I assume is simply calling
DataCodecCompress or an equivalent function, no ?
3) The Livestage'd compressed movie header output IS NOT THE SAME as
a the zLib'd compressed movie header output
Maybe I am not starting at the correct point in the compressed movie
header string?
hopefully, this is enough to start a dialog.
here is the output:
//-----------------------------------------------------
The uncompressed movie header string is:
trak\tkhd??7???7?X??@$edtselstXnmdia mdhd??7???7?XXH?hdlrmhlrsprtappl?
Sprite Animation Media Handlerminf gmhdgmin@??????9hdlrdhlralisappl?
Apple Alias Data Handler$dinfdref
alis?stbl,stsdzlibsttsXstscstszstco&?
code?sean emk
hjkedtligudta
namedrm]udta#?swrMade with LiveStage
Proplugmoviename=drm.mov
ctypnone play
//-----------------------------------------------------
Compressed in Livestage: the compressed movie header string is:
?cmvd?x??S?n1?l?P?H Õ?V"G?q@???T?ppbg????l7Q??z?+??Ð???8Nw??}?
x?????.@?Z???^w?????| ?=??9???[?????o??~4???k??e?soo?C7?
??P???7?&Fs???4?Ç»?
?,?u????gU?K?s?ꬲÒ?ld?f^?&;H????J`Z?PK3#?\?A??
MÍ·a???oe8?0%?<??????*J2?3??!?Ü?Y?;?D??O??7?;Þ¸??;?Vr??C??m?R?????
Ó?[Cߢ??o???8a\dK??\?3?r??Z?ß?J??\HA?????Ô¯*Sj?A??*0?F?]
9
c?8Ã??oZ6f p?;-?hM?? fb?A?!?O?9
//-----------------------------------------------------
The zlib version of the uncompressed movie header using gzcompress
at level 6 is:
x??SMN?@~v?ZZ*uQH@??T?U?m?EU??`?HHÙ°??!3??Ì???I9K?-8E?8??H?s?qb?EG?
4o???=??:?:ϧ??4?Ã??/????D??k??> .-?o????[6F?ÌK?N?Y?Õµ??Ð???P???????
æ?¡?h?Ì»#?g\Y??LYWXÏ?B?,Qt?~XX?Erd?f^??M???J`Y?BKsA2?.ez):=????Z?p?aJ:?
y??y??U?d.??????@?[q?2?-" ??????'?_??7':S?<?{Î?3?b????1Z?/?c?p???
o????;ʹh??Ì?????h?> ?]?Z??b????Fd??(87É·???4?$?ZmP?l?Ri#uÑpO_?kô?V?
Я??p?.-t???R?,?)?b?Y*?K??-?$??T
????u??n??UarC??,??t_????
//-----------------------------------------------------
the uncompressed zlib movie header string using gzuncompress is:
trak\tkhd??7???7?X??@$edtselstXnmdia mdhd??7???7?XXH?hdlrmhlrsprtappl?
Sprite Animation Media Handlerminf gmhdgmin@??????9hdlrdhlralisappl?
Apple Alias Data Handler$dinfdref
alis?stbl,stsdzlibsttsXstscstszstco&?
code?sean emk
hjkedtligudta
namedrm]udta#?swrMade with LiveStage
Proplugmoviename=drm.mov
ctypnone play
//-----------------------------------------------------
Here is the attempt to use gzuncompress with the movieheader
compressed in Livestage:
<br />
<b> Warning</b>: gzuncompress(): data error in <b>/home/www/siren/
siren/reel/Library/php/zlib.php</b> on line <b>34</b><br />
Here is the PHP script:
<?php
$uncompressed_movieheader_hex="000003DE6D6F6F760000006C6D76686400000000B
F883792BF883792000002580000025800010000010000000000000000000000000100000
000000000000000000000000001000000000000000000000000000040000000000000000
000025800000000000000000000000000000000000000020000030D7472616B0000005C7
46B686400000003BF883792BF8837920000000100000000000002580000000000000000F
FFE000000000000000100000000000000000000000000000001000000000000000000000
000000040000000000200000002000000000024656474730000001C656C7374000000000
00000010000025800000000000100000000026E6D646961000000206D64686400000000B
F883792BF8837920000025800000258000000480000003F68646C72000000006D686C727
37072746170706C00000001000101C11E53707269746520416E696D6174696F6E204D656
469612048616E646C6572000002076D696E6600000020676D686400000018676D696E000
000000040FFFFFFFFFFFF000000000000003968646C720000000064686C72616C6973617
0706C10000001000101D2184170706C6520416C69617320446174612048616E646C65720
000002464696E660000001C6472656600000000000000010000000C616C6973000000010
00000907374626C0000002C7374736400000000000000010000001C00000000000000000
0000001000000007A6C69620000000000000018737474730000000000000001000000010
00002580000001C737473630000000000000001000000010000000100000001000000147
374737A000000000000021D00000001000000147374636F0000000000000001000004260
00000F2636F6465000000000000000000000000000000DE7365616E00000001000000090
00000000000001A000000650000000100000000000000000000000000000000001600000
06D0000000100000000000000000001000000180000006B0000000100000000000000000
000000A000000150000006800000001000000000000000001000000150000006A0000000
1000000000000000000000000156B6564740000000100000000000000000000000016000
0006C0000000100000000000000000000000000150000006900000001000000000000000
001000000180000006700000001000000000000000000000004000000177564746100000
00B6E616D6564726D000000000000005D7564746100000023A9737772001700004D61646
52077697468204C69766553746167652050726F00000019706C75676D6F7669656E616D6
53D64726D2E6D6F760000000C637479706E6F6E6500000009706C6179000000000000000
008";
$compressed_movieheader_hex="000001D0636D7664000003DE789C9553C16E1331109
D6C9050A1481C0809D582562247C415714010A9871CA854A9170E70706267D7C4F6AE6C3
751F2051CF9037AE52BAAFE021FD08FE003DACE384E77B31107AC7DF278C6F3DEECCC2E4
0F75A97E50200945E141C77B8FCF1EE8200907C09E8003DF5DA39EC9F3FDD5B94BFB7128
0EE136FD91CEDAF7E1E34BBA8F76BA3B965AB736F6FFE43378900180AEE1DEEA950CED71
99137E4264673C9D0C834FFC7BB038C111F0BAE2CC575A1ACABAC6755A5024BA773F5EAA
CB2D28B6C64A4665E96263B11489B8D99E14A605AF2504B3323995C0799418E8E4DCDB76
1C5F2DE6F6538CA30251DC93CDDC8FC198CF0802A4A32971D33DF108021DF08A4DC8A59A
33B874412ED9FCE4FA8E637CE3BDEB893B63BBA567212CF03E7430FB7B16DFF52E498EEF
AEFF10C63EB38C397B56F5A36662070FF3B2DB9684DF4DA096662CE41F41D2104EC4F1FE
0390D642742D600316FDD7F84E8218AA6BF139DDFDBE4BD397E3A6D2789A9BD32285FB64
9A982BC75F501A27FCE3D7D6D8F0DD3825B1D43DFA2FBF56FB7B4D00738615C644BE98BE
CB35C8833CF72919D5AEADF8B4A9DE7BA5C4841141F90E3AD0E3FEFE1D4AF2A531A6AD44
1A5D82A30DF0110468E5D00000039";
$uncompressed_movieheader_string = pack("H*",
$uncompressed_movieheader_hex);
echo '//-----------------------------------------------------'."\n\r";
echo "The uncompressed movie header string is:". "\r\n";
echo $uncompressed_movieheader_string."\r\n\r\n";
$compressed_hexstring = pack("H*", $compressed_movieheader_hex);
echo '//-----------------------------------------------------'."\n\r";
echo "Compressed in Livestage: the compressed movie header string
is:"."\r\n";
echo $compressed_hexstring."\r\n\r\n";
$compressed_zlib_movieheader_string = gzcompress
($uncompressed_movieheader_string, 6);
echo '//-----------------------------------------------------'."\n\r";
echo "The zlib version of the uncompressed movie header using
gzcompress at level 6 is: "."\r\n";
echo $compressed_zlib_movieheader_string."\r\n\r\n";
$decompressed_zlib_movieheader_string= gzuncompress
($compressed_zlib_movieheader_string);
echo '//-----------------------------------------------------'."\n\r";
echo "the uncompressed zlib movie header string using gzuncompress
is: "."\r\n";
echo $decompressed_zlib_movieheader_string."\r\n\r\n";
echo '//-----------------------------------------------------'."\n\r";
echo "Here is the attempt to use gzuncompress with the movieheader
compressed in Livestage: "."\r\n";
$decompressLSCompressedMovieHeader= gzuncompress($compressed_hexstring);
echo $decompressLSCompressedMovieHeader."\r\n\r\n";
?>
On Oct 28, 2005, at 8:15 AM, Robin Vickery wrote:
> On 10/28/05, Graham Anderson <grahama@[...].cc> wrote:
>
> > I am having problems decompressing a zlib'd string located in a file.
> >
> > In the file headers, the compression says that it is zlib.
> > But, when I 'gzinflate' the string, I get the error: gzinflate():
> > data error in <b
> > Is the below NOT a zlib or some strange variant ?
> >
> > <?php
> > $hex="C0636D7664000003DE789C95533B4E [...]
> >
>
> Is this thread any help?
>
> http://lists.apple.com/archives/QuickTime-java/2003/Sep/msg00038.html
>
> Looking at your binary data in a hex editor, you've got what looks
> like a cmvd header at the start. If the next four bytes are the
> length of the compressed data, then you've got probably got 990 bytes
> following that that you should be decompressing.
>
> -robin
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Thread:
Graham Anderson
Robin Vickery
Graham Anderson
Jochem Maas
|