Sunday, May 25, 2008

Compiling AVIDemux on 64-bit Linux distro

AVIDemux is the best tool to rip DVDs, re-encode videos and edit them on the fly.

Sometimes it's a pain in the neck to compile stuff, especially on a 64-bit distro that has 32-bit compatibility libraries. Thankfully, guys at the Slamd64 forums are quite helpful in these matters.

I had an old copy of avidemux (version 2.3.0) which I worked on. I tried compiling the latest (version 2.4.1) but it requires "cmake" which I didn't have install, and didn't feel like going through the headache of finding its dependencies.

magic lines:
export LDFLAGS="-L/usr/lib64"
CFLAGS="-O2 -fPIC" ./configure --prefix=/usr \
--sysconfdir=/etc --libdir=/lib64 --includedir=/usr/include \
--with-jsapi-include=/usr/include/seamonkey-1.0.7/js/ --with-include-gettext
make -j4
make install

Without exporting LDFLAGS properly, you'll get an error like this:
/usr/lib/libXext.so: could not read symbols: File in wrong format

It was picking up the 32-bit lib instead of the 64-bit one. Exporting LDFLAGS properly solved this issue.

If you get something like this:
rm -f cs.gmo && : -c --statistics -o cs.gmo cs.po
mv: cannot stat `t-cs.gmo': No such file or directory

Make sure you have this in your configure line:
--with-include-gettext

* Found this in a RedHat archived text from 2004.

Friday, May 23, 2008

Compiling MPlayer on 64-bit Linux Distro

I had one H264 video which prevented the location bar to move and at some point, the audio would lead the video, and if I attempt to skip that part, it would play from start.

I thought it was Xine's fault for not being able to run the file properly, so I check whether there's a newer version or not, and there was so I updated, and Xine stopped working. No big deal, I had mplayer, but unfortunately it had the same old problems as Xine with that file.

Some guys suggested that the version I had of the H264 codec was compiled for a 32-bit distro, and it doesn't play well under 64-bit ones. That could be fixed with a recompile.

After some poking around at Slamd64 forums, I found some things that can help and this configure line made all the magic happen:
CFLAGS="-O2 -fPIC" ./configure --confdir=/etc --prefix=/usr --libdir=/usr/lib64 \
--with-extralibdir=/usr/lib --enable-gui --enable-largefiles \
--win32codecsdir=/usr/lib/codecs --codecsdir=/usr/lib/codecs \
--xanimcodecsdir=/usr/lib/codecs --realcodecsdir=/usr/lib/codecs

MPlayer was compiled fine and worked fine, but I still have problems with that bloody video file. I tried re-encoding it using avidemux on my laptop (32-bit Kubuntu), but avidemux kept crashing.

Oh well, MPlayer works fine now, at least.

Saturday, March 22, 2008

Finding The Fastest Host

I play on Server 3 of Travian UAE, and the domain name s3.travian.ae points at 19 different hosts, and most are slow for me.

The lines below show how to get the server with the lowest average ping time. This assumes the servers will reply to ping requests (only one doesn't), and that you're not blocking ping requests from your end.

for i in $(host s3.travian.ae | awk '{print $4}'); do echo -n "$i:" >> trav.txt \
&& ping -qc5 $i | tail -n1 | cut -d/ -f5 >> trav.txt; done
sort -t: -k2 trav.txt | head -n1
rm trav.txt

Put the result in /etc/hosts and you're all set! This should save you time when querying for DNS, and wouldn't depend on your luck at which server you get (even though Travian employ round robin)

* This is not to be used with any website, since most have MX records (mail server records) and the script above doesn't work in such cases.

* You can remove the backslashes above and write the whole thing in one line. I put on multiple lines to make it readable.

The script is no longer useful since they moved to one server now. Seems like they distribute to multiples during registration period.