{"id":203,"date":"2006-02-15T22:36:15","date_gmt":"2006-02-16T06:36:15","guid":{"rendered":"http:\/\/multimedia.cx\/eggs\/?p=203"},"modified":"2006-08-31T20:56:49","modified_gmt":"2006-09-01T03:56:49","slug":"basic-ffmpeg-hacking","status":"publish","type":"post","link":"https:\/\/multimedia.cx\/eggs\/basic-ffmpeg-hacking\/","title":{"rendered":"Basic FFmpeg Hacking"},"content":{"rendered":"<p>A few more people have expressed interest in writing file demuxers and audio\/video decoders for the <a href=\"http:\/\/ffmpeg.sourceforge.net\">FFmpeg<\/a> project. I present herewith a brief guide to creating both demuxers and decoders for that project.<\/p>\n<p>Start with the demuxer:<\/p>\n<ul>\n<li>copy one of the simpler formats (libavformat\/idcin.c or idroq.c) to a new file and start modifying the key parts<\/li>\n<li>edit libavformat\/allformats.c and libavformat\/avformat.h and add the proper _init() function<\/li>\n<li>edit libavformat\/Makefile and add the new file to the end of the OBJS list<\/li>\n<\/ul>\n<p>You should be able to build the new demuxer module into the project now. Check &#8216;ffmpeg -formats&#8217; to make sure. You can use printf()&#8217;s or gdb along with the ffmpeg for debugging.<\/p>\n<p>Next is the video decoder:<\/p>\n<ul>\n<li>copy one of the simpler video decoders (libavcodec\/msrle.c or msvideo1.c) to a new file and start modifying the key parts<\/li>\n<li>edit libavcodec\/avcodec.h and add a new CODEC_ID; also add the new data structure declared at the end of the new file<\/li>\n<li>edit libavcodec\/allcodecs.c and add the new data structure there as well<\/li>\n<li>edit libavcodec\/Makefile and add the new file to the end of the OBJS list<\/li>\n<\/ul>\n<p>It helps to recompile the entire project after adding a new CODEC_ID just to make sure it &#8220;takes&#8221;. &#8216;ffmpeg -formats&#8217; should now report the new format. Proceed with development and debugging. Note that in libavcodec, printf()s are forbidden. Use av_log(NULL, AV_LOG_INFO, &#8230;) instead.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A little 101 course on writing FFmpeg demuxers and decoders&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,28],"tags":[],"class_list":["post-203","post","type-post","status-publish","format-standard","hentry","category-open-source-multimedia","category-programming"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.4 - aioseo.com -->\n\t<meta name=\"description\" content=\"A little 101 course on writing FFmpeg demuxers and decoders...\" \/>\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\/basic-ffmpeg-hacking\/\" \/>\n\t\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.4\" \/>\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=\"Basic FFmpeg Hacking | Breaking Eggs And Making Omelettes\" \/>\n\t\t<meta property=\"og:description\" content=\"A little 101 course on writing FFmpeg demuxers and decoders...\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/multimedia.cx\/eggs\/basic-ffmpeg-hacking\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2006-02-16T06:36:15+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2006-09-01T03:56:49+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Basic FFmpeg Hacking | Breaking Eggs And Making Omelettes\" \/>\n\t\t<meta name=\"twitter:description\" content=\"A little 101 course on writing FFmpeg demuxers and decoders...\" \/>\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\\\/basic-ffmpeg-hacking\\\/#article\",\"name\":\"Basic FFmpeg Hacking | Breaking Eggs And Making Omelettes\",\"headline\":\"Basic FFmpeg Hacking\",\"author\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/author\\\/multimedia-mike\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/#organization\"},\"datePublished\":\"2006-02-15T22:36:15-08:00\",\"dateModified\":\"2006-08-31T20:56:49-07:00\",\"inLanguage\":\"en-US\",\"commentCount\":2,\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/basic-ffmpeg-hacking\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/basic-ffmpeg-hacking\\\/#webpage\"},\"articleSection\":\"Open Source Multimedia, Programming\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/basic-ffmpeg-hacking\\\/#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\\\/open-source-multimedia\\\/#listItem\",\"name\":\"Open Source Multimedia\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/category\\\/open-source-multimedia\\\/#listItem\",\"position\":2,\"name\":\"Open Source Multimedia\",\"item\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/category\\\/open-source-multimedia\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/basic-ffmpeg-hacking\\\/#listItem\",\"name\":\"Basic FFmpeg Hacking\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/basic-ffmpeg-hacking\\\/#listItem\",\"position\":3,\"name\":\"Basic FFmpeg Hacking\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/category\\\/open-source-multimedia\\\/#listItem\",\"name\":\"Open Source Multimedia\"}}]},{\"@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\\\/basic-ffmpeg-hacking\\\/#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\\\/basic-ffmpeg-hacking\\\/#webpage\",\"url\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/basic-ffmpeg-hacking\\\/\",\"name\":\"Basic FFmpeg Hacking | Breaking Eggs And Making Omelettes\",\"description\":\"A little 101 course on writing FFmpeg demuxers and decoders...\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/basic-ffmpeg-hacking\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/author\\\/multimedia-mike\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/author\\\/multimedia-mike\\\/#author\"},\"datePublished\":\"2006-02-15T22:36:15-08:00\",\"dateModified\":\"2006-08-31T20:56:49-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":"Basic FFmpeg Hacking | Breaking Eggs And Making Omelettes","description":"A little 101 course on writing FFmpeg demuxers and decoders...","canonical_url":"https:\/\/multimedia.cx\/eggs\/basic-ffmpeg-hacking\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/multimedia.cx\/eggs\/basic-ffmpeg-hacking\/#article","name":"Basic FFmpeg Hacking | Breaking Eggs And Making Omelettes","headline":"Basic FFmpeg Hacking","author":{"@id":"https:\/\/multimedia.cx\/eggs\/author\/multimedia-mike\/#author"},"publisher":{"@id":"https:\/\/multimedia.cx\/eggs\/#organization"},"datePublished":"2006-02-15T22:36:15-08:00","dateModified":"2006-08-31T20:56:49-07:00","inLanguage":"en-US","commentCount":2,"mainEntityOfPage":{"@id":"https:\/\/multimedia.cx\/eggs\/basic-ffmpeg-hacking\/#webpage"},"isPartOf":{"@id":"https:\/\/multimedia.cx\/eggs\/basic-ffmpeg-hacking\/#webpage"},"articleSection":"Open Source Multimedia, Programming"},{"@type":"BreadcrumbList","@id":"https:\/\/multimedia.cx\/eggs\/basic-ffmpeg-hacking\/#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\/open-source-multimedia\/#listItem","name":"Open Source Multimedia"}},{"@type":"ListItem","@id":"https:\/\/multimedia.cx\/eggs\/category\/open-source-multimedia\/#listItem","position":2,"name":"Open Source Multimedia","item":"https:\/\/multimedia.cx\/eggs\/category\/open-source-multimedia\/","nextItem":{"@type":"ListItem","@id":"https:\/\/multimedia.cx\/eggs\/basic-ffmpeg-hacking\/#listItem","name":"Basic FFmpeg Hacking"},"previousItem":{"@type":"ListItem","@id":"https:\/\/multimedia.cx\/eggs\/#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/multimedia.cx\/eggs\/basic-ffmpeg-hacking\/#listItem","position":3,"name":"Basic FFmpeg Hacking","previousItem":{"@type":"ListItem","@id":"https:\/\/multimedia.cx\/eggs\/category\/open-source-multimedia\/#listItem","name":"Open Source Multimedia"}}]},{"@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\/basic-ffmpeg-hacking\/#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\/basic-ffmpeg-hacking\/#webpage","url":"https:\/\/multimedia.cx\/eggs\/basic-ffmpeg-hacking\/","name":"Basic FFmpeg Hacking | Breaking Eggs And Making Omelettes","description":"A little 101 course on writing FFmpeg demuxers and decoders...","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/multimedia.cx\/eggs\/#website"},"breadcrumb":{"@id":"https:\/\/multimedia.cx\/eggs\/basic-ffmpeg-hacking\/#breadcrumblist"},"author":{"@id":"https:\/\/multimedia.cx\/eggs\/author\/multimedia-mike\/#author"},"creator":{"@id":"https:\/\/multimedia.cx\/eggs\/author\/multimedia-mike\/#author"},"datePublished":"2006-02-15T22:36:15-08:00","dateModified":"2006-08-31T20:56:49-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":"Basic FFmpeg Hacking | Breaking Eggs And Making Omelettes","og:description":"A little 101 course on writing FFmpeg demuxers and decoders...","og:url":"https:\/\/multimedia.cx\/eggs\/basic-ffmpeg-hacking\/","article:published_time":"2006-02-16T06:36:15+00:00","article:modified_time":"2006-09-01T03:56:49+00:00","twitter:card":"summary","twitter:title":"Basic FFmpeg Hacking | Breaking Eggs And Making Omelettes","twitter:description":"A little 101 course on writing FFmpeg demuxers and decoders..."},"aioseo_meta_data":{"post_id":"203","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:48:37","updated":"2025-12-31 18:25:28","seo_analyzer_scan_date":null,"focus_keyword":null,"additional_keywords":null,"truseo_locale":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\">\u00bb<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/multimedia.cx\/eggs\/category\/open-source-multimedia\/\" title=\"Open Source Multimedia\">Open Source Multimedia<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">\u00bb<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tBasic FFmpeg Hacking\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/multimedia.cx\/eggs\/"},{"label":"Open Source Multimedia","link":"https:\/\/multimedia.cx\/eggs\/category\/open-source-multimedia\/"},{"label":"Basic FFmpeg Hacking","link":"https:\/\/multimedia.cx\/eggs\/basic-ffmpeg-hacking\/"}],"_links":{"self":[{"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/posts\/203","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=203"}],"version-history":[{"count":0,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/posts\/203\/revisions"}],"wp:attachment":[{"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/media?parent=203"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/categories?post=203"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/tags?post=203"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}