{"id":3601,"date":"2011-10-19T23:13:36","date_gmt":"2011-10-20T06:13:36","guid":{"rendered":"http:\/\/multimedia.cx\/eggs\/?p=3601"},"modified":"2011-10-19T23:13:36","modified_gmt":"2011-10-20T06:13:36","slug":"more-cinepak-madness","status":"publish","type":"post","link":"https:\/\/multimedia.cx\/eggs\/more-cinepak-madness\/","title":{"rendered":"More Cinepak Madness"},"content":{"rendered":"<p>Fellow digital archaeologist <a href=\"http:\/\/clone2727.blogspot.com\/\">Clone2727<\/a> found a <em>possible<\/em> fifth variant of the <a href=\"http:\/\/wiki.multimedia.cx\/index.php?title=Cinepak\">Cinepak video codec<\/a>. He asked me if I cared to investigate the sample. I assured him I wouldn&#8217;t be able to die a happy multimedia nerd unless I have cataloged all possible Cinepak variants known to exist in the wild. I&#8217;m sure there are chemistry nerds out there who are ecstatic when another element is added to the periodic table. Well, that&#8217;s me, except with weird multimedia formats.<\/p>\n<p><strong>Background<\/strong><br \/>\nCinepak is a video codec that saw widespread use in the early days of digital multimedia. To date, we have cataloged 4 variants of Cinepak in the wild. This distinction is useful when trying to write and maintain an all-in-one decoder. The variants are:<\/p>\n<ol>\n<li>The standard type: Most Cinepak data falls into this category. It decodes to a modified\/simplified YUV 4:2:0 planar colorspace and is often seen in AVI and QuickTime\/MOV files.<\/li>\n<li>8-bit greyscale: Essentially the same as the standard type but with only a Y plane. This has only been identified in AVI files and is distinguished by the file header&#8217;s video bits\/pixel field being set to 8 instead of 24.<\/li>\n<li>8-bit paletted: Again, this is identified by the video header specifying 8 bits\/pixel for a Cinepak stream. There is essentially only a Y plane in the data, however, each 8-bit value is a palette index. The palette is transported along with the video header. To date, only one known sample of this format has even been spotted in the wild, and it&#8217;s classified as NSFW. It is also a QuickTime\/MOV file.<\/li>\n<li><a href=\"http:\/\/wiki.multimedia.cx\/index.php?title=Sega_FILM\">Sega\/FILM CPK<\/a> data: Sega Saturn games often used CPK files which stored a variant of Cinepak that, while very close the standard Cinepak, couldn&#8217;t be decoded with standard decoder components.<\/li>\n<\/ol>\n<p>So, a flexible Cinepak decoder has to identify if the file&#8217;s video header specified 8 bits\/pixel. How does it distinguish between greyscale and paletted? If a file is paletted, a custom palette should have been included with the video header. Thus, if video bits\/pixel is 8 and a palette is present, use paletted; else, use greyscale. Beyond that, the Cinepak decoder has a heuristic to determine how to handle the standard type of data, which might deviate slightly if it comes from a Sega CPK file.<\/p>\n<p><strong>The Fifth Variant?<\/strong><br \/>\nNow, regarding this fifth variant&#8211; the reason this issue came up is because of that aforementioned heuristic. Basically, a Cinepak chunk is supposed to store the length of the entire chunk in its header. The data from a Sega CPK file plays fast and loose with this chunk size and the discrepancy makes it easy to determine if the data requires special handling. However, a handful of files discovered on a Macintosh game called <a href=\"http:\/\/www.mobygames.com\/game\/macintosh\/journeyman-project-pegasus-prime\">&#8220;The Journeyman Project: Pegasus Prime&#8221;<\/a> have chunk lengths which are sometimes in disagreement with the lengths reported in the containing QuickTime file&#8217;s stsz atom. This trips the heuristic and tries to apply the CPK rules against Cinepak data which, aside from the weird chunk length, is perfectly compliant.<\/p>\n<p>Here are the first few chunk sizes, as reported by the file header (stsz atom) and the chunk:<\/p>\n<pre>\r\nsize from stsz = 7880 (0x1EC8); from header = 3940 (0xF64)\r\nsize from stsz = 3940 (0xF64); from header = 3940 (0xF64)\r\nsize from stsz = 15792 (0x3DB0); from header = 3948 (0xF6C)\r\nsize from stsz = 11844 (0x2E44); from header = 3948 (0xF6C)\r\n\r\n<\/pre>\n<p>Hey, there&#8217;s a pattern here. If they don&#8217;t match, then the stsz size is an even multiple of the chunk size (2x, 3x, or 4x in my observation). I suppose I could revise the heuristic to state that if the stsz size is 2x, 3x, 4x, or equal to the chunk header, qualify it as compliant Cinepak data.<\/p>\n<p>Of course it feels impure, but software engineering is rarely about programmatic purity. A decade of special cases in the <a href=\"http:\/\/ffmpeg.org\/\">FFmpeg<\/a> \/ <a href=\"http:\/\/libav.org\/\">Libav<\/a> codebases are a testament to that.<\/p>\n<p><strong>What&#8217;s A Variant?<\/strong><br \/>\nSuddenly, I find myself contemplating what truly constitutes a variant. Maybe this was just a broken encoder program making these files? And for that, I assign it the designation of distinct variation, like some sort of special, unique showflake?<\/p>\n<p>Then again, I documented <a href=\"http:\/\/wiki.multimedia.cx\/index.php?title=Flic_Video#Magic_Carpet\">Magic Carpet FLIC<\/a> as being a distinct variant of the broader FLIC format (which has <a href=\"http:\/\/www.compuphase.com\/flic.htm\">an enormous number of variants<\/a> as well).<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Cataloging different types of Cinepak video codec data<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14],"tags":[],"class_list":["post-3601","post","type-post","status-publish","format-standard","hentry","category-codec-technology"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.10 - aioseo.com -->\n\t<meta name=\"description\" content=\"Cataloging different types of Cinepak video codec data\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Multimedia Mike\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/multimedia.cx\/eggs\/more-cinepak-madness\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.10\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"Breaking Eggs And Making Omelettes | Topics On Multimedia Technology and Reverse Engineering\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"More Cinepak Madness | Breaking Eggs And Making Omelettes\" \/>\n\t\t<meta property=\"og:description\" content=\"Cataloging different types of Cinepak video codec data\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/multimedia.cx\/eggs\/more-cinepak-madness\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2011-10-20T06:13:36+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2011-10-20T06:13:36+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"More Cinepak Madness | Breaking Eggs And Making Omelettes\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Cataloging different types of Cinepak video codec data\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/more-cinepak-madness\\\/#article\",\"name\":\"More Cinepak Madness | Breaking Eggs And Making Omelettes\",\"headline\":\"More Cinepak Madness\",\"author\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/author\\\/multimedia-mike\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/#organization\"},\"datePublished\":\"2011-10-19T23:13:36-07:00\",\"dateModified\":\"2011-10-19T23:13:36-07:00\",\"inLanguage\":\"en-US\",\"commentCount\":7,\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/more-cinepak-madness\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/more-cinepak-madness\\\/#webpage\"},\"articleSection\":\"Codec Technology\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/more-cinepak-madness\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/multimedia.cx\\\/eggs\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/category\\\/codec-technology\\\/#listItem\",\"name\":\"Codec Technology\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/category\\\/codec-technology\\\/#listItem\",\"position\":2,\"name\":\"Codec Technology\",\"item\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/category\\\/codec-technology\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/more-cinepak-madness\\\/#listItem\",\"name\":\"More Cinepak Madness\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/more-cinepak-madness\\\/#listItem\",\"position\":3,\"name\":\"More Cinepak Madness\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/category\\\/codec-technology\\\/#listItem\",\"name\":\"Codec Technology\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/#organization\",\"name\":\"Breaking Eggs And Making Omelettes\",\"description\":\"Topics On Multimedia Technology and Reverse Engineering\",\"url\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/author\\\/multimedia-mike\\\/#author\",\"url\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/author\\\/multimedia-mike\\\/\",\"name\":\"Multimedia Mike\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/more-cinepak-madness\\\/#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/2eb93f7cada658f7986b5092062849fa255779eada3342c8f6b9a40764b95fdd?s=96&d=identicon&r=g\",\"width\":96,\"height\":96,\"caption\":\"Multimedia Mike\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/more-cinepak-madness\\\/#webpage\",\"url\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/more-cinepak-madness\\\/\",\"name\":\"More Cinepak Madness | Breaking Eggs And Making Omelettes\",\"description\":\"Cataloging different types of Cinepak video codec data\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/more-cinepak-madness\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/author\\\/multimedia-mike\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/author\\\/multimedia-mike\\\/#author\"},\"datePublished\":\"2011-10-19T23:13:36-07:00\",\"dateModified\":\"2011-10-19T23:13:36-07:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/#website\",\"url\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/\",\"name\":\"Breaking Eggs And Making Omelettes\",\"description\":\"Topics On Multimedia Technology and Reverse Engineering\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"More Cinepak Madness | Breaking Eggs And Making Omelettes","description":"Cataloging different types of Cinepak video codec data","canonical_url":"https:\/\/multimedia.cx\/eggs\/more-cinepak-madness\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/multimedia.cx\/eggs\/more-cinepak-madness\/#article","name":"More Cinepak Madness | Breaking Eggs And Making Omelettes","headline":"More Cinepak Madness","author":{"@id":"https:\/\/multimedia.cx\/eggs\/author\/multimedia-mike\/#author"},"publisher":{"@id":"https:\/\/multimedia.cx\/eggs\/#organization"},"datePublished":"2011-10-19T23:13:36-07:00","dateModified":"2011-10-19T23:13:36-07:00","inLanguage":"en-US","commentCount":7,"mainEntityOfPage":{"@id":"https:\/\/multimedia.cx\/eggs\/more-cinepak-madness\/#webpage"},"isPartOf":{"@id":"https:\/\/multimedia.cx\/eggs\/more-cinepak-madness\/#webpage"},"articleSection":"Codec Technology"},{"@type":"BreadcrumbList","@id":"https:\/\/multimedia.cx\/eggs\/more-cinepak-madness\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/multimedia.cx\/eggs#listItem","position":1,"name":"Home","item":"https:\/\/multimedia.cx\/eggs","nextItem":{"@type":"ListItem","@id":"https:\/\/multimedia.cx\/eggs\/category\/codec-technology\/#listItem","name":"Codec Technology"}},{"@type":"ListItem","@id":"https:\/\/multimedia.cx\/eggs\/category\/codec-technology\/#listItem","position":2,"name":"Codec Technology","item":"https:\/\/multimedia.cx\/eggs\/category\/codec-technology\/","nextItem":{"@type":"ListItem","@id":"https:\/\/multimedia.cx\/eggs\/more-cinepak-madness\/#listItem","name":"More Cinepak Madness"},"previousItem":{"@type":"ListItem","@id":"https:\/\/multimedia.cx\/eggs#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/multimedia.cx\/eggs\/more-cinepak-madness\/#listItem","position":3,"name":"More Cinepak Madness","previousItem":{"@type":"ListItem","@id":"https:\/\/multimedia.cx\/eggs\/category\/codec-technology\/#listItem","name":"Codec Technology"}}]},{"@type":"Organization","@id":"https:\/\/multimedia.cx\/eggs\/#organization","name":"Breaking Eggs And Making Omelettes","description":"Topics On Multimedia Technology and Reverse Engineering","url":"https:\/\/multimedia.cx\/eggs\/"},{"@type":"Person","@id":"https:\/\/multimedia.cx\/eggs\/author\/multimedia-mike\/#author","url":"https:\/\/multimedia.cx\/eggs\/author\/multimedia-mike\/","name":"Multimedia Mike","image":{"@type":"ImageObject","@id":"https:\/\/multimedia.cx\/eggs\/more-cinepak-madness\/#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/2eb93f7cada658f7986b5092062849fa255779eada3342c8f6b9a40764b95fdd?s=96&d=identicon&r=g","width":96,"height":96,"caption":"Multimedia Mike"}},{"@type":"WebPage","@id":"https:\/\/multimedia.cx\/eggs\/more-cinepak-madness\/#webpage","url":"https:\/\/multimedia.cx\/eggs\/more-cinepak-madness\/","name":"More Cinepak Madness | Breaking Eggs And Making Omelettes","description":"Cataloging different types of Cinepak video codec data","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/multimedia.cx\/eggs\/#website"},"breadcrumb":{"@id":"https:\/\/multimedia.cx\/eggs\/more-cinepak-madness\/#breadcrumblist"},"author":{"@id":"https:\/\/multimedia.cx\/eggs\/author\/multimedia-mike\/#author"},"creator":{"@id":"https:\/\/multimedia.cx\/eggs\/author\/multimedia-mike\/#author"},"datePublished":"2011-10-19T23:13:36-07:00","dateModified":"2011-10-19T23:13:36-07:00"},{"@type":"WebSite","@id":"https:\/\/multimedia.cx\/eggs\/#website","url":"https:\/\/multimedia.cx\/eggs\/","name":"Breaking Eggs And Making Omelettes","description":"Topics On Multimedia Technology and Reverse Engineering","inLanguage":"en-US","publisher":{"@id":"https:\/\/multimedia.cx\/eggs\/#organization"}}]},"og:locale":"en_US","og:site_name":"Breaking Eggs And Making Omelettes | Topics On Multimedia Technology and Reverse Engineering","og:type":"article","og:title":"More Cinepak Madness | Breaking Eggs And Making Omelettes","og:description":"Cataloging different types of Cinepak video codec data","og:url":"https:\/\/multimedia.cx\/eggs\/more-cinepak-madness\/","article:published_time":"2011-10-20T06:13:36+00:00","article:modified_time":"2011-10-20T06:13:36+00:00","twitter:card":"summary","twitter:title":"More Cinepak Madness | Breaking Eggs And Making Omelettes","twitter:description":"Cataloging different types of Cinepak video codec data"},"aioseo_meta_data":{"post_id":"3601","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"location":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":null,"created":"2020-12-31 21:46:35","updated":"2025-12-31 19:41:04","seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/multimedia.cx\/eggs\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/multimedia.cx\/eggs\/category\/codec-technology\/\" title=\"Codec Technology\">Codec Technology<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tMore Cinepak Madness\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/multimedia.cx\/eggs"},{"label":"Codec Technology","link":"https:\/\/multimedia.cx\/eggs\/category\/codec-technology\/"},{"label":"More Cinepak Madness","link":"https:\/\/multimedia.cx\/eggs\/more-cinepak-madness\/"}],"_links":{"self":[{"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/posts\/3601","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/comments?post=3601"}],"version-history":[{"count":4,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/posts\/3601\/revisions"}],"predecessor-version":[{"id":3605,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/posts\/3601\/revisions\/3605"}],"wp:attachment":[{"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/media?parent=3601"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/categories?post=3601"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/tags?post=3601"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}