An open-source full-motion video codec optimized for real-time playback on low-end graphical devices.
AGMV is an indexed colored, block-based full-motion video codec that utilizes classic color quantization, progressive interpolated motion compensation, lz77/lzss data compression, a routine 2:1 audio compression algorithm, and various other old-school video compression techniques inspired from the classics such as Smacker video and Quake 2's Cinematics video formats to achieve real-time video playback on low-end graphical devices favoring decoding speed over aggressive compression routines to ensure that even a CPU clocked at 16.78MHz like the Nintendo Gameboy Advance can decode individual frames in real time.
Why use AGMV? AGMV serves four purposes:
* It maintains blazing fast decoding speed to even where low-end hardware such as the GBA can use it for real-time video playback.
* It uses the RGB color space, the native color space of most graphical devices, to avoid any intermediary color conversion step so that a decoded frame can be immediately blitted to the screen.
* At the cost of some visual quality, it can even rival Smacker video, MJPEG, and Cinepak compression rates while being virtually 4x easier to decode.
output.mp4
agmvp_out.mp4
#include <stdio.h>
#include <agmv.h>
#include <agidl.h>
int main(){
AGMV* agmv = CreateAGMV(212,320,240,24); /* (Number of Frames, Width, Height, Frames per Second) */
AGMV_WavToAudioTrack("example.wav",agmv);
AGMV_EncodeAGMV(agmv,"example.agmv","example_directory","agmv_base_name",AGMV_IMG_BMP,1,212,320,240,24,AGMV_OPT_III,AGMV_LOW_QUALITY,AGMV_LZSS_COMPRESSION);
return 0;
}
#include <stdio.h>
#include <agmv.h>
int main(){
u32 total_num_frames = 210;
/* GENERATES A C HEADER FILE CONTAINING AGMV VIDEO*/
AGMV* agmv = CreateAGMV(total_num_frames-1,320,240,24);
AGMV_RawSignedPCMToAudioTrack("example.raw",agmv,1,16000);
AGMV_EncodeAGMV(agmv,"example.agmv","example_directory","agmv_base_name",AGMV_IMG_BMP,1,total_num_frames,320,240,24,AGMV_OPT_GBA_I,AGMV_LOW_QUALITY,AGMV_LZSS_COMPRESSION);
return 0;
}
#include <stdio.h>
#include <agmv.h>
#include <agidl.h>
int main(){
AGMV_DecodeAGMV("example.agmv",AGMV_IMG_BMP,AGMV_AUDIO_WAV);
return 0;
}
#include <stdio.h>
#include <agmv.h>
#include <agidl.h>
int main(){
AGMV_DecodeAudio("example.agmv",AGMV_AUDIO_WAV);
return 0;
}
- Convert frame rate of video to 24 frames per second(use 16 if size is really important)
ffmpeg -i example.mp4 -filter:v fps=fps=24 new_example.mp4
- Extract audio from new video and convert to GBA compatible format
ffmpeg -i new_example.mp4 -ac 1 -ar 16000 -c:a pcm_u8 example.wav
- Extract image frames from video
ffmpeg -i new_example.mp4 agmv_frame_%d.bmp
- Convert frame rate of video to 24 frames per second(use 16 if size is really important)
ffmpeg -i example.mp4 -filter:v fps=fps=24 new_example.mp4
- Extract audio from new video
ffmpeg -i new_example.mp4 example.wav
- Extract image frames from video
ffmpeg -i new_example.mp4 agmv_frame_%d.bmp
- In audacity, drag and drop
example.wav
- Click on
Tracks
on the top bar and selectMix Stereo Down to Mono
if the audio is not already mono. - Now, still on
Tracks
, select resample, and choose16,000
. - Next, click on
File
at the top,Export
, thenExport Audio
. - In
Save Type
, select other compressed files - In
Header
, selectRaw(header-less)
- In
encoding
, selectSigned 8-bit PCM
- Now, click save