This is a retro computing just-for-fun project. AGAConv is a CDXL video converter for Commodore-Amiga computers. It combines several exisiting tools to convert videos (MP4, etc.) into the CDXL format which can be played with AGABlaster on an AGA Commodore-Amiga computer. The first Commodore-Amiga computer with the AGA chipset was released in 1992. Commodore went bankrupt in April 1994.
The CDXL format was created by Commodore primarily for the Commodore CDTV, released 1991, to permit playback of video from CD-ROM in the early 1990s. The CDXL format is a simple streaming format, consisting of linear concatenated chunks (packets), each with an uncompressed frame and associated audio data. In addition to the original 12-bit colors, AGAConv also supports 24-bit colors, as supported by Commodore Amiga AGA systems released in 1992+. It also ensures 32-bit padding of CDXL chunks, which can make a difference in video frame rate of up to 50%.
Overview of supported video/audio modes:
AGAConv was tested on Ubuntu 18.04 and on Windows 10 with Microsoft's Ubuntu app/terminal. The generated videos were tested on an Amiga 4000/60 with AGABlaster and Amiga OS 3.9 with original graphics and sound hardware.
AGAConv combines several tools to generate a CDXL file via a single command-line interface.
The script agaconv provides command line options such that every conversion can be done via a single command line and eventually calls agaconv-encode to generate a CDXL file that can be played on an Amiga with AGABlaster.
AGAConv release 1.0 will simplify the installation by providing a PPA package (this will make it available for all Ubuntu supported platforms). Currently only a manual installation is provided.
Enter the following commands in a terminal to install all required dependencies: (this asks for your password)
Unpack the archive with:
This creates two files:
This also unpacks ham_convert (files from ham_convert_1.6.2_beta_16-6-2020.zip) used for HAM/EHB conversions.
You can use agaconv to convert AGA 24-bit color and HAM6/HAM8 videos now. See below for examples and options.
On Windows the easiest way to install AGAConv is to install the Microsoft Ubuntu App, then install and run AGAConv in the Ubuntu terminal on Windows.
Note: AgaConv 0.9.5.4 does work on Windows 10 now, the additional package xvfb is only required on Windows 10.
You can use agaconv to convert AGA 24-bit color and HAM6/HAM8 videos now. See below for examples and options.
agaconv 0.9.5 is distributed with a GPL v3 license.
AGAConv can convert a sequence of PNG or IFF files and a PCM 8-bit audio stream into a CDXL file. All required data can be extracted with ffmpeg with one single command line. It can generate a custom CDXL file with 24-bit colors (from PNG/IFF and PCM files) and standard CDXL files. All generated CDXL files can be played with AGABlaster without providing any additional command line options (in contrast to the original CDXL players).
This generates the video file myvideo.cdxl which can be played with agablaster on an AGA Amiga. Using default settings, it uses the frame rate of the original video (limiting it to a maximum of 25 by default), uses 28000 Hz stereo sound, up to 256 unique colors (AGA8) per frame (24-bit color space), a width of 320, lores resolution, and the height is computed to keep the ratio of the original video. See also the section on Video Ratio Issues.
This generates a video with maximum frames per second of 24. If the original video has a lower frame rate it will use the original video's frame rate. Is extracts audio and converts it to 24000 Hz 8 bit stereo sound, sets a maximum of 128 colors per frame (7 planes), and a width of 256. The height is computed for an Amiga screen with a monitor using Aspect setting using a scale factor 1.15.
This generates the video file myvideo.cdxl which can be played with agablaster on a high-end AGA Amiga. It has encoded the fps of the original video (with max 25), 24000 Hz stereo audio, HAM8 frames (24-bit color space), a width of 640 in hires mode, and the height is computed for 1080p flat screen monitor using fill mode (stretching the picture in the x-dimension).
This generates the video file myvideo.cdxl which can be played with agablaster on an OCS Amiga. It has encoded 18 frames per second, 15000 Hz stereo audio, HAM6 frames (12-bit color space), a width of 256, and the height is computed to keep the ratio of the original video. Note that AGABlaster is optimized for AGA systems, it has no OCS specific optimizations or mode (it doesn't even check whether it's running on an OCS/ECS system).
When using AGABlaster on an OCS/ECS system to display CDXL videos use the additional AGABlaster command line option FMODE=0. If the video appears choppy use the the additional options FB=13 CFD=9.
Note that different monitor types and monitor modes can give very different display ratios, and hence, the video can be displayed with a quite different width:height ratio. The default setting for
Therefore, it's best to check that the ratio of the width to height for the converted video, when displayed, has indeed the correct ratio. For example for a video with original FullHD dimensions (1920x1080) it should also have a 1.78 ratio when displayed with on your Amiga and the respective monitor.
If the AGAConv
A simple rule is: a circle (or square) in the original video, should also be a circle (or square) when displayed with your Amiga on the respective monitor. If not, then the scale factor must be chosen differently.
If a video has a black stripe on top and bottom because its original aspect ratio is not 1.78, but it's encoded as FullHD video (1920x1080) then it has a black stripe at the top and bottom. These stripes should be cropped to (a) reduce the CDXL size, and (b) improve the conversion quality at the top and bottom border lines. AGAConv 0.9.5+ comes with a little tool 'autocropy' that does this automatically. This tool invokes ffmpeg, determines automatically the height of this black stripe (by playing the video for a few seconds), and re-encodes the video without it. The command takes as arguments the input-video and the output-video. This will reduce CDXL file size and also gives a proper sharp border of the video when displayed - otherwise the border becomes blurry, because the colors get mixed-up with the black lines during the resize-phase of the video conversion.
Then this re-encoded video can be used with AGAConv. If successful, this reduces the height of the video, reduces the size of the final CDXL video. For example a video with aspect ratio of 2.35 that was encoded as FullHD video (by adding black stripes at top and bottom), will then indeed have an aspect ratio of 2.35. Since AGAConv by default keeps the ratio of the input video, it will work just fine with this re-encoded video as well. The less data each frame has, the higher can be the FPS, therefore this can also improve FPS.
Depending on the command line options, agaconv invokes several tools in the background. It ensures that the command line options between those tools are used consistently. It invokes at least ffmpeg and agaconv-encode. Options for HAM and EHB modes will also trigger to invoke ham_convert.
|--in=FILE||provide name of input video file (e.g. myvideo.mp4)|
|--out=FILE||provide name of output CDXL file (e.g. myvideo.cdxl)|
|--status||print status messages during conversion|
|--max-fps=NUMBER||specify maximum number of frames per second in CDXL video (default: 25). AGAConv automatically determines the FPS of the original video. If the FPS in the original video is lower than NUMBER, then it uses the original FPS, otherwise it limits the fps to NUMBER.|
|--fps=NUMBER||specify number of frames per second in CDXL video (independent of the FPS in the original video).|
|--max-colors=NUMBER||specify the maximum number of colors per frame when extracting with ffmpeg (default: 256; reserves one color for the background color, and one more color because ffmpeg sometimes generates an additional color in the color quantisation)|
|--color-mode=MODE||where MODE is normal|ham6|ham8|ehb (default: normal (24-bit colors))|
|--screen-mode=MODE||where MODE is lores|hires|superhires (default: lores)|
|--monitor-mode=MODE|| where MODE is keep_ratio|aspect|fill1080|fill1200 (default: keep_ratio).|
The four options use scale factors of 1.0|1.15|1.24|1.37.
|--scale-factor=NUMBER||(forces this factor, ignores monitor-mode)|
|--width=NUMBER||specify width of CDXL video (default: 320)|
|--height=auto|NUMBER||specify height of CDXL video (default is 'auto'). If a NUMBER is provided it will use exactly that value. If not explicitly specified (=auto), it will compute the height dependent on the option '--monitor-mode'. If none of the options is provided it computes the height to keep the original ratio of the video.|
|--audio-mode=MODE||where MODE is mono|stereo (default: stereo)|
|--frequency=NUMBER||specify audio frequency of converted CDXL video (default: 28000). Maximum supported frequency is 28867 Hz.|
|--ff-dither=MODE||where MODE is none|bayer (default:bayer)|
|--ff-bayer-scale=NUMBER||where NUMBER is in range 0..5 (default:4)|
|--hc-dither=MODE||where MODE is none|bayer|fs (default:bayer)|
|--hc-propagation=NUMBER||where NUMBER is in range 0..100 (default:5)|
|--hc-diversity=NUMBER||where NUMBER is in range 0..9 (default: 5), except ehb:0-6 (default 3)), no effect with HAM8.|
|--hc-ham-quality=NUMBER||where NUMBER is in range 1..4: (default: 1 (fastest))|
|--hc-quant=MODE||where MODE is wu|neuquant (default: wu quantisation)|
|--conversion-tool=TOOL||where TOOL is ffmpeg|ham_convert (default: ffmpeg). Any color-mode option for HAM/EHB implicitly selects ham_convert as conversion tool. This option only needs to be used when converting AGA6/7/8 frames with ham_convert instead of ffmpeg. All other modes automatically select the only available tool [version 0.9.5+]|
|--skip-video-extraction||reuse with ffmpeg previously extracted PNG frames|
|--skip-video-conversion||reuse with ham_convert previously converted frames|
|--dry-run||compute and print conversion summary, do not perform actual conversion (good for querying computed target size of video)|
|--info-file=FILENAME||write conversion times for each phase to file FILENAME. The same information is also printed on the screen in the summary at the end of the conversion process.|
|--no-cleanup||do not remove temporary files|
|--version||print agaconv version info and copyright info|
|--quiet||no messages during conversion|
|--help||print help text|
--ff-NAME options are only relevant when ffmpeg is used for frame conversion, --hc-NAME options are only relevant when ham_convert is used. ham_convert is automatically selected when HAM or EHB color mode is requested. All these options have good default values.
Similar to CDXL, a high quality GIF uses 256 colors and a separate color palette in each frame. The following line gives the equivalent GIF file to the generated AGA8 CDXL graphics generated by AGAConv:
Hence, you can use this method to preview how the CDXL will look like on any PC by converting it to a GIF first. The 24-bit RGB colors for all pixels are identical in this GIF, scale=w=320 selects a width of 320 pixel, max_colors=256 sets the maximum number of colors per frame, where each frame has its own color palette (a GIF does not include audio).
AGAConv encodes a sequence of PNG or IFF files and an 8-bit PCM audio stream into a CDXL video. The tool ffmpeg is used to extract the PNG files for a specified number of frames per second, and it can also extract a PCM audio stream for a specified frequency. The same frame rate and frequency that is used with ffmpeg is also be provided to agaconv-encode.
In addition, optional tools can be used to convert frames. For example, ffmpeg cannot convert extracted frames to HAM frames. For this purpose the tool ham_convert is invoked, to generate high quality HAM frames.
Therefore there are two possible variants of usage:
Each of the variants allows to specify a number of quality arguments to AGAConv which are used when calling the respective tools.