JPEG 2000 Video¶
JPEG 2000 (J2K) for high-quality, low-latency video streaming.
Overview¶
JPEG 2000 is an intra-frame codec providing:
- Consistent frame-to-frame latency
- High quality with flexible compression
- No temporal dependencies
- Broadcast and cinema industry standard
Characteristics¶
| Aspect | JPEG 2000 | H.264/H.265 |
|---|---|---|
| Compression Type | Intra-frame | Inter-frame |
| Latency | Very low | Higher |
| Error Resilience | Excellent | Frame dependencies |
| Edit Friendliness | Frame-accurate | GOP-based |
| Compression Ratio | Moderate | High |
GStreamer Backend¶
MediaX uses GStreamer for JPEG 2000 encoding and decoding:
- OpenJPEG software codec
- Hardware acceleration where available
Transmitting JPEG 2000 Video¶
#include "jpeg2000/gst/rtp_jpeg2000_payloader.h"
mediax::rtp::jpeg2000::gst::RtpJpeg2000GstPayloader payloader;
mediax::rtp::StreamInformation stream_info;
stream_info.session_name = "j2k-stream";
stream_info.hostname = "239.192.1.1";
stream_info.port = 5004;
stream_info.width = 1920;
stream_info.height = 1080;
stream_info.framerate = 30;
stream_info.encoding = mediax::rtp::ColourspaceType::kColourspaceJpeg2000;
payloader.SetStreamInfo(stream_info);
payloader.Open();
// Send RGB24 frames
std::vector<uint8_t> rgb_buffer(1920 * 1080 * 3);
// Fill buffer with video frame...
payloader.Transmit(rgb_buffer.data(), true);
payloader.Close();
Receiving JPEG 2000 Video¶
#include "jpeg2000/gst/rtp_jpeg2000_depayloader.h"
mediax::rtp::jpeg2000::gst::RtpJpeg2000GstDepayloader depayloader;
mediax::rtp::StreamInformation stream_info;
stream_info.hostname = "239.192.1.1";
stream_info.port = 5004;
stream_info.width = 1920;
stream_info.height = 1080;
stream_info.encoding = mediax::rtp::ColourspaceType::kColourspaceJpeg2000;
depayloader.SetStreamInfo(stream_info);
depayloader.Open();
depayloader.Start();
// Receive decoded RGB frames
std::vector<uint8_t> rgb_buffer(1920 * 1080 * 3);
depayloader.Receive(rgb_buffer.data(), 1000);
depayloader.Stop();
depayloader.Close();
Bandwidth Requirements¶
JPEG 2000 offers configurable quality vs bandwidth:
| Resolution | Quality Ratio | Approximate Bitrate |
|---|---|---|
| 1920x1080 | 10:1 | ~50 Mbps |
| 1920x1080 | 20:1 | ~25 Mbps |
| 1920x1080 | 40:1 | ~12 Mbps |
| 3840x2160 | 10:1 | ~200 Mbps |
| 3840x2160 | 20:1 | ~100 Mbps |
RTP Payload Format¶
MediaX implements RFC 5371 for JPEG 2000 RTP payload:
- Codestream fragmentation
- Tile-based packetization
- Progressive decoding support
Software Setup¶
OpenJPEG¶
# Ubuntu/Debian
sudo apt install gstreamer1.0-plugins-bad libopenjp2-7-dev
# Verify encoder
gst-inspect-1.0 openjpegenc
# Verify decoder
gst-inspect-1.0 openjpegdec
Use Cases¶
JPEG 2000 is ideal for:
- Broadcast contribution: Low latency, high quality
- Medical imaging: Lossless option available
- Digital cinema: DCI specification
- Defense applications: Consistent latency
Latency Comparison¶
JPEG 2000 provides predictable latency due to intra-frame coding:
| Codec | Typical Encoding Latency |
|---|---|
| Uncompressed | 0 ms |
| JPEG 2000 | 5-10 ms |
| H.264 | 30-100 ms |
| H.265 | 50-150 ms |
Quality Modes¶
Lossy Compression¶
Default mode with configurable quality:
- Higher compression ratios
- Visual quality preserved at moderate ratios
- Best for real-time streaming
Visually Lossless¶
High quality setting for critical applications:
- Minimal visible artifacts
- Higher bandwidth requirement
- Suitable for color grading workflows
Mathematically Lossless¶
No data loss (where supported):
- Exact pixel reconstruction
- Highest bandwidth
- Medical and scientific applications
Support¶
- Website: https://astutesys.com/support
- Email: [email protected]