Wednesday, January 21, 2009

Another overflow, or it looks like

Had a few large mp4 files unable to play on adobe flash player. The threshold happens to be 2 GB (overflow of a signed integer, it must be). Here is a bullet from Adobe Flash Player 9 release notes

  • Flash Player cannot progressively load files that are greater than 2Gb (210223)
I hope my guess was wrong. It would have been a low bug then.

Thursday, January 8, 2009

MP4Box - Out Of Memory

It wasn't this easy to find out.  It all started from when I was trying to convert my son's favorite dinosaur DVD's to h264 files.  I have a script, that calls for ffmpeg, feeding in parameters, and have the h264 files generated to the directories I want, then run MP4Box to hint them.  There were a dozen of them.  Encoding h264 isn't anything for the impatient.  So I left it running.  Day after day, there were some new h264 file created.  Then all done, finally.  But I found 2 largest VOB files (4.4 GB and 4.3 GB) ended up to be converted to mp4 files of 68 bytes each.  Bummer!

Of course I first thought it was ffmpeg, that it might have overflow problem.  Long story short, it was not.  I suddenly remembered that there was MP4Box hinting invoked at the end of the script.  Then I broke it into 2 steps, or course, ffmpeg got me a good unhinted mp4 file.  While I tried to run MP4Box on it, it gave me 

[iso file] Read Box "..A." failed (Out Of Memory)

I was using MP4Box from gpac 0.4.4.  Upgrading to gpac 0.4.5 fixed it.  What was unbelievable was 0.4.5 wasn't out until Dec 2008.  And until then, no one had such problem?  MP4Box isn't anything new to world.  Neither is DVD.  How come the fix isn't out until a month ago?  Weird.

A little side story on this.  When I first upgraded it, I did not see the upgrade fixing the problem.  What happened was that I made a build with the new source code, and ran the new MP4Box locally.  It did not work because it was pulling the libgpac.so from system directory, which was still the older version, because I did not "make install" the new version yet.  Seeing it not working, I was so pumped up to fix it myself.  So I loaded up ddd debugger.  That was where I found out it was using the libgpac.so of the older version.  So that took me no time.  Just that I did not get to have the sense of accomplishment.  But I am happy it is working now.

Monday, November 24, 2008

burn cd / dvd

CD --

mkisofs -f -U -iso-level 4 -R -x unused_dir 59m/59mh | cdrecord -v -pad speed=1 dev='/dev/scd1' -

In this command, "-f" makes it follow symbolic link. 59m/59mh is the src dir. What will be burnt into the CD everything under this dir recursively. But 59m or 59mh will NOT be in the image. /dev/scd1 is the cdrom device.

DVD --

Unsure if this can be piped. But breaking it down to 2 steps works fine

mkisofs -f -U -iso-level 4 -R -x unused_dir src | growisofs -dvd-compat -Z /dev/scd1=/dev/fd/0

(http://ubuntuforums.org/showthread.php?t=363666)

Wednesday, October 15, 2008

ripping an audio cd on linux

Still in the after shock of losing my Windows system.  This time I need to rip an audio cd.  Well everything can be done on Linux.  No doubt about that.  And can be done in easier ways, and funner.  Just that you need to find it.  Yes, Google made it possible.  Also credits go there...

cdparanoia -wB -d/dev/cdrom
for i in *.wav; do lame -b 192 $i `basename $i .wav`.mp3; done

Power of collective talents!

Thursday, September 11, 2008

the evil CSS, region cod, etc.

Typically technologies are enablers.  DVD is far from being the newest technology, but it makes easy and quality yet at home movies watch experiences possible.  DVDs are affordable, if you don't travel.

There are other "technologies", that are rather blockers.  They are there to make something not working for paid users, in hopes that (abiding) users pay double or multiple.  Among the most evils, is this DVD region + css thing.  Someone decided that DVD buyer only can see a DVD in 1 geographic region by paying once.  If you want to see your favorite movie in Japan while you already purchased a DVD in U.S., you still have to pay for another copy in Japan.  If you travel globally, you better not want to watch different movies, otherwise you have to pay for the same thing 7 times.  And whats worse, you better not buy DVDs outside your region, because your home DVD player is not supposed to be able to play them, after 5 times region switches.  Or you must pay a hefty fee to the player manufacturer to get you addition 5 region switches.  All but you are the winners.  Good deal!

Losers, forced ones, don't get to be good citizens, not voluntarily.

My new toy, that 24" iMac, lovely as it is, has a Matsushita UJ-875 DVD rom in it.  Most late DVD ROMs have region control in firmware.  In this case using a region relaxed player ain't cutting it.  For many of such RPC2 ROMs, http://forum.rpc1.org is a good place to look for upgrade firmware.  Nothing else on earth deserves the word UPGRADE more.  I am unlucky.  Searching with my Matsushita version DB09 gets me no goody.  
I do have another box, a Ubuntu Hardy Heron.  It is headless (no monitor connected to it).  So viewing needs to be on iMac.  Playing directly on Ubuntu via ssh and pipe the raw frames to iMac is not an option.  It takes too much bandwidth than my LAN can handle, 480x720x30(fps)x8x4(32 bit) = ~320 Mbps.  I think my router is the bottle neck, but I am not sure.  Wikipedia tells me full duplex ethernet gets only 200 Mbps.  This would not be enough either.
Sharing Ubuntu DVD ROM seems a natural solution.  But I was unable to find how to share DVD via nfs.  I would certainly guess it is possible, why would it not be?  Sharing via samba made it work, however.  Two plain tricks.  One is I had to install libdvdnav, libdvdread, and libdvdcss on Ubuntu.  I found this surprising.  So the shared DVD ROM is not receive IO commands and then reading the binary out to the remote machine, but receives DVD commands.  Second, the original movie player on iMac does not work with this approach.  No idea why not.  But at least VLC works.  So I am happy.
While googling, I found a software called k9copy.  It is said to work like DVD Shrink on windows.  Just downloaded and made a build.  Will mess with it one day, when my son orders me to make a copy for him.  It won't be long.

Monday, September 1, 2008

svn server set up

Today I set up a svn server on my Ubuntu.   Since I am good at losing my works, thought svn might be a good help.  I don't have a good grasp on cvs, and pretty close to hating it.  svn on the other hand is closer to clearcase that I am most used to.  So that was my choice.  Well, clearcaes would have been nice, just that it surely would be an overkill, and non open source.

To get to the meat, first this very nice site got me a jump start - http://www.section6.net/wiki/index.php/Setting_up_Subversion_in_Linux

I already had svn installed.  But to follow the instructions, I did 

apt-get install subversion-tools python-subversion libsvn-perl
mkdir /svnroot
svnadmin create /svnroot
vi /svnroot/conf/svnserve.conf (set proper configs, commends are explanatory) 
vi /svnroot/conf/authz (to add rw account to /)
vi /svnroot/conf/passwd (to add account / password pairs)
vi /etc/init.d/svnserve (paste in the bash script provided by the above mentioned blog)
chmod +x /etc/init.d/svnserve
update-rc.d svnserve defaults
/etc/init.d/svnserve start

Unless I forgot something, these were all I did.  It was pretty simple and quick, and working (more importantly).  Not bad, eh?

Saturday, August 30, 2008

"find" performance on windows ntfs vs linux ext3

Just for the heck of it, I ran a find command to look for the same file under the same relative path, in (Cygwin over) Windows and in Linux.  The performance is ~50 times difference. Guess who is faster :) .  Add more to the twist, my Windows machine is a Core 2 Duo @ 2.13 Gig (each, of course), with 2.5GB ram; Linux is running on a Pentium-4 @ 2.8 Gig, single core, 2GB ram.

Cygwin over Windows:
ztang@LV017554 /cygdrive/c/same_folder_tree_node 
$ time find . -name b.bat
./b.bat

real 0m9.290s
user 0m1.483s
sys 0m7.796s


Linux
ztang@ubuntu2:~/projects/same_folder_tree_node$ time find . -name b.bat
./b.bat

real 0m0.196s
user 0m0.056s
sys 0m0.136s