<?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>Penguin Dreams &#187; coreavc</title>
	<atom:link href="http://penguindreams.org/tag/coreavc/feed/" rel="self" type="application/rss+xml" />
	<link>http://penguindreams.org</link>
	<description></description>
	<lastBuildDate>Thu, 24 Jun 2010 19:50:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>1080 Video in Linux with CoreAVC</title>
		<link>http://penguindreams.org/blog/1080-video-in-linux-with-coreavc/</link>
		<comments>http://penguindreams.org/blog/1080-video-in-linux-with-coreavc/#comments</comments>
		<pubDate>Wed, 28 Jan 2009 14:57:01 +0000</pubDate>
		<dc:creator>sumdog</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[1080p]]></category>
		<category><![CDATA[coreavc]]></category>
		<category><![CDATA[hd]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[installation]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mplayer]]></category>

		<guid isPermaLink="false">http://penguindreams.org/?p=191</guid>
		<description><![CDATA[I&#8217;ve got an old Pentium D 920. Over two years old, with the right ffmpeg options for mplayer and frame dropping enabled, this CPU can still play H.264 720p video at amazing quality in Linux. However, all 1080p and 1080i60 (camcorder M2TS files) choke horribly. The video drags, audio skips and the video is totally [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve got an old Pentium D 920. Over two years old, with the right ffmpeg options for mplayer and frame dropping enabled, this <span class="caps">CPU </span>can still play <span class="caps">H.264</span> 720p video at amazing quality in Linux. However, all 1080p and 1080i60 (camcorder <span class="caps">M2TS </span>files) choke horribly. The video drags, audio skips and the video is totally unwatchable. In my search for a better video codec, I came across <a href="http://www.coreavc.com">CoreAVC</a>, a closed source commercial codec for Windows, as well as the <a href="http://code.google.com/p/coreavc-for-linux/">coreavc-for-linux</a> project: an attempt to use those closed source drivers with various media players in Linux. </p>

<p>Unfortunately, the installation documents for coreavc-for-linux were months old, out-of-date and had few corrections for new bugs. The following are some of the common errors I found as well as the solutions I&#8217;ve found to get the trail version of the CoreAVC codec working on my Gentoo Linux system. <br />
<span id="more-191"></span></p>

<h3>Installation</h3>

<p>To start the installation, I created a new working directory within my home directory and checked out both the latest versions of mplayer and coreavc-for-linux (revision 82 for coreavc-for-linux and revision 28381 for mplayer). I then ran the configuration script for mplayer, applied the direct show patch from the coravc-for-linux project and proceeded to build mplayer:</p>



<pre class="sh_sourceCode sh_sh">
mkdir coreavc
cd coreavc
svn checkout http://coreavc-for-linux.googlecode.com/svn/trunk/ coreavc-for-linux
svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer
cd mplayer
./configure
patch -p0 &lt; ../coreavc-for-linux/mplayer/dshowserver.patch
make
</pre>



<p>At this point the new version of mplayer is ready. Rather than use the <code>make install</code> command, I wanted to keep this version of mplayer totally separate. So I copied the two executables I wanted directly to <code>/usr/local/bin</code> with new names like so:</p>



<pre class="sh_sourceCode sh_sh">
su
cp mplayer /usr/local/bin/mplayer-coreavc
cp mencoder /usr/local/bin/mencoder-coreavc
</pre>



<p>At this point we have mplayer installed, but not the codec itself or the directshow server. We&#8217;ll start with the codec first. You can signup for a free trial on the <a href="http://www.coreavc.com">official CoreAVC website</a>. I would suggest the trial version first to make sure the codec works on your system. The download contains an executable installer, so you can either install it onto a windows system or install it using wine. After the install, copy the installed codec to the <code>/usr/lib/win32</code> directory. The following example assumes you used wine. Your directory names may be different.</p>



<pre class="sh_sourceCode sh_sh">
cd ~
su
cp ~/.wine/drive_c/Program\ Files/CoreCodec/CoreAVC\ 14\ Day\ Trial\ Edition/CoreAVCDecoder.ax /usr/lib/win32/
</pre>



<p>Before we go further we&#8217;ll install the directshow server. The wiki has <a href="http://code.google.com/p/coreavc-for-linux/wiki/DshowserverInstall">instructions</a> for compiling the server or using a precompiled binary. If you&#8217;re like me, you&#8217;re running a 64-bit system and can therefor not compile the binary from source. Doing so will give you a pretty massive compile error with several <i>warning: &#8216;<i>stdcall</i>&#8216; attribute ignored</i> messages from <code>interfaces.h</code>. </p>

<p>If you have a 32-bit linux system available, either real or a <span class="caps">VM, </span>or if you have somehow mastered the magic of cross compiling (I gave up on this years ago when I tried building a cross compiler for <span class="caps">PPC</span>), you can probably make this binary yourself. If you used the latest precompiled binary in the <a href="http://code.google.com/p/coreavc-for-linux/downloads/list">downloads section</a> (r63 for Gentoo at the time of this writing) along with the 1.8.5 release of CoreAVC, you will get the following fault when trying to run it:</p>



<pre class="sh_sourceCode">
/usr/local/bin/dshowserver -c CoreAVCDecoder.ax -s 1280x720 -g 09571a4b-f1fe-4c60-9760de6d310c7c31 -b 12 -f 0x34363248 -o 0x30323449
No id specified, assuming test mode
Opening device
len: 992
ProductVersion: 1.8.5
Called unk_LoadImageA
Segmentation fault
</pre>



<p>This is due to a know issue with the 1.8.5 release of CoreAVC adding a dialog box in the initialization which is documented in <a href="http://code.google.com/p/coreavc-for-linux/issues/detail?id=62">Issue #62</a> and in a <a href="http://blog.mymediasystem.net/avchd/problems-with-coreavc-185-on-linux/">posting on Acmelabs&#8217; Blog</a>. In a <a href="http://blog.mymediasystem.net/avchd/coreavc-185-on-ubuntu/">later post</a>, Acmelab gives his readers a precompiled version of release 77 which I&#8217;ve made a copy of for download: <a href="/files/progs/dshowserver-ia32-r77-acme.tar.bz2">dshowserver-ia32-r77-acme.tar.bz2</a></p>

<p>Untar this file and copy the <code>dshowserver/dshowserver</code> and <code>loader/registercodec</code> binaries to your <code>/usr/local/bin</code>.</p>

<p>Now that you have the directshow server installed, you&#8217;ll need to add the trial serial number into mplayer&#8217;s virtual windows registry. The following command is known to work with version 1.7.0 and 1.8.5 of CoreAVC. Additional registry options can be found on the <a href="http://code.google.com/p/coreavc-for-linux/wiki/RegisterCoreAVC">wiki</a></p>



<pre class="sh_sourceCode sh_sh">
export REGISTRY=$HOME/.mplayer/registry32
registercodec -r $REGISTRY -k 
&quot;HKLM\\Software\\CoreCodec\\CoreAVC Trial\\Serial&quot; -v &quot;55555-55555-CORE-55555-55555&quot;
</pre>



<p>If you&#8217;re using the full version, you&#8217;d replace the word <em>Trial</em> with <em>Pro</em>. At this point you should be able to run the following command to test the codec:</p>



<pre class="sh_sourceCode sh_sh">
/usr/local/bin/dshowserver -c CoreAVCDecoder.ax -s 1280x720 -g 09571a4b-f1fe-4c60-9760de6d310c7c31 -b 12 -f 0x34363248 -o 0x30323449
</pre>



<p>You should get the following response:</p>



<pre class="sh_sourceCode">
No id specified, assuming test mode
Opening device
Called unk_IsDebuggerPresent
len: 992
ProductVersion: 1.8.5
Decoder supports the following YUV formats: YUY2 UYVY YV12 I420 
Decoder is capable of YUV output (flags 0x2b)
Setting fmt
Starting
Initialization is complete
</pre>



<p>You may get a serial number issue here. If you do, go back and check your registry key. Now the only thing left is the <code>~/.mplayer/codec.conf</code></p>

<p>Using the 28381 build of mplayer, I constantly got the following error using the <a href="http://code.google.com/p/coreavc-for-linux/wiki/MplayerInstallation">default instructions</a> for the <code>codec.conf</code>:</p>



<pre class="sh_sourceCode">
==========================================================================
Forced video codec: coreserve
Cannot find codec matching selected -vo and video format 0x3267706D.
Read DOCS/HTML/en/codecs.html!
==========================================================================
</pre>



<p>Also, using the default instructions on a current built of mplayer can also lead to seeing this error in the mplayer output:</p>



<pre class="sh_sourceCode">
This codecs.conf is too old and incompatible with this MPlayer release!
</pre>



<p>This is because newer version of the codecs.conf must have a <em>release</em> line at the top of the file to prevent conflicts with other codec configurations as stated in <a href="http://code.google.com/p/coreavc-for-linux/issues/detail?id=61">issue #61</a></p>

<p>After playing with my configuration file a lot and with no results, I eventually found a configuration file in <a href="http://code.google.com/p/coreavc-for-linux/issues/detail?id=28#c14">comment 28 on issue 14</a> that worked. I&#8217;ve made the configuration file available here as well: <a href="/files/progs/codecs.conf">codecs.conf</a></p>

<h3>Playback</h3>

<p>When running mplayer-coreavc, you made need the following options to force mplayer to use coreavc and also to have smooth playback. Obviously, replace the example file I have with an HD movie you have on your file system. </p>



<pre class="sh_sourceCode sh_sh">
/usr/local/bin/mplayer-coreavc -vc coreserver -framedrop -nocorrect-pts  /media/files/movies_HD/Wall-E_720p_DTS_BluRay.mkv
</pre>



<p>If you&#8217;re like me, you don&#8217;t use a frontend to mplayer and prefer to have the terminal output. If so, you can create these little scripts that will pop-up mplayer in a terminal and then use them from the &#8220;open with&#8221; menu in your favorite file manager:</p>

<p><code>/usr/local/bin/coreavc-ac3</code></p>


<pre class="sh_sourceCode sh_sh">
#!/bin/sh
gnome-terminal -e &quot;mplayer-coreavc -vc coreserver -framedrop -nocorrect-pts -ac hwac3 \&quot;$1\&quot;&quot;
</pre>




<p><code>/usr/local/bin/coreavc-dts</code></p>


<pre class="sh_sourceCode sh_sh">
#!/bin/sh
gnome-terminal -e &quot;mplayer-coreavc -vc coreserver -framedrop -nocorrect-pts -ac hwdts \&quot;$1\&quot;&quot;
</pre>



<p>The -ac options for <span class="caps">AC3 </span>or <span class="caps">DTS </span>allow for media that has embedded multi-channel audio in either Dolby Digital (AC3) or Sony (DTS) format to go through the digital output of your sound card and directly to a 5.1 surround sound receiver (if you have both a digital out on your sound card and such a receiver).</p>

<h3>Conclusions</h3>

<p>I made this guide because many of the guides I&#8217;ve seen were out of date and the steps I had to undertake spanned multiple websites, blogs and wikis. Keep in mind that if you&#8217;re reading this six months from now, this guide is probably out of date itself and there are probably never versions of CoreAVC, coreavc-for-linux and mplayer, all with new an fun interesting bugs that will take you an hour to figure out. If you find any other helpful information, please post a comment.</p>

<p>As far as the actual performance of the CoreAVC codec, it is considerably faster than ffmpeg. There is somewhat of a lag or frame delay effect I see with movies which I don&#8217;t see in ffmpeg. I&#8217;m guessing this is coming from the directshow server. However with 1080p content, the video decodes much faster and is very smooth without constant bumps and clicks, even when going through the considerable amounts of translation required to run a windows 32-bit native codec in a 64-bit Linux environment.</p>

<p>There are still a couple of artifacts I&#8217;ve found and distorted/garbage video during fast motion scenes. This may be due to the codec specific registry settings which I&#8217;ll need to play with, or it may be I&#8217;m exceeding the limitations of my processor. Your own mileage may vary.  </p>]]></content:encoded>
			<wfw:commentRss>http://penguindreams.org/blog/1080-video-in-linux-with-coreavc/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>
