<?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; hd</title>
	<atom:link href="http://penguindreams.org/tag/hd/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>nVidia&#8217;s Hardware H.264 (1080p) codec for Linux</title>
		<link>http://penguindreams.org/blog/nvidias-hardware-h264-1080p-codec-in-linux/</link>
		<comments>http://penguindreams.org/blog/nvidias-hardware-h264-1080p-codec-in-linux/#comments</comments>
		<pubDate>Fri, 06 Feb 2009 19:25:32 +0000</pubDate>
		<dc:creator>sumdog</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[1080p]]></category>
		<category><![CDATA[hd]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[installation]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mplayer]]></category>
		<category><![CDATA[nvidia]]></category>
		<category><![CDATA[vdpau]]></category>

		<guid isPermaLink="false">http://penguindreams.org/?p=201</guid>
		<description><![CDATA[I spent a couple of hours getting a proprietary software H.264 codec working in Linux and even published a writeup to help others. A day later I learned from one of the people I sourced in my article that nVidia started releasing Linux drivers last November for the hardware high definition decoders found on the [...]]]></description>
			<content:encoded><![CDATA[<p>I spent a couple of hours getting a proprietary software <span class="caps">H.264 </span>codec working in Linux and even published a <a href="/blog/1080-video-in-linux-with-coreavc/">writeup</a> to help others. A day later I learned from one of the people I sourced in my article that nVidia started releasing Linux drivers last November for the hardware high definition decoders found on the 8xxx series of video cards as well as a customized version of mplayer to support the new drivers. </p>

<p>A mixture of emotions came across as I realized I wasted an entire day on a software decoder when a hardware solution was available for $30 to $40. The software solution was fairly disappointing, so I decided to try one of these new cards, an nVidia GeForce 8500 <span class="caps">GT, </span>to see if it provided a better solution. It took some work with my setup, but the results were worth it.  </p>

<p><span id="more-201"></span></p>

<p>The new interface from nVidia for hardware video decoding on Linux is known as the <em>Video Decode and Presentation <span class="caps">API </span>for <span class="caps">UNIX</span></em> or <span class="caps">VDPAU.</span> It&#8217;s been available officially since the release of the 180.22 nVidia Linux drivers in January of 2009, but has been available in beta drives since last November starting with 180.06. Drivers which support <span class="caps">VDPAU </span>will install special header files in <code>/usr/include/vdpau/</code> which are required to compile media players with <span class="caps">VDPAU </span>support.</p>

<p>The installation process is fairly straightforward. The patches for mplayer can be found on the <a href="ftp://download.nvidia.com/XFree86/vdpau/">nVidia <span class="caps">FTP </span>site</a>. The tarball contains not only the patch sets, but also a build script named <code>checkout-patch-build.sh</code>. As the name suggestes, the script checks out all the appropriate revisions of mplayer and its dependencies (libavcodec, libdvdread, etc) from a subversion repository, applies nVidia specific patches and compiles mplayer. The <code>README.txt</code> file in the package also suggests several free sample videos that can be used to test the new mplayer build.</p>

<p>To prevent conflicts with the copy of mplayer that may come with the Linux distribution and that is typically controlled by a package manager, I suggest manually installing the <span class="caps">VDPAU </span>version of mplayer by itself with its own name. The following are the commands I ran for both compiling and installation. Be sure to replace the tarball with the latest version available on the <a href="ftp://download.nvidia.com/XFree86/vdpau/">ftp site</a>.</p>



<pre class="sh_sourceCode sh_sh">
wget ftp://download.nvidia.com/XFree86/vdpau/mplayer-vdpau-3402051.tar.bz2
tar xvfj mplayer-vdpau-3402051.tar.bz2
cd mplayer-vdpau-3402051
./checkout-patch-build.sh
su 
cp ./mplayer /usr/local/bin/mplayer-vdpau
</pre>



<p>As stated earlier, the <code>README.txt</code> providers several sample files available to download to test out the decoder. I&#8217;d also suggest the following options when playing <span class="caps">H.264 </span>files:</p>



<pre class="sh_sourceCode sh_sh">
mplayer-vdpau -vo vdpau -vc ffh264vdpau -framedrop -nocorrect-pts &lt;filename&gt;
</pre>



<p>Both the <code>-framedrop</code> and <code>-nocorrect-pts</code> will help provider for smoother playback and may be helpful on older <span class="caps">CPU</span>s. On machines that can handle the playback, they shouldn&#8217;t degrade the video quality.</p>

<p>You may get an error such as the following along with no video window being displayed: </p>



<pre class="sh_sourceCode sh_sh">
Cannot find codec matching selected -vo and video format 0x31637661
</pre>



<p>This is most likely the result of having a <code>~/.mplayer/codecs.conf</code>. Current versions of mplayer do not require a <code>codecs.conf</code> as one is compiled into the player itself. A stray configuration file will override the built-in defaults and remove the nVidia provided codecs. You may see this error if you had followed my <a href="http://penguindreams.org/blog/1080-video-in-linux-with-coreavc/">previous tutorial</a> on implementing software <span class="caps">H.264 </span>decoding.</p>

<p>Fixing this issue involves either deleting the file, renaming the file or combining the <code>codecs.conf</code> in your home directory with the patched one located in nVidia&#8217;s <code>mplayer-vdpau</code> build directory.</p>

<p>Another issue can arise if you have a multi-seat system; that is a system with multiple X servers each with their own monitor, keyboard and mouse configuration. In such an environment, it is essential that the X server you want to use the <span class="caps">VDPAU </span>card with comes up first. The video card does not need to be in the first <span class="caps">PCI</span>-E slot. Mine resides in the second:</p>



<pre class="sh_sourceCode sh_sh">
 # lspci | grep nVidia
01:00.0 VGA compatible controller: nVidia Corporation NV42 [GeForce 6800 XT] (rev a2)
02:00.0 VGA compatible controller: nVidia Corporation GeForce 8500 GT (rev a1)
</pre>



<p>However in the greeter configuration file, the server that holds the GeForce 8500 card I want to use for decoding must be listed first. In my case, I use gdm on Gentoo Linux which uses <code>/etc/X11/gdm/custom.conf</code> to define server startup:</p>



<pre class="sh_sourceCode">
[servers]
0=Plasma
1=Console

[server-Plasma]
name=Plasma server
command=/usr/X11R6/bin/X -layout Plasma -novtswitch -sharevts -isolateDevice PCI:2:0:0
flexiable=true

[server-Console]
name=Console server
command=/usr/X11R6/bin/X  -layout Console -novtswitch -sharevts -isolateDevice PCI:1:0:0
flexiable=true
</pre>



<p>When I got the <span class="caps">VDPAU </span>mplayer up and running, I was very impressed by the results. Some video still jumped and sputtered in placed, but nothing too distracting from the video considering the high bitrates and quality. There was also occasional screen tearing where one frame partially overlapped a previous one. I&#8217;ve read turning off the X composite extension may help alleviate this problem although I haven&#8217;t tried this yet. </p>

<p>I&#8217;m glad nVidia is realizing the importance of capitalizing on the Linux market. <span class="caps">ATI </span>is trying to catch up with their own <a href="http://blog.mymediasystem.net/avchd/radeon-hd-video-driver/">RadeonHD</a> drivers. Linux support will be essential as it&#8217;s an ideal platform for embedded systems such as <a href="http://www.nvidia.com/object/sff_ion.html">nVidia&#8217;s Ion</a>. It could open up an entire realm of possibilities for small, affordable, set-top box and media PC solutions. </p>]]></content:encoded>
			<wfw:commentRss>http://penguindreams.org/blog/nvidias-hardware-h264-1080p-codec-in-linux/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<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>
