The successor of AEX's MNG2AVI is an humble frame server built to convert MNG and WAV files generated by MAME commands -mngwrite and -wavwrite.
Basically all videos published by AEX and MAME Retro Avengers have been made with this utility from .inp files ranging between MAME .106 and .259.
It's meant to be used in conjunction with FFMPEG (or other similar utilities) via pipe and it features a simple scripting language with some basic funtionality:
- import MNG video files
- import WAV audio files
- import PNG, JPG, BMP and GIF image files
- resize, crop, trim and join videos
- fadein, fadeout and cross dissolve
- solid color images and silence generation
- overlay of multiple videos
- superimpose of text and (crude) timers
It currently works only on Windows.
This software is a specialized tool designed exclusively to overcome the lack of an easy way to convert MAME-generatd MNG files into more widely used video formats.
It therefore does not support the full range of MNG features but focuses on the specific subset of the MNG specification required to handle MNG files created with the MAME -mngwrite command.
Please note that this software was written (in 2018!) primarly for personal use and has limitations, it has not undergone extensive testing or optimization, and documentation is minimal.
I have decided to open-source the code primarily to assist a friend (RAX) who needed some of its functionality. Additionally, I was surprised to learn that the original AEX's MNG2AVI tool has found a wider audience than I expected outside of AEX!
Finally, while I plan to release a stable-ish version in the near future, I do not expect to actively develop it further, add new features or fix any bugs.
Just extract the latest release zip file somewhere.
It requires .NET 8 (https://dotnet.microsoft.com/en-us/download/dotnet/8.0) and Windows 10+.
Even if it can save uncompressed avi files, it is strongly recommended to use it in conjunction to FFMPEG (https://www.ffmpeg.org/) or any other audio/video tool that accept input from pipe.
HFS has to be run from the command line where you can specify:
-fl
: lists all available functions-i filename
: path to the input script (see next section "Scripting")-o [filename | - | null]
: HFS always produces uncompressed avi as output which can be sent to three type of target:filename
: path to the target file. Please note that this can result in a huge file!-
: pipenull
: the text "null" simply discard the result. Used for debugging purpose
Example: hfs -i test.hum -o - | ffmpeg -i - -shortest progear.mp4
To use HFS, you'll need to provide a 'hum' script, a simple text file that lists the video and audio files you want to process and tells HFS what to do with them.
A basic example would be:
#opens video.mng and store it in the variable @video
@video=openmng(path="c:\mame\video.mng");
#opens audio.wav
openwave(path="c:\mame\audio.wav");
#combines audio and video
audiodub(video=@video);
There are some basic syntax rules to follow:
- comment lines begin with
#
- every row must contain a complete instruction such as a variable assign or an audio/video stream
- every row must end with
;
@
represents a variable- all function's parameter's names must be specified (named parameters)
- optional parameters can be omitted
- if a function needs an audio/video parameter, it's automatically taken from the output of the previous row if not explicitly specified
- last row must always return a valid audio/video stream
There are a two types of built-in functions that can be used to open and/or process the input files.
All input functions return an audio/video stream either from a file or by generating it on the fly.
Returns a "blank" video Parameters:
- fps (Decimal)
- width (Int)
- height (Int)
- frames (Int)
- color (String)
Loads an image and repeat it for the specified number of frames Parameters:
- path (String)
- frames (Int)
- fps (Decimal)
Returns a 400x100 video showing current version Parameters: none
Adds support for MAME MNG video files Parameters:
- path (String)
- fps (Decimal)
Adds support for WAVE audio files Parameters:
- path (String)
- ignore_length (Bool)
Returns an endless silent audio stream Parameters:
- samplepersecond (Int)
- bitpersample (Int)
- channels (Int)
Filters take an audio/video stream as input and returns it after has been processed.
Adds audio to a video stream Parameters:
- video (AudioVideoStream)
- audio (AudioVideoStream)
Applies gaussian blur to the input audio/video stream. Warning! It's extremely slow!
Parameters:
- input (AudioVideoStream)
- radius (Int)
Crop video Parameters:
- input (AudioVideoStream)
- left (Int)
- top (Int)
- width (Int)
- height (Int)
Dissolves two given video stream Parameters:
- from (AudioVideoStream)
- to (AudioVideoStream)
- frames (Int)
- squared (Bool)
FadeIn Parameters:
- to (AudioVideoStream)
- frames (Int)
- color (String)
- squared (Bool)
FadeOut Parameters:
- from (AudioVideoStream)
- frames (Int)
- color (String)
- squared (Bool)
Overlays two videos Parameters:
- bgvideo (AudioVideoStream)
- fgvideo (AudioVideoStream)
- start (Int)
- posx (Int)
- posy (Int)
- mixaudio (Int)
Resize video Parameters:
- input (AudioVideoStream)
- mode (String)
- width (Int)
- height (Int)
Writes text
Parameters:
- video (AudioVideoStream)
- text (String)
- font (String)
- size (Decimal)
- bold (Bool)
- italic (Bool)
- strikeout (Bool)
- underline (Bool)
- color (String)
- firstframe (Int)
- posx (Int)
- posy (Int)
- istimer (Bool)
- timerstartframe (Int)
- timerstopframe (Int)
- showHH (Bool)
Trims video and/or audio Parameters:
- input (AudioVideoStream)
- firstframe (Int)
- length (Int)
Adds a frame counter in the top left corner Parameters:
- input (AudioVideoStream)