{"id":726,"date":"2008-12-09T19:06:54","date_gmt":"2008-12-10T03:06:54","guid":{"rendered":"http:\/\/multimedia.cx\/eggs\/?p=726"},"modified":"2020-07-25T22:26:03","modified_gmt":"2020-07-26T05:26:03","slug":"parsing-in-python","status":"publish","type":"post","link":"https:\/\/multimedia.cx\/eggs\/parsing-in-python\/","title":{"rendered":"Parsing In Python"},"content":{"rendered":"<p>I wanted to see if the video frames inside these newly discovered <a href=\"http:\/\/wiki.multimedia.cx\/index.php?title=ACD_Systems_Digital_Imaging\">ACDV-AVI files<\/a> were just regular JPEG frames stuffed inside an AVI file. JPEG is a picky matter and many companies have derived their own custom bastardizations of the format. So I just wanted to separate out the data frames into individual JPEG files and see if they could be decoded with other picture viewers. Maybe <a href=\"http:\/\/ffmpeg.org\/\">FFmpeg<\/a> can already do it using the right combination of command line options. Or maybe it&#8217;s trivial to hook up the &#8216;ACDV&#8217; FourCC to the JPEG decoder in the source code. What can I say? FFmpeg intimidates me just as much as it does any of you mere mortals.<\/p>\n<p>Plus, I&#8217;m getting a big kick out of writing little tools in Python. For a long time, I had a fear of processing binary data in very high level languages like Perl, believing that they should be left to text processing tasks. This needn&#8217;t be the case. pack() and unpack() make binary data manipulation quite simple in Perl and Python. Here&#8217;s a naive utility that loads an AVI file in one go, digs through it until it finds a video frame marker (either &#8217;00dc&#8217; or &#8212; and I have never seen this marker before &#8212; &#8217;00AC&#8217;) and writes the frame to its own file.<\/p>\n<p>acdv.py:<br \/>\n<script src=\"https:\/\/gist.github.com\/multimediamike\/e87ab641d834dbbededd61b462e3eae8.js\"><\/script><\/p>\n<p>BTW, the experiment revealed that, indeed, the ACDV video frames can each stand alone as separate JPEG files.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Is this ACDV data standard JPEG data? Rather than going through the bother of trying to make FFmpeg test it, I wrote a Python utility to split the frames from an AVI file.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[28,55],"tags":[105,107,285,106],"class_list":["post-726","post","type-post","status-publish","format-standard","hentry","category-programming","category-python","tag-avi","tag-parsing","tag-python","tag-video-codec"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/posts\/726","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=726"}],"version-history":[{"count":10,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/posts\/726\/revisions"}],"predecessor-version":[{"id":4588,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/posts\/726\/revisions\/4588"}],"wp:attachment":[{"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/media?parent=726"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/categories?post=726"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/tags?post=726"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}