{"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":[],"_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}]}}