How to record Atari videos with Hatari
======================================

Getting best output from Hatari
-------------------------------

* Do NOT use external recorders (such as Quicktime X on OSX), as they
  won't get perfect framerate and sound sync like Hatari itself does

* Disable (default) frame skip, either from the Hatari GUI, or with
  following command line option:
  	--frameskips 0

* For STe you could set audio to 50066 Hz using ST table, either from
  the Hatari GUI, or with following command line options:
	--sound 50066 --ym-mixing table


Getting better performance
--------------------------

By default Hatari will:
* Scale its framebuffer to (approximately) same size regardless of
  Atari resolution (= Atari monitor emulation)

* Use its highest AVI compression method (PNG)

* Use most accurate target machine emulation

But all these are quite CPU intensive, and can together make recording
very slow.

It is better to:

* Use "--max-width" and "--max-height" options to limit the (recorded)
  Hatari framebuffer size to (smaller) original Atari resolution, both
  to speed up compression and (significantly) reduce resulting video
  size. For example, if you don't need overscan borders, use this for
  ST-low resolution:
	--max-width 320 --max-height 200

  + To have Hatari window contents still shown at a usable size on
    larger displays, ask Hatari framebuffer to be scaled to its window
    with "--zoom" option (requires Hatari to be built with SDL v2):
	--zoom 2 --max-width 320 --max-height 200

* Select suitable AVI compression method (see next section)

* When recording Falcon programs, if program doesn't use DSP, disable
  it with "--dsp none"

* When recording TT and Falcon programs, one could disable also CPU
  cache emulation with "--cpu-exact off" when recorded program works
  fine without cycle-exact emulation


Hatari AVI compression notes
----------------------------

If Hatari is configured/built with PNG development installed headers
(normal case with Linux distros and pre-built binaries), Hatari will
use PNG compression to produce smaller AVI recordings.

Additionally, by default Hatari will use the highest PNG compression
level (same as with screenshots), but this is *really* CPU intensive.

Because of the PNG compression CPU usage, you could try using
uncompressed BMP format instead:
	--avi-vcodec bmp

If that takes too much disk space, next best option is to ask Hatari
to use lower compression level, e.g:
	--png-level 4

Valid compression levels are 0-9, with 9 being default/highest/slowest.


Preparing videos for uploading
------------------------------

If the end goal is Youtube, it is recommended to run Hatari's AVI
output through ffmpeg to do nearest neighbor upscale to 1080p. Then
Youtube will keep the 50 FPS and you have non-fuzzy pixels in the
recording.

This ffmpeg line should do the trick for a 320x200 stream (5x scale):
  ffmpeg -i hatari.avi -vf "scale=1600:1000, \
    pad=1920:1080:160:40:black" -sws_flags neighbor \
    -vcodec png -acodec copy youtube1080p.mov

And for a 416x276 stream (so you get the overscan area as well, 4x scale):
  ffmpeg -i hatari.avi -vf "crop=400:270:8:0, scale=1600:1080, \
    pad=1920:1080:160:0:black" -sws_flags neighbor -vcodec png \
    -acodec copy youtube1080p.mov

Above adds padding to 1920*1080 size, that can be removed if you trust
the re-encoder/player to scale properly (which has been known to
fail). It also saves the stream as PNG so it is manageable to upload
and store for future.

(Upload information is based on atari-forum post by "evil":
http://atari-forum.com/viewtopic.php?f=51&t=27595#p268185 )
