PDA

View Full Version : Divx, transcode, Zoom Player, xine.


Deacon
28-05-2003, 06:56:11
http://www.divx.com/divx/
http://www.theorie.physik.uni-goettingen.de/~ostreich/transcode/
http://www.inmatrix.com/zplayer/
http://xinehq.de/


Divx is a video compression/decompression scheme. It lives in AVI files that also contain audio compressed with some sort of audio compression/decompression scheme.

Transcode is a pain in the ass to install, but I was able to actually get it going after going to doom9.net. It can take audio and video encoded with one scheme and "transcode" it with some different scheme. Specifically, I was looking for a Linux DVD utility to rip from DVD. I was able to trascode a DVD's MPEG-2 video and AC3 audio into an AVI with Divx 4 video and MP3 audio.

Zoom Player uses much less CPU than Windows Media Player when playing Divx videos. The player bundled with the Divx windows codec is buggy because I've got 3 different MP3 codecs installed, and it could not find a single one of them when I wanted to play my shiny new AVI file. So I downloaded Zoom Player. It's got a decent UI too, and doesn't screw up the aspect ratio like PowerDVD does. Unless you want to, in which case there's a preferences option to mess up the aspect ratio.

Xine is for Linux video playback. It does DVDs and Divx videos, so I like it alot. It also doesn't chew up the CPU. CPU usage is important because if your machine can't keep up, video playback will suffer.

Sir Penguin
28-05-2003, 07:09:09
XviD is a pain in the ass to install. Until you search for '+xvid +windows +binary' on Google. Damned Linux people.

SP

Deacon
28-05-2003, 07:56:09
I tried XviD first, but then I gave up and downloaded DivX.

The Doom9 site suggested avifile.sourceforge.net. I went there and got the divx4linux-20020418 and binaries-011002 tarballs. I then made a divx-custom tarball by putting the binaries-011002 tarball inside the divx4linux-20020418 tarball, so that when you unpack the divx-custom tarball and cd into the divx-custom directory, you'll see the divx4linux-20020418 subdirectory and the binaries-011002 tarball.

I then used this nifty build script after unpacking my custom tarball.

cd /usr/src/divx-custom || exit 0
lfs-dir-compare before
install -d /usr/lib/win32
tar -jxvf binaries-011002.tar.bz2 -C /usr/lib
cd divx4linux-20020418
mv install.sh install.sh.old
sed install.sh.old -e "s/usr\/local/usr/g" > install.sh
sh install.sh
cd /usr/src
rm -rf *
lfs-dir-compare after

The lfs-dir-compare script is something I made to track what files are being plunked onto my system.

RIGHTNOW=`date +%Y%m%d-%H%M%S`
BEFF=~/files-before.txt
AFTF=~/files-after.txt

case $1 in

before)
find /bin /boot /dev /etc /lib /opt /sbin /usr > $BEFF
;;

after)
find /bin /boot /dev /etc /lib /opt /sbin /usr > $AFTF
diff $BEFF $AFTF | grep ">" | sed "s/>/rm -rf/g" | tac > ~/"rm-$RIGHTNOW.sh"
chmod 755 ~/"rm-$RIGHTNOW.sh"
diff $BEFF $AFTF | grep "<" | sed "s/< //g" > ~/"removed-$RIGHTNOW.txt"
`$0 cleanup`
;;

cleanup)
rm -f $BEFF $AFTF
;;

*)
echo "Usage: $0 {before|after|cleanup}"
;;

esac

exit 0

Deacon
28-05-2003, 08:33:07
The transcode source tarball has the libmp3lame, libmpeg2, and libac3, and libdvdread sources, so DivX and libdvdcss are the only other things needed before installing transcode.

I opted to use transcode 0.6.3 because it was the latest version of transcode that's not in the "pre" directory at the FTP site. Call me superstitious.

The options for transcode are somewhat baffling. For some odd reason, it took me two tries with exactly the same command line (taken more or less from the transcode site's Example section) before I was able to rip the DVD. Odd.

transcode -i /dev/dvd -x dvd -T 1,-1 -g 720x480 -M 2 -V -X 2,0 -Y 80,8 -s 1.743 -o test.avi -y divx4 -w 700 -f 23.976024

I'm going to go back and install nasm (and then reinstall transcode) to see if it makes any difference or if weirdness is just part of a working transcode installation.

Deacon
31-05-2003, 02:29:45
New and exciting developments.

I upgraded to the snapshot 0.6.7 release. I also upgraded my divx4linux to 20030428. Now it's possible to encode Divx 5. I also tried ABR audio before reading that non-CBR audio is outside the AVI specs and could lead to sync problems. I also figured out how to do 2-pass encoding. It takes twice the time, but improves the quality greatly.

2 pass script for a particular DVD. I had to analyze vidcaps of brightly-lit frames to determine how much of the top and bottom to chop off to get rid of the black bars.

FLAGS="-x dvd -T 1,-1 -M 2 -V -X 2,0 -Y 122,0,118,0 -w 1515 -f 23.976024"
VCODEC="divx5"
R1="-y $VCODEC,null -o /dev/null -R 1,vid.log"
R2="-y $VCODEC -o lifeforce.divx -s 1.743 -b 160 -E 44100 -R 2,vid.log"

case "$1" in
pass1)
transcode -i /dev/dvd $FLAGS $R1
;;
pass2)
transcode -i /dev/dvd $FLAGS $R2
;;
*)
echo "Usage: $0 {pass1|pass2}"
exit 1
;;
esac

exit 0

DivX is nifty. I might even try XviD. AVIs are probably at their limit. The Ogg container format should allow VBR audio, since Vorbis is VBR.

Qaj the Fuzzy Love Worm
02-06-2003, 20:33:16
Define "exciting".

Darkstar
02-06-2003, 21:18:22
From Deacon's use of the world, I would have to say he means slightly less stimulating then watching paint dry.

Sir Penguin
02-06-2003, 21:22:37
Are you kidding? That rules!

SP

Qaj the Fuzzy Love Worm
02-06-2003, 21:43:40
Define "rules".

Sir Penguin
02-06-2003, 22:25:02
It's neat!

SP

Darkstar
02-06-2003, 22:45:01
I always suspected Sir Penguin was an expert in watching paint dry...

Deacon
03-06-2003, 00:29:59
I have reached the mountain top! :D

I removed both transcode and xine, installed XviD, and then re-installed xine and transcode. Now XviD works.

I'm playing with subtitles now. There's a copy of the subtitleripper package (programs are pgm2txt, subtitle2pgm, and srttool). To build, I needed NetPBM, and I edited the Makefile by changing -lppm to -lnetpbm. GOCR is needed by the pgm2txt script to do OCR on the PGM images containing the subtitles.

The subtitles were probably done with the world's worst font. GOCR had alot of trouble with formatting. I used Perl to remove double newlines. The rest was fixed by hand.

I used aspell to check the spelling, but it was far from perfect. For some reason, it would not work if I simply said "aspell -c subtitle*txt". So I wrote a perl program to dump all the text into one file, with the entries for each file delimited by a proper noun that's never spoken during the movie. Aspell did what it could, and then I went back and visually corrected the 961 entries. I then unsplit everything back to the original set of 961 text files so I could run srttool.

Looking at the SRT file, I noticed that the times given for the captions differ from the times shown by xine when I play the disc. The drift seems to go from -2 seconds to +6 seconds. I'm going to use it in the final OGM file anyway, just to see how bad it will be. I might try to get a better sense of the drift and write some super perl program to adjust things accordingly.

So now, I'm looking to create an OGM with XviD video, Vorbis audio, and subtitles in English. I figure I should try subtitles first to see how I like them.

Sir Penguin
03-06-2003, 01:04:30
Originally posted by Darkstar
I always suspected Sir Penguin was an expert in watching paint dry...

Scotty liked to read technical manuals. Picard liked to read Shakespeare. I like to read sh/Perl/Python/other scripts that do nifty things.

SP

Qaj the Fuzzy Love Worm
03-06-2003, 15:07:59
Yeah, but they're characters from Star Trek, so Darkstar's point stands :D

Sir Penguin
03-06-2003, 22:47:42
Damn the blurring of fantasy and reality!

SP

Deacon
04-06-2003, 05:44:13
Subtitles in OGMs suck.

They caused xine to freeze up during playback, and they were often cut off by the bottom of the picture. So due to the timing problems, freezing problems, and the fact that I'd have to waste bits on the black bars in order to give the subtitles space to display in, I think I'll just drop them. But VBR audio was all I wanted anyway.

Chapter info was accepted without problems by ogmmerge, but xine doesn't pay attention. Since the chapter data is tiny, I'll just leave it in.