RTP/JPEG Packet Format

The RTP timestamp is in units of 90000Hz. The same timestamp MUST
appear in each fragment of a given frame. The RTP marker bit MUST be
set in the last packet of a frame.

JPEG header

Each packet contains a special JPEG header which immediately follows
the RTP header. The first 8 bytes of this header, called the "main
JPEG header", are as follows:

    0                   1                   2                   3
    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   | Type-specific |              Fragment Offset                  |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |      Type     |       Q       |     Width     |     Height    |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Width: 8 bits

This field encodes the width of the image in 8-pixel multiples (e.g.,
a width of 40 denotes an image 320 pixels wide). The maximum width
is 2040 pixels.

RFC 2435 RTP Payload Format for JPEG October 1998

Height: 8 bits

This field encodes the height of the image in 8-pixel multiples
(e.g., a height of 30 denotes an image 240 pixels tall). When
encoding interlaced video, this is the height of a video field, since
fields are individually JPEG encoded. The maximum height is 2040
pixels.

来自:https://datatracker.ietf.org/doc/html/rfc2435

主要限制就是长宽最大2040像素(255*8)

在so上,就有人遇到过这个问题。

ffmpeg - MJPEG streaming over RTSP - Stack Overflow update:2021-9-30
I am capturing JPEG images from an IP-camera over RTSP. I use live555

  • libavcodec for streaming and decoding the MJPEG image. The stream works fine up to the image resolution 2048 x 1920. But when I increase
  1. image width above 2048, I get a bar-shaped rectangular image of

very small width (i.e., 544x1920). The image is correctly captured and
saved on the camera. The problem occurs only when I stream the image
over RTSP to the PC. Is there any payload restriction in RTP for
high-resolution MJPEG?

Referenced from:https://stackoverflow.com/questions/7639054/mjpeg-streaming-over-rtsp

ffmpeg - 通过RTSP传输MJPEG 我正在通过RTSP从IP摄像机捕获JPEG图像。我使用live555 +
libavcodec进行流传输和解码MJPEG图像。该流在高达2048 x
1920的图像分辨率下可以正常工作。但是,当我将图像宽度增加到2048以上时,会得到宽度非常小的条形矩形图像(即544x1920)。图像已正确捕获并保存在相机上。仅当我通过RTSP将图像流式传输到PC时,才会出现此问题。
RTP中对高分辨率MJPEG有有效载荷限制吗?

最佳答案

请阅读第4页底部的http://tools.ietf.org/html/rfc2435。在这里,图像的最大宽度为2040。使用ONVIF标准可以解决此问题。

Referenced from:https://www.coder.work/article/6445074

本文链接地址:https://const.net.cn/472.html

标签: mjpeg

添加新评论