Author Archives: Multimedia Mike

Baldur In Bulk

I got those Baldur’s Gate videos converted to something more modern. The problem turned out to be in the Interplay MVE demuxer code I wrote long ago for FFmpeg. Once upon a time, timestamps in FFmpeg were supposed to be in reference to a 90 kHz clock. Thanks to Pengvado for pointing out that my demuxer still made that assumption. Fixing the demuxer seems like a lot of work right now. So at this point in the exercise, I opted to simply hard code 15 fps for the framerate.

So I got that transcoding process underway, finally. And I made an interesting discovery along the way. I have a colleague who has this quote on his office whiteboard:


Baldur's Gate Nietzsche quote

I can only conclude that said colleague is a huge Baldur’s Gate fan.

Prerequisites for the transcoding operation (basic Kubuntu 8.04 virtual machine):

  • install the libfaac-dev package
  • download and manually compile YASM (required by x264 and the latest YASM packaged by Ubuntu is not bleeding edge enough)
  • download and compile the latest x264 snapshot; configure with –enable-shared
  • get the latest SVN of FFmpeg
  • configure and build FFmpeg with: configure –enable-gpl –enable-postproc –enable-avfilter –enable-avfilter-lavf –enable-swscale –enable-libx264 –enable-libfaac; I don’t really know if all the filter options are strictly necessary for this exercise but I’m used to them by now

So my process for transcoding in bulk after installing this software is:

  • use my Python script (parse-bif-graf.py, listed at the end of this post) to split the BIF resource into its constituent MVE files:
    $ parse-bif-graf.py MovieCD1.bif
    extracting file #0 at offset 132, 29654204 bytes, to 'MovieCD1.bif-0.mve'
    extracting file #1 at offset 29654336, 6530954 bytes, to 'MovieCD1.bif-1.mve'
    [...]
    
  • bulk transcode:
    for mve in `ls *.mve`
    do 
      ffmpeg -y -i $mve \
      -acodec libfaac -ab 128k \
      -vcodec libx264 -vpre hq -b 500k -bt 500k \
      `basename $mve .mve`.mp4
    done
    [...]
    

The resulting files are highly competitive, size-wise, against the original MVE files. At first, I was monkeying with the bitrate because there were some annoying artifacts in the high motion areas. But then I watched the original videos using ffplay and realized that those artifacts are artifacts in the source material.

Continue reading →

Hero Of The Samples Archive

Check out compn’s project/goal, listed on his MultimediaWiki user page, which he affectionately refers to as the Sample Challenge:

  1. start with older files
  2. google the filename to see if it was posted to the mplayer/ffmpeg mailing list
  3. do a search at http://bugzilla.mplayerhq.hu and http://roundup.mplayerhq.hu to see if it was posted there
  4. if no text file exists, try playback using mplayer and ffplay
  5. move sample to appropriate place and create/modify bugreport or delete

For extra credit, write up a brief description in the MultimediaWiki with cursory findings.

Godspeed, compn.

Migrating iTunes Libraries

I have been migrating from Windows XP to Mac OS X as my primary home computing solution. Why? Because I’m looking for entirely new reasons to hate computers, reasons that Linux and Windows just cannot provide.

The migration process has made me very aware of data investment and the cost of migrating platforms when you have been using one for a long time. This applies to closed and open software alike. When switching from Linux to Windows XP and then to Mac OS X, I have stayed with Mozilla’s Firefox web browser and Thunderbird mail client. Why not try more integrated solutions such as Apple’s Safari and Mail apps? Frankly, because I already have so much data invested into Mozilla’s solutions, and because it is absolutely trivial to migrate an entire installation between machines and even platforms (find the main data directory, copy the thing wholesale to its counterpart location on another machine, and update the top-level profiles.ini file with the correct directory path).

Apple’s iTunes presented a bigger challenge. I scanned many blogs for a solution and finally hit upon something that worked. I’m pretty sure I’m expected to blog about exactly how I got my iTunes library migration to work.

Problem statement:
Migrate an existing iTunes library from Windows XP to Mac OS X. Latest version of all OSes and iTunes at the time of this writing (iTunes 8.0(35) on Mac; whatever the latest iTunes 8.0 on Windows is).

What worked:

  • On Windows iTunes, “Consolidate library” — make sure the entire library is under iTunes management
  • browse to “My Documents\My Music\” and copy the entire iTunes\ directory up to a shared network drive, whole
  • On Mac OS, exit iTunes if it is running
  • go to Music/ directory in home directory and delete existing iTunes directory (this assumes you have not accumulated any media there yet or else this will destroy it)
  • copy iTunes/ directory from shared network drive, whole, into the Music/ directory
  • this is iTunes 8 so delete the iTunes Library Genius.itdb file that just got copied over or else suffer an iTunes #13026 error
  • important, “secret-sauce”-style step: press and hold the Option key while invoking iTunes; this will make iTunes prompt for an existing library; navigate to and select Music/iTunes/iTunes Library.itl

And that’s how I solved the problem for myself. I don’t know why it didn’t occur to me to hold down some random meta-key while invoking the program to attain the desired behavior. Somehow, magically, iTunes is able to sort out all of the music paths. I don’t know what format the .itl file takes but my best guess is that it must store paths relative to the top level iTunes directory. What I know is that all the media shows up correctly as does the proper metadata, a.k.a., my year+ data investment.

Anyway, if you want to try to replicate my steps, I hope you’re migrating fresh and don’t have anything valuable on the destination machine.

What didn’t work:

  • Monkeying with the plaintext XML file. Have I ever mentioned how much XML annoys me? Several blogs and forums offered the solution of copying all media but none of the database files, just the XML files with manually modified absolute path names. This actually seems quite reasonable but perhaps it’s iTunes 8 that isn’t fooled by this.
  • Transfer via iPod: This is evidently an official Apple solution but is unworkable for me since my library is larger than my iPod.
  • Transfer via series of optical discs: This is another official Apple solution. Allegedly, it backs up your library and associated metadata to a series of DVDs and another computer with iTunes is just supposed to notice the disc and start restoring. I tried this. iTunes wrote the first of a series of DVDs. Then it prompted me for the second while it kept spinning the DVD up and down. When it finally surrendered the first disc and I inserted the second disc… iTunes just sort of forgot what it was doing and blew off the remainder of the backup operation.
  • Probably a few other failed approaches that I am blocking out right now…

Psychotron Story Arc

I’m still on this game hacking kick. Today’s target is The Psychotron, perhaps the most painful interactive movie game I have ever seen. Thing is, I have to admit that I have never actually played this game; I am judging the game purely on the plain Cinepak/PCM AVI files that comprise the key feature of the game. I don’t even own the full game, only a demo. Granted, I have tried to play the Psychotron demo but could never make it work. These 1994 multimedia-heavy games…


Psychotron gangsters

Whereas the conversations in Flash Traffic: City of Angels were packed in a quasi-compressed binary format, the conversation tree in Psychotron is stored in a series of .SEG files that look like the file S5H1PD1.SEG here:

\scene5\s5h1Pd1.avi*from 23 to 283*3*Fold.*10*S5h1r1.seg*Bet a large amount.*1000*s5h1r2.seg*Bet a small amount.*500*s5h1r3.seg*

Pretty straightforward to figure out. It also helps me understand a technical matter about the game that irritated me so much when I viewed the FMV files standalone– when you view the game’s files in a standalone player, you will see that they invariably start paused with tracking lines (apparently digitized from a VCR). I am guessing that the game uses the field “from 23 to 283” to describe which frames of the file are meant for human consumption.

Anyway, I wrote a Python script to print out a Graphviz-compatible spec to map out the game demo’s dialog tree. Warning! There might be spoilers in the tree!


Pyschotron demo flowchart
Click for full image

Click for Graphviz source

Ah, who am I kidding? No one cares about spoilers in this alleged story. It is interesting to note that 2 of those trees don’t correlate to any of the scenes on the disc.

The Python source code for generating the graph is below. I finally ordered the full game from an eBay seller the other day so I am wondering if the graphing utility will be applicable to the full game.

Continue reading →