<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>my tech blog &#187; mencoder</title>
	<atom:link href="http://billauer.se/blog/tag/mencoder/feed/" rel="self" type="application/rss+xml" />
	<link>https://billauer.se/blog</link>
	<description>Anything I found worthy to write down.</description>
	<lastBuildDate>Thu, 12 Mar 2026 11:36:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>Some blurbs about tweaking mplayer&#8217;s codecs</title>
		<link>https://billauer.se/blog/2009/12/canon-codec-decoder-h264-listdll/</link>
		<comments>https://billauer.se/blog/2009/12/canon-codec-decoder-h264-listdll/#comments</comments>
		<pubDate>Fri, 11 Dec 2009 17:34:08 +0000</pubDate>
		<dc:creator>eli</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[500d]]></category>
		<category><![CDATA[canon]]></category>
		<category><![CDATA[clsid]]></category>
		<category><![CDATA[codec]]></category>
		<category><![CDATA[decoder]]></category>
		<category><![CDATA[guid]]></category>
		<category><![CDATA[h.264]]></category>
		<category><![CDATA[mencoder]]></category>
		<category><![CDATA[mplayer]]></category>
		<category><![CDATA[slr]]></category>

		<guid isPermaLink="false">https://billauer.se/blog/?p=405</guid>
		<description><![CDATA[The (non-) problem The truth is that there never was a problem. What really happened was that I got things confused between a few versions of mplayer/mencoder, and only the latests (of those I have, 1.0rc1-3.2.2) does the job. Bus since I wrote down some things I might want to return to some day, here&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<h3>The (non-) problem</h3>
<p>The truth is that there never was a problem. What really happened was that I got things confused between a few versions of mplayer/mencoder, and only the latests (of those I have, 1.0rc1-3.2.2) does the job. Bus since I wrote down some things I might want to return to some day, here&#8217;s the whole blob.</p>
<p>What got me on this, was that using mplayer (version 1.0 of some rc&#8217;s) to play my Canon 500D&#8217;s movie clips, I get the sound OK, but an image which flashes the real thing every now and then (keyframes?) and shows some grey garbage otherwise. And tons of error messages on the console.</p>
<p>On some other version the image looks OK, but A/V sync is lost soon enough. And many error messages indicate that the decoder doesn&#8217;t get it right (a lot of &#8220;Consumed only 136509 bytes instead of 1365120&#8243; alikes). That isn&#8217;t very promising.</p>
<p>It&#8217;s worth to note, that mplayer/mencoder choose the native ffmpeg libavcodec by default. As ffmpeg improves, these issues are fixed.</p>
<p>My real goal is to convert the clip to something descent using mencoder. I don&#8217;t even think about editing a video in H.264. So all I need now is to find the right video decoder.</p>
<p>But I prefer to use the decoder supplied by Canon (spoiler: I never managed to). Since I own the camera, and got the software legally, why not use the codec they sent me? Only one problem&#8230;</p>
<h3>What is the DLL of the codec used?</h3>
<p>In order to &#8220;steal&#8221; the codec from the Canon application, I needed to know which DLL Canon uses to play its own videos. In order to do that, I opened Zoombrowser, and ran the ListDLL command line utility (which can be downloaded from <a href="http://download.sysinternals.com/Files/ListDlls.zip" target="_blank">here</a>). The utility spits out all DLLs of all processes running, but using the &#8220;&gt;&#8221; redirection in a command window, all data goes to a file. Then I double-clicked a video, and ran ListDLL again, redirecting the data to another file.</p>
<p>The difference between the files is most probably the DLLs loaded to play a clip. This worked because I ran Zoombrowser from scratch.</p>
<p>With my favourite diff application, I got a long list of new DLLs. These two caught my eyes:</p>
<pre>C:\Program Files\Canon\Canon MOV Decoder\CanonH264Filter.ax
C:\Program Files\Canon\Canon MOV Decoder\CanonIPPH264DecLib.dll</pre>
<p>Hmmm&#8230;  In retrospective, I could have figured that one out without heavy tools. But at least I know which they are now.</p>
<h3>Installing the codec</h3>
<p>I copied both files mentioned above to /usr/local/lib/win32. Then I added the following entry to the /usr/local/etc/mplayer/codecs.conf:</p>
<pre>videocodec canonh264
  info "Canon's H.264 decoder"
  status working
  fourcc avc1,AVC1
  fourcc h264,H264
  fourcc x264,X264
  driver dshow
  dll "CanonH264Filter.ax"
  guid 0xb7215ee3, 0xaf54, 0x433f, 0x9d, 0x2f, 0x22, 0x64, 0x91, 0x69, 0x84, 0xf6
  out YUY2
  out BGR32,BGR24,BGR15</pre>
<p>As for the output formats, I guessed them. Odds are I got it wrong.  As for the GUID, I managed to find a class with a &#8220;FriendlyName&#8221; saying &#8220;Canon H.264 Decode Filter 1.3&#8243;, and it has the class ID B7215EE3-AF54-433F-9D2F-2264916984F6. So basically that&#8217;s it.</p>
<p>Anyhow, this didn&#8217;t work at all. When I ran mencoder with -vc canonh264, it ended with</p>
<pre>Forced video codec: canonh264
Opening video decoder: [dshow] DirectShow video codecs
Called unk_GetVersionExW
Segmentation fault</pre>
<p>I won&#8217;t even try to pretend that I understand what went wrong here, but GetVersionExW happens to be a function exported from Windows&#8217; kernel32.dll, retrieving information about the current operating system. I&#8217;m not clear on whether the function was never found, or if the decoder wasn&#8217;t happy with the answer it got. This way or another, a segfault is a segfault. I thought this was the place to give up. I&#8217;ll use the good old ffmpeg decoder.</p>
<h3>A remark about H.264</h3>
<p>Canon&#8217;s choice of H.264 as the encoding format is a bit bizarre, since it&#8217;s a version of MPEG-4. And just for general knowledge: MPEG-4 is horrible. In particular it has this annoying thing about stale regions in the frame, which look bad and basically don&#8217;t heal. But I suppose that MPEG-2 would require too fast writes to the flash or something. The result is still pretty bad.</p>
<h3>Summary</h3>
<p>Trying to fix video issues late at night is not necessarily the wisest thing to do.</p>
]]></content:encoded>
			<wfw:commentRss>https://billauer.se/blog/2009/12/canon-codec-decoder-h264-listdll/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
