{"id":684,"date":"2010-08-24T04:08:31","date_gmt":"2010-08-24T08:08:31","guid":{"rendered":"http:\/\/www.briancbecker.com\/blog\/?p=684"},"modified":"2020-04-12T19:45:34","modified_gmt":"2020-04-12T23:45:34","slug":"my-extreme-frustration-at-windows-video-libraries","status":"publish","type":"post","link":"http:\/\/www.briancbecker.com\/blog\/2010\/my-extreme-frustration-at-windows-video-libraries\/","title":{"rendered":"My extreme frustration at Windows Video Libraries"},"content":{"rendered":"<p>I hate them. No seriously. They are terrible. In fact, I&#8217;ll go further and say that dealing with video programatically through C++ has plagued me for almost a decade now. The scenario is this: I&#8217;ve recorded some video from one of my experiments and now I want to post-process it and overlay some visualizations on it, so I need a program to read it in. I was using OpenCV with Visual C++ 2008, which includes ffmpeg, but it crapped out on me with an nice error message:<\/p>\n<blockquote><p>Compiler did not align stack variables. Libavcodec has been miscompiled and may be very slow or crash. This is not a bug in libavcodec, but in the compiler. You may try recompiling using gcc &gt;= 4.2. Do not report crashes to FFmpeg developers.<\/p><\/blockquote>\n<p>Yeah nice. Plus, OpenCV&#8217;s video support via ffmpeg doesn&#8217;t support 64-bit programs. I messed around with recompiling with different options and doing some quick web-searching, but didn&#8217;t find any easy solutions. So what to do? Well I could go directly to Microsoft&#8217;s solution of DirectShow via DirectX but that requires an insane amount of setup and often times the DirectX SDK doesn&#8217;t even compile cleanly with the latest versions of Visual Studio. I remembered I had solved this problem years ago in my time at Robotics Lab @ UCF by compiling all the DirectX stuff into a DLL so you could just include the header file and go. So I dug that up and compiled it just fine, but then it crashed because it was compiled with Visual C++ 2005 runtime DLLs. And of course you can&#8217;t mix &amp; match. I wasn&#8217;t about to recompile from source because that meant setting up DirectX SDK.<\/p>\n<p>So I had heard good things about ffmpeg and\/or gstreamer as being generic video libraries with lots and lots of codes available. But unfortunately, ffmpeg developers are a big slobby about Visual C++ (with good reason since it&#8217;s not standards complaint), but it&#8217;s a super pain. So after a long arduous journey of like 5 hours, I finally arrived at using gstreamer&#8217;s Windows SDK to compile an ffmpeg sample that loaded a video and wrote out the first 5 frames to disk as ppms.<\/p>\n<p>I&#8217;m thinking of creating a generic video server over sockets or shared memory so I never have to compile in the video\u00a0 reading\/writing stuff every again (at least until the binaries break). I don&#8217;t know, is there a good Windows Video Library that I&#8217;m missing?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I hate them. No seriously. They are terrible. In fact, I&#8217;ll go further and say that dealing with video programatically&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10,9],"tags":[],"class_list":["post-684","post","type-post","status-publish","format-standard","hentry","category-cc","category-code"],"_links":{"self":[{"href":"http:\/\/www.briancbecker.com\/blog\/wp-json\/wp\/v2\/posts\/684","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.briancbecker.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.briancbecker.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.briancbecker.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.briancbecker.com\/blog\/wp-json\/wp\/v2\/comments?post=684"}],"version-history":[{"count":3,"href":"http:\/\/www.briancbecker.com\/blog\/wp-json\/wp\/v2\/posts\/684\/revisions"}],"predecessor-version":[{"id":1312,"href":"http:\/\/www.briancbecker.com\/blog\/wp-json\/wp\/v2\/posts\/684\/revisions\/1312"}],"wp:attachment":[{"href":"http:\/\/www.briancbecker.com\/blog\/wp-json\/wp\/v2\/media?parent=684"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.briancbecker.com\/blog\/wp-json\/wp\/v2\/categories?post=684"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.briancbecker.com\/blog\/wp-json\/wp\/v2\/tags?post=684"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}