How to encode video for playback on Falcon

by

For some years available there is that nice software called “Aniplayer”. Its capable of replaying audio and video files of several formats. Those video files you have on your PC’s and laptops are, however, most likely not playable on the Falcon, even if powered up with a whopping 100 MHz ct63 upgrade.

Either the file is replayed without picture or audio, or Aniplayer rejects the file with some ‘codec xyz not supported’ message. Its also possible that it gets replayed in speed of a snail on Valium…

But somehow it had to be possible, i was sure.

So i tried various tools, encoders and codecs and came to a solution that finally enables to replay fullscreen video with enjoyable audio quality.

So, what is my goal? What its not?

I want the best possible video playback i can reach with a Falcon 060. I am not really looking for the most efficient compression (although i try not to make unnessecary large files).

Some basic conclusions right here in front:

  • Aniplayer can do Xvid in 320×200 but only manages to depack 15 frames per second
  • Aniplayer can decode mp2/mp3 audio but video stutters horribly then
  • mpeg2 needed a hardware decoder on Pentium 1 class PC, remember?
  • Radius Cinepak codec depacks with a lot less CPU work, no problem at 320×240, 30 fps
  • for audio stream wave or Microsoft ADPCM works good
  • use native Falcon clocks to avoid high cpu load and clicks/cracks

Needed Tools:

  • PC with Windows XP/Vista/7
  • XviD [1] and DivX [3] installed (some files need one or other)
  • VirtualDub [2]
  • optionally some tools to convert your wanted source (DVD or MP4/MKV/whatever) into AVI

That last point i use ‘SUPER’ [4] for, which is a frontend to various commandline de/encoder and tools. Here on my machine it works (most of the time) but crashes sometimes, too. Your mileage may vary.

Here we go!

First thing is of course getting a source video you want to encode. For this howto, we should take something easy available. Try it with this file on your setup, and after the result works for you, too, proceed with the video of your choice.

Connect to internet and download the fr-025 video [5]

Save it in a folder of your choice, i suggest making a new one that ends with /source. Also create a folder that holds the encoded Falcon videos.

Launch VirtualDub and choose File -> Open File. Point to your source folder, choose the popular demo.

Now choose Video -> Filter . Click Add and select resize. The config dialopgue of the added filter appears, check Pixels: Absolute and Aspect Ratio: disabled. Now enter destination size: 320×152 for this very widescreen video. The cinepak codec is fine with multiples of 8, so you should check that, too. If you enter a size not a multiple of 8, VirtualDub will choose the next matching size for you. We do not crop or letterbox anything here, so close the dialogue.

Some videos look a bit too dark on my Falcon, so in that case i also add filter Brightness/Contrast and and slighty brighten up the video by around 5%.

Now select File->File information. You see, our fr-025 video is 640×320, 60 fps. The size we already scale, but 60 fps is too much for the Falcon. Close the infobox, choose Video->Frame Rate. Here check Frame Rate conversion and enter 30 fps. If your source Video is 50fps, convert it to 25fps – logically 25 and 30 fps video don’t need any framerate conversion. A mistake here, like converting a 25 fps video to 30 fps or similar will result in subtle but annoying stutter of video playback.

Now go to Video-> compression and choose the cinepak by Radius. The quality slider has no effect on the cinepak codec, so check use target rate of and enter 350 kilobytes/second. Feel free to experiment with your quality/size tradeoff.

Now we move on to the audio stream. Select Audio->Interleave and enter Interleave audio every 1 frame. Also, enter 500 ms in the Audio skew correction field. Not that i knew why, but this is the key to get 100% synced Audio. If your video’s audio does not sync, play around here to make it match.

Next check Audio->Full processing mode and then open Audio->Conversion. We don’t want to have the CPU need to resample the audio during playback so we check Custom and enter one of the native Falcon frequencies.

Those are 49170, 32780, 24585, 19668, 16390, 12292, 9834, 8195 Hz. A very good quality you get with 32780. This is the sample rate, and the highest frequency you can replay with that rate is half of the sample rate. So 32780 is good for audio up to 16kHz and good enough. If you’re keen on filesize, save 30% by entering 19668 without a too big impact on quality. Select 16 Bit precision and check High quality . Using Stereo is okay, but of course takes twice the size. Decide what you need. For the howto we use 32780 stereo.

If you need to keep filesize down, compress audio with ADPCM. Its by no means a lossless compression and, especially in more quiet parts, compression is audible. When converting an STe demo with YM chiptune you’ll hardly notice, though.

The bandwitdh usage below is before compression, anyway. This leads to the next point, choose Audio->compression. Here you select the audio compression Microsoft ADPCM, then click the “32,780Khz, 4bit, stereo” option. I’d have liked to choose the IMA ADPCM instead, but that one adds annoying clicking to the Falcon audio. Feel free to try it. You see, we now use ‘only 33kByte/s for audio, not the 129 kByte/s without compression.

Sometimes the source audio is too loud. Your mediaplayer on the PC won’t have a problem with that, it softclips during playback. The ADPCM encoder doesn’t do that, so, to avoid problems here, you may open the Audio->Volume window, check the Adjust volume of audio channels checkbox and lower the volume to 90%. This is safe for me and i use it by default.

Okay, this is what we needed to do to start encoding! The process with your own source video will most likely need some trial and error, to find matching aspect ratio for example. Here the job control comes in handy: Select File-> Queue batch operation->Save as AVI… and choose the destination filename and folder for example D:/videos/Falcon converted/fr-025.avi . Nothing happens, but the Options we entered are now stored along with this job. Press F4 or open File->Job control and you find the prepared jobs. You can enter many jobs and let them encode overnight, and you can select a job and press Reload button, which enters all the options of that particular job into VirtualDub. So, you can save some jobs as a kind of template, reload it, and then only select File->Open video file to choose a different source, all other setting stay as in the job you reloaded.

But this is for your later work. Now we want to encode: Choose File->Save as AVI and point to your destination folder, choose your filename. Now have a coffee with your GF or similar. If you abort the encode, you can test the partly saved AVI on your Falcon, good for testing.

The resulting file you can transfer to your Falcon and open it with Aniplayer. Check ‘No GEM’ to get fullscreen, truecolor display.

Using a FAT32 formated CF card on the Falcon’s IDE bus, i can flawlessly replay a 2 GB large movie (That was the largest i ever made, unrestricted video bitrate, 32.780 kHz wave Audio uncompressed)

If you want to try out how good the results are before you install the software and go through the howto, you can download some videos of Atari ST/STe/Falcon Demos, that do not run on a Falcon060 usually [6]

Cheers!

I’m pretty sure you have also ideas on how to improve video quality more, mpeg1 video might be a way between cinepak and xvid – but i had no success there yet.

And by the way, now that you know where to tweak in VirtualDub: if you reduce destination resolution to 160×80  (unrestricted video bitrate) and choose 16390 Hz Audio, the resulting video  will replay on a stock 16MHz Falcon030, too.


Links:

  1. xvid
  2. virtualdub
  3. divx
  4. Super
  5. fr – 025 video
  6. sample videos

4 Responses to “How to encode video for playback on Falcon”

  1. Michel Says:

    Thanks for all the tweaks to run video on a Falcon.
    I’ve tested on a stock falcon with your last specification, and it works pretty well. Funny to watch south park episodes or others, and with sound!

  2. CiH Says:

    Beetle, this is a very very useful article. At some point I will get around to playing with some of the ideas in my article. You can’t have enough CT60 compatible movie files, and there aren’t enough of these, unless they are very old ones 😉

  3. YERZMYEY/H-PRG Says:

    BeetleF060: dude, this text is brilliant. Many thanx for the 030 infos, I’m grateful. Of course everything works perfectly on my stock Falcon 4Mb. However I noticed that VirtualDub crashes (too) often when it encounters newer AVI files. A pity.

  4. YouTube on the Falcon! « LowRes Says:

    […] https://lowresmag.wordpress.com/2010/05/15/how-to-encode-video-for-playback-on-falcon/ […]

Leave a comment