Documentation


Contents

JPEG 2000 encoder

Required arguments

These options (-i & -o or -ImgDir & -OutFor) are the only *required* options.

Ex: openjpeg -i car.pgm -o car.j2k

That means that you will encode the image with the default options:

Options available

JPEG 2000 decoder

Required arguments

Options available

Motion JPEG 2000 files

Attention : The Motion JPEG 2000 codec is currently using OpenJPEG v0.97 and is thus not including all the latest OpenJPEG optimizations and features.

The MJ2 part of OpenJPEG has five modules: An encoder, a decoder, a J2K wrapper (j2k frames to an mj2 file), a J2K extractor (mj2 file to j2k frames) and a XML generator extracting metadata from MJ2 files.

MJ2 modules

1. MJ2 encoder

The MJ2 encoder compresses YUV files to Motion JPEG 2000 standard file.

The minimum command line for the MJ2 encoder is:
frames_to_mj2 -i yuv_file.yuv  -o mj2_file.mj2 -W width,height,CbCrSubsampling_dx,CbCrSubsampling_dy,

Use the -F option to specifie the frame rate (the default frame-rate is 25)

Example: To encode the standard YUV CIF frames (352*288) formeman.yuv at 30 frames per second, the command line should be:
frames_to_mj2 -i foreman.yuv -o foreman.mj2 -W 352,288,2,2 -F 30

Additionally to that, all the JPEG 2000 Encoder options can be used in the command line.
The MJ2 library generates the MJ2 boxes specified in the mj2_movie structure. This structure can be a standard one, like in  the frames_to_mj2 codec, or a more specific one created by the user.
The standard mj2_movie structure has one video track containig the compressed codestream of the yuv, with a timescale of 1ms, with one sample per chunk.



2. MJ2 decoder

The MJ2 decoder decompresses Motion JPEG 2000 files to YUV files.

The command line for the MJ2 decoder is:
mj2_to_frames mj2_file.mj2  yuv_file.yuv  



3. MJ2 wrapper

The MJ2 wrapper module wraps one or several j2k bitstreams into a mj2 file. This wrapping is done with standard parameters (25 frames per second, no sound or hint tracks, ...), but this can be modified in the setparams function.

The command line for the MJ2 wrapper is:
MJ2_Wrapper infile_root outfile.mj2

where infile_root contains the path and the name of the input files before its number (5 digits, starting from 00000) and extension. For example, if I want to create the MJ2 file video/foreman.mj2 with the input files:
image/foreman_00000.j2k
image/foreman_00001.j2k
image/foreman_00002.j2k

The command line to use is MJ2_Wrapper image/foreman video/foreman.mj2



4. MJ2 extractor

The MJ2 extractor module extracts the j2k bitstreams contained in an MJ2 file.

The command line for the MJ2 extractor is:
MJ2_extractor infile.mj2 outfile_root 

where outfile_root contains the path and the name of the output files before its number (5 digits, starting from 00000) and extension. For example, if the MJ2 file video/foreman.mj2 contains three frames, if I want to create the input files:
image/foreman_00000.j2k
image/foreman_00001.j2k
image/foreman_00002.j2k
The command line to use is MJ2_extractor video/foreman.mj2 image/foreman



5. Metadata Reader

"Mj2_to_metadata", under development, is a Windows command-line function that reads metadata from a Motion JPEG 2000 video file and generates an XML file with a representation of that content.  So far, it is limited to reporting structural metadata, but descriptive metadata is planned.  It is run from the command-line by:

mj2_to_metadata -i input.mj2 -o output.xml

 

Additional options are discussed here.
Thanks to Glenn Pearson for his contributions to this project !!!


MJ2 Sample file

An MJ2 sample file is available here.
To decompress it, use the following command: mj2_to_frames.exe speedway_opj.mj2 speedway_decompressed.yuv
To extract the j2k images, use the following command: MJ2_Extractor.exe speedway_opj.mj2 speedway_frame

JPWL (Wireless JPEG 2000)

1. JPWL ENCODER

The JPWL options will only work with the JPWL library located in the jpwl/ directory obtained when downloading the OpenJPEG source code.

[h<tile><=type>,s<tile><=method>,a=<addr>,z=<size>,g=<range>,p<tile:pack><=type>]


EXAMPLE:

-W h,h0=64,h3=16,h5=0,p0=78,p0:24=56,p1,p3:0=0,p3:20=32,s=0,s0=6,s3=-1,a=0,g=1,z=1

means predefined EPB in MH, rs(64,32) from TPH 0 to TPH 2, CRC-16 in TPH 3 and TPH 4, no EPBs in remaining TPHs, UEP rs(78,32) for packets 0 to 23 of tile 0, UEP rs(56,32) for packets 24 to the last of tile 0, UEP rs default for packets of tile 1, no UEP for packets 0 to 19 of tile 3, UEP CRC-32 for packets 20 of tile 3 to last tile, relative sensitivity ESD for MH, TSE ESD from TPH 0 to TPH 2, byte range with automatic size of addresses and 1 byte for each sensitivity value

EXAMPLE:

-W h,s,p

means default protection to headers (MH and TPHs) as well as data packets, one ESD in MH



2. JPWL Decoder

The JPWL options will only works with the JPWL library located in the jpwl/ directory obtained when downloading the OpenJPEG source code.