and 1 contributors


makeajpeg - Make Animated JPEGs (AJPEGs) on command-line


  makeajpeg [options] -o <output-file> input-files ...


--output-file, -o

Output file for the resulting concatenated JPEGs, aka the Animated JPEG file or MJPEG. Mandatory!

Some players recognise Motion-JPEGs from file suffix (mplayer), so it might make sense to use the .mjpeg extension. The Animated JPEG standard recommends .ajpeg.

--delay, -d

Delay in milliseconds, the time each frame is shown within the animation ("ms", that's 1000ms = 1 sec). Defaults to 100ms (10 fps).

--repeat, -r

Defines the repeat behaviour of the animation: 0 for continuous playback, numbers above zero for a fixed number of plays. Defaults to 0 (continuous playback).


Flag. Tells makeajpeg to adjust the file modification timestamp (mtime) of the output-file to be the same as the mtime of the first frame.


Flag. Tells makeajpeg to store the filename of the file the frame originally was stored as into each AJPEG frame. By keeping this data with each frame, you can restore the original file structure when an AJEPG animation is broken into files again (for example with --split).


Flag. Tells makeajpeg to do the reverse of what it normally does: it will disassemble a given AJPEG file into a number of individual JPEG frames. The --keep-mtime flag sets frames' file dates to the mtime of the AJPEG file. Will choke when frame filenames exist, unless --force is set. Todo: If file names were stored in frames (for example with --metadata-filename) it will restore original names.

--force, -f

Flag. Force overwriting of an existing output file.

--debug, -d

Flag. Switch debug output on.

--help, -h

Flag. Print usage info.


  $ makeajpeg -f --delay 140 --keep-mtime -o animation.ajpeg shot0*

Produce an Animated JPEG file from a series of sequentially numbered jpegs by using a file glob, the -f switch tells makeajpeg to overwrite a previously generated file, delay is set to 140ms for a slow-motion-like low frame-rate. The resulting file will have the same mtime as the first input file.

  $ cat sequence.ajpeg shot00* > sequence_updated.ajpeg

The unix cat command is used to apped frames to a previously generated AJPEG. This is possible as the first frame of an Animated JPEG stores global playback metadata - in case you want the playback rate to remain the same, subsequent frames are just a concatenation of JPEGs and can be safely appended.


More information about what this script does can be found in the documentation of the backend module Image::Animated::JPEG.


Clipland GmbH


Copyright 2012-2017 Clipland GmbH. All rights reserved.

This library is free software, dual-licensed under GPLv3/AL2. You can redistribute it and/or modify it under the same terms as Perl itself.