J2K video descriptor can be found on page 104 of this document.
Many of the descriptor's fields are straightforward, but there are a few that are not:
profile_and_level (RSIZ parameter from J2K main header):
broadcast profile and level values:
A) J2K supports the following profiles:
#define PROFILE_NONE 0x0000 /** no profile, conform to 15444-1 */
#define PROFILE_0 0x0001 /** Profile 0 as described in 15444-1,Table A.45 */
#define PROFILE_1 0x0002 /** Profile 1 as described in 15444-1,Table A.45 */
#define PROFILE_PART2 0x8000 /** At least 1 extension defined in 15444-2 (Part-2) */
#define PROFILE_CINEMA_2K 0x0003 /** 2K cinema profile defined in 15444-1 AMD1 */
#define PROFILE_CINEMA_4K 0x0004 /** 4K cinema profile defined in 15444-1 AMD1 */
#define PROFILE_CINEMA_S2K 0x0005 /** Scalable 2K cinema profile defined in 15444-1 AMD2 */
#define PROFILE_CINEMA_S4K 0x0006 /** Scalable 4K cinema profile defined in 15444-1 AMD2 */
#define PROFILE_CINEMA_LTS 0x0007 /** Long term storage cinema profile defined in 15444-1 AMD2 */
#define PROFILE_BC_SINGLE 0x0100 /** Single Tile Broadcast profile defined in 15444-1 AMD3 */
#define PROFILE_BC_MULTI 0x0200 /** Multi Tile Broadcast profile defined in 15444-1 AMD3 */
#define PROFILE_BC_MULTI_R 0x0300 /** Multi Tile Reversible Broadcast profile defined in 15444-1 AMD3 */
#define PROFILE_IMF_2K 0x0400 /** 2K Single Tile Lossy IMF profile defined in 15444-1 AMD 8 */
#define PROFILE_IMF_4K 0x0401 /** 4K Single Tile Lossy IMF profile defined in 15444-1 AMD 8 */
#define PROFILE_IMF_8K 0x0402 /** 8K Single Tile Lossy IMF profile defined in 15444-1 AMD 8 */
#define PROFILE_IMF_2K_R 0x0403 /** 2K Single/Multi Tile Reversible IMF profile defined in 15444-1 AMD 8 */
#define PROFILE_IMF_4K_R 0x0800 /** 4K Single/Multi Tile Reversible IMF profile defined in 15444-1 AMD 8 */
#define PROFILE_IMF_8K_R 0x0801 /** 8K Single/Multi Tile Reversible IMF profile defined in 15444-1 AMD 8 */
For broadcast profiles, the PROFILE_XXX value has to be bitwise OR'd with the targeted main level (3-0 LSB, value between 0 and 11), as described below :
B) Main level is a number between 0 and 11, and indicates max bit rate and sample rate,
where bit rate is measured in Mega bits per second (Mbps), and sample rate is measured in Mega samples per second (Msps)
// 2. rename all files in directory to foo followed by an increasing sequence of consecutive numbers
$ c=0; ls -rt | while read -r file; do ((++c)); mv "
file""
(printf 'foo_%04d.%s' "
c""
{file#*.}")"; done
// 3. force resize of all images in directory into 2K resolution
$ c=0; ls -rt | while read -r file; do ((++c)); gm convert -size 1920x1080! "
file"−resize1920x1080!"
{file}"; done
// 4. batch convert tiff to 8 bit (FFmpeg didn't like 12 bit TIFF)
$ c=0; ls -rt | while read -r file; do ((++c)); gm convert "
file"−definetiff:bits−per−sample=8"
{file}"; done
// 5. create YUV video file from tiff sequence
$ ffmpeg -i foo_%04d.tif -vf format=yuv444p12le 1920x1080x5x444.yuv
// 6. convert to broadcast format with elementary stream headers
$ kdu_v_compress -i 1920x1080x5x444.yuv -o test.jpb -jpb_data 1,200
Well, when muxing, you create a PES header plus raw J2K codestream. And codestream knows nothing about profiles. So, the muxer can simply set profile and main level to whatever it wants, or based on user settings.
This is what we are doing in the GStreamer muxer at the moment: we are being lenient, so if profile is not broadcast profile, we set it to broadcast.
Someone could make a feature request to openjpeg to allow setting the profile and main level ?
Gstreamer bug mentioned above lists a number of working pipelines, so it is easy to get a stream running.