VA-API and AMD XVBA

Lately i was just getting mad that i couldn’t watch any 1080p video on my desktop pc which has a Radeon HD4890 (ATI Catalyst 10.1) and a Phenom X3 730. MPlayer was even teasing me with this message…

************************************************
**** Your system is too SLOW to play this! ****
************************************************

this pisses me off, a lot…
so I decided to try to install VA-API with XVBA backend and the patches for mplayer to use it.

Since there is no packaging whatsoever for any of the things needed in ubuntu/debian repositories (not even in the unstable ones) i got the packages directly from splitted-desktop.

I got the latest xvba-video (0.6.4-1), libva(-dev) (0.31.0-1+sds9) packages (nice to see that VA-API has a frontend even for VDPAU by the way), and the latest version of MPlayer va-api patches (the full version contains mplayer code, the small one has a script to get it with svn).

The installation of the packages went fine, but to get mplayer compiled a run of
apt-get build-dep mplayer
is necessary to install all the development tools/headers and so on.

Then i used their bundled script “checkout-patch-build.sh” which does all the (as you may have already guessed) svn checkout, patching, building of mplayer.
It went flawlessy and in a while i got mplayer ready to run.

i tried it with a h264 1080p movie
./mplayer -vo vaapi -va vaapi movie.mkv
and it worked out like a charm, instead of hogging a CPU and still not doing real time decoding it was using only 8% of CPU time!

It is still unstable (at the moment, it works for me anyway) and the VA-API are not broadly implemented (hoping this will change in the near future, it provides Intel, Nvidia and ATI accelerated decoding at once!) but it really does it’s job well!
If you want to try more splitted-desktop has patches for gnash too

Advertisements

, , , , , , ,

1 Comment

Hamachi and UDP Broadcast Games

I was recently trying to play some old game (Starcraft, Warcraft 3, and others) in LAN with some friends through the hamachi VPN system. All attempts were unsucessful due to the fact that the broadcasted UDP packet weren’t sent over the VPN interface but only in the local LAN.

To solve this we just had to manipulate the routing table of the systems.
After connecting to the hamachi VPN just do these commands as root user

OS X: as long hamachi uses 5.x.x.x for his nodes
route add -net 255.255.255.255 5.255.255.255

Linux: where ham0 is the hamachi interface. There are 2 options available, test it out that works for you
route add -net 255.255.255.255 netmask 255.255.255.255 dev ham0

sudo route add -n 5.255.255.255 gw 5.0.0.1 dev ham0
as suggested from Blake Lightly

This will redirect all the broadcast packets, maybe it can interfere with some other program, but as long as you want some time off to play it works great. To clear the modification to the routing table we didn’t do anything else then disconnecting from the hamachi VPN, the system handles the disappareance of the interface removing every involved route.

Summing up*

Game Linux MacOS
Warcraft 3 play host
Starcraft host host
Delta Force host untested

* Linux has no other setup then just starting hamachi. This all was tested between a Mac and a Linux systems

If someone can test other games and maybe help on the linux problem that would be great.

Hope this helps!
[last update 2 May 2010]

, , , , , , , , ,

19 Comments

Rtorrent web interface

Me and alka wrote a web application in ruby which serves as an interface to rtorrent. It has been written in ruby using the ramaze and sequel frameworks. It
is currently tested on debian stable with mostly apt-get installed gems,
for more info check the README file included (the only one external to
the distribution should be the xmlrpc gem which is on another post in
this blog).
It supports authentication and accesses rtorrent through the unix socket
interface, allowing to run the server as a user process.
An internal copy of the information from rtorrent is stored in a
in-memory sqlite database (maybe it can be totaly avoided, but that was how we planned it in the beggining) to avoid to access too much times to rtorrent
along with the caching of pages in ramaze.

Currently may lack some feature, but it’s doing it’s job, the main
missing feature is the user interface. If someone can write a
CSS and maybe do some cleanup in the interface any help would be
appreciated.

As usual in the code page everything can be found or directly here
git://github.com/mellon85/rtorrent-wrb.git

It is currently no more developed as we switched torrent client. Patches or comment are welcomed

, , , , ,

Leave a comment

Portsfoster

Portsfoster is a debfoster clone i wrote in ruby for the Macports software distribution system.
It work in a similar way and helps you to have a clean MacPorts installation without ports you don’t want (or you forgot).

At start it will ask you if you want to purge inactive packages (or the program will leave them untouched). Then it will load all the installed ports and dependencies to check which are new (to his knowledge) and ask you if you want to keep them.

You you don’t keep a port the program will continue asking on the packets dependencies if they aren’t already locked for another port.

When done the list of “keep” packet will be saved in /opt/local/var/portsfoster as simple text with one package for line. You can delete or add manually if you need to.

Don’t worry if the program takes time to calculate all the dependencies, it gets the information through the port command and not analyzing the port files, and this takes some time…

You can find the link to the project in the code page or just here
git://github.com/mellon85/portsfoster.git

P.s.
Dont worry if the pogram reports that information about a port can’t be found. It means that the package has been localy installed (and it is not in the port tree) or that it has been installed and then removed from the port tree.
If you have a old installation of macports (say, older then this post at least) you may receive the warning on the render port. Just uninstall it, it is no more in the tree.

It has been discontinued and it is not working, it needs fixes to work.

, , , , , , ,

Leave a comment

4chan

I have written for testing purpose a script to download images that would have been posted on the website 4chan.org. I tried to let it go for 1 day.. I’ve got 2.7GB of data for 16661 images (the number tell me something about of what i have done).

Here’s the code

#! /usr/bin/ruby
# License: GPLv3 or newer

urls=['http://img.4chan.org/b/1.html',
    " ... other 4chan boards you want ..." ]

require 'rubygems'
require 'net/http'
require 'thread'

def download(url)
    uri = URI.parse(url)
    Net::HTTP.start(uri.host) { |h|
        page = h.get(uri.path)
        data = page.body.split(/(href=|\n)/).delete_if {
                               |x| !(x =~ /\"http/)}
        data = data.map {|x| x.gsub(/^\"/,'')}
        data = data.map { |x| x.gsub(/\".*/,'')}
        data = data.delete_if {|x| !(x =~ /(png|jpg|gif)$/)}
        data.uniq.each {|x| 
            img = x.gsub(/.*\//,'')
            if !File.exist?(img) then
                puts "downloading #{img}"
                resp = h.get(URI.parse(x).path)
                open(img,"wb") { |f|
                    f.write(resp.body)
                } 
            end
        }
        h.close
    }
end

threads = []
s = Mutex.new
urls.each { |x| 
    Thread.start{
        s.synchronize{
            threads << Thread.current
        }
        download(x)}
    }
while (threads.length != urls.length) do
    Thread.pass
    sleep(5)
end

threads.each{ |x| 
    begin 
        x.join 
    rescue Exception => e 
    end }
puts "finished"

, , , , , ,

2 Comments

rTorrent 0.8.4 and ruby-controller 0.2

Yesterday i switched to rtorrent 0.8.4 (debian build from experimental).

Rtorrent after some little adjustment in the configuration file has started working. I just had some problems with the torrent which i hadn’t completed.

Except these two little problems it just works, along with the ruby controller too (without any modification).
In the meanwhile I have added some little fixes to the controller and a new feature. 
Now the available upload bandwidth is decreased by a fraction of the actual rtorrent download speed.
This is done to prevent even further to rtorrent to make itself slower flooding the upload bandwidth with ack packets.

, ,

Leave a comment

Ruby rtorrent controller

Finnaly i had time to work on the rtorrent controller.
it works, that’s all i can say everyone will have to test it and fix the various values to setup the network for each own best performances.

There are many costants that may be configured to solve problems you may encounter with the configuration. Everything should be clear in the comments but i’ll try to add  more comments anyway when i have time.

With the configuration in the distribution (made for myself for my 2M adsl) i can have my sister doing video chats and playing online without any lag problem and when everything is finihed rtorrent autmatically will raise his own bandwidth limits.

There is currently a drawback. Rtorrent versions prior of 0.8.1 have a memory leak regarding xmlrpc-rtorrent communications. This means that rtorrent is going to eat all your ram. I am using the program monit to monitor my own servers and it’s  just trivial with it to keep rtorrent in a sane memory usare buy restarting it everytime it goes too far. Otherwise even a cronjob will do the trick restarting rtorrent every 1 or 2 days.

You can find the link to the project in the code page or just here
git://github.com/mellon85/ruby-rtorrent.git

, , , , ,

1 Comment