| Encode video from Hatari » |
How to make 1080p50 Youtube videos from Hatari ST/STe-recordings
- Make sure "Drive led" is off
- Set frameskip to ZERO or OFF
- Make sure "Crop statusbar" in checked (avoids recording the statusbar)
- Set audio frequency to 50066 Hz (STe audio will then be 1:1 in the source material)
- Set video codec to PNG (slow, smaller) or BMP (big, faster)
- Set Hatari Max window size as:
For a program in ST-LOW with borders: 416*312
For a program in ST-LOW without borders: 320*216
For a program that is sometimes or always in ST-MED with borders: 832*624
For a program that is always in ST-MED without borders: 640*432
For a program in ST-HIGH: 640*432
The reason for extra Y-height is that Hatari includes it's statusbar in the calculation (stupid, but true)
We're going to use two tools, both are linked to in OS X versions, there should be Windows binaries at other places:
Ffmpeg is used to crop, pad, scale, re-encapsulate and encode the video that we send to Youtube. Yes it is commandline but it's the only tool
I found in a reasonable time that does what I want, with correct nearest neighbor scaling.
- Ffmpeg (commandline tool) - MANDATORY
I've compiled this for my system, if it doesn't run at your place, you need to get it from someplace else
- Mpeg Streamclip (GUI tool) - OPTIONAL
Get it from the Squared 5 site
Mpeg Streamclip is used to easily cut out start/ending and perhaps unintended pauses in the stream. Start/stop can be done with more
complex ffmpeg parameter as well. If you do not need to trim the video, Mpeg Streamclip is not needed.
Encoding the file for Youtube
The encoding is made in a single ffmpeg command, and need different parameters depending on the input video resolution (different crop and padding
applied). The scaling of pixels are made with nearest neighbor (no filter) so pixels are perfect without any blur or
fuzzyness. Scaling is also only made with integer, so they are only zoomed
up 2x, 3x, 4x, 5x and so forth. That ensures no odd-sized pixel that will happen.
So, here are the commandlines to use, they are a single line but the browser will show as several.
The finished file will be lossless and suitable for storage if you need it at a later time. It's a good source for any video site.
- ST-LOW 320*200 Hatari video
ffmpeg -i hatari.avi -vf "scale=1600:1000, pad=1920:1080:160:40:black" -sws_flags neighbor -vcodec png -acodec copy 1080p.mov
- ST-LOW 416*276 (incl. borders) Hatari video
ffmpeg -i hatari.avi -vf "crop=400:270:0:6, scale=1600:1080, pad=1920:1080:160:0:black" -sws_flags neighbor -vcodec png -acodec copy 1080p.mov
- ST-MED/ST-HIGH 640*400 Hatari video
ffmpeg -i hatari.avi -vf "scale=1280:800, pad=1920:1080:320:140:black" -sws_flags neighbor -vcodec png -acodec copy 1080p.mov
- ST-MED 832*552 (incl. borders) Hatari video
ffmpeg -i hatari.avi -vf "crop=800:540:0:12, scale=1600:1080, pad=1920:1080:160:0:black" -sws_flags neighbor -vcodec png -acodec copy 1080p.mov
Trim start/end of the video using Mpeg Streamclip
This part is only if you want to trim the start/ending or cut out uninteded waiting in the middle of the video. If that's not needed, stop here.
The 1080p .mov-file is ready to be loaded into Mpeg Streamclip. Once there, you set start of the movie with "i" and end of the movie with "o".
When both are set, select "File/Save As" and save it with a suitable filename. Voila, we now have a trimmed video file. It won't re-encode as our video file are single PNG-frames. It's good to remember that if you want to make a H.264 (or other distributable format) trim it first while the frames are separated.
You can also use ffmpeg with the -ss and -t parameters, see the ffmpeg manual for further details.
That's all folks!