Opened 4 months ago
#10784 new defect
rtsp mjpeg: Missing packets; dropping frame.
Reported by: | wose | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | avformat |
Version: | unspecified | Keywords: | rtsp mjpeg |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
I have a rtsp mjpeg stream which doesn't start playing with ffmpeg/ffplay.
ffplay version N-113236-g90bef6390f Copyright (c) 2003-2024 the FFmpeg developers built with gcc 13.2.1 (GCC) 20230801 configuration: libavutil 58. 36.101 / 58. 36.101 libavcodec 60. 37.100 / 60. 37.100 libavformat 60. 20.100 / 60. 20.100 libavdevice 60. 4.100 / 60. 4.100 libavfilter 9. 17.100 / 9. 17.100 libswscale 7. 6.100 / 7. 6.100 libswresample 4. 13.100 / 4. 13.100 Initialized opengl renderer. [tcp @ 0x7f4844003780] No default whitelist set [tcp @ 0x7f4844003780] Original list of addresses: [tcp @ 0x7f4844003780] Address 192.168.3.3 port 654 [tcp @ 0x7f4844003780] Interleaved list of addresses: [tcp @ 0x7f4844003780] Address 192.168.3.3 port 654 [tcp @ 0x7f4844003780] Starting connection attempt to 192.168.3.3 port 654 [tcp @ 0x7f4844003780] Successfully connected to 192.168.3.3 port 654 [rtsp @ 0x7f4844000c80] SDP: v=0 o=- 0 0 IN IP4 0.0.0.0 s= i= c=IN IP4 0.0.0.0 t=0 0 m=video 0 RTP/AVP 26 a=rtpmap:26 JPEG/90000 a=control:rtsp://192.168.3.3:654/00000001-0000-babe-0000-00075f92e21d/live [rtsp @ 0x7f4844000c80] video codec set to: mjpeg [rtp @ 0x7f4844009980] No default whitelist set [udp @ 0x7f4844009cc0] No default whitelist set [udp @ 0x7f4844009cc0] end receive buffer size reported is 425984 [udp @ 0x7f484401a000] No default whitelist set [udp @ 0x7f484401a000] end receive buffer size reported is 425984 [rtsp @ 0x7f4844000c80] setting jitter buffer size to 500 [rtsp @ 0x7f4844000c80] hello state=0 [rtsp @ 0x7f4844000c80] Missing packets; dropping frame. Last message repeated 18 times [rtsp @ 0x7f4844000c80] Missing packets; dropping frame. 0B f=0/0 Last message repeated 18 times ...
The stream does play in vlc (master branch).
I managed to make the stream play using ffplay by disabling the check for missed packets in rtpdec_jpeg.c
diff --git a/libavformat/rtpdec_jpeg.c b/libavformat/rtpdec_jpeg.c index b32d074136..1988da0853 100644 --- a/libavformat/rtpdec_jpeg.c +++ b/libavformat/rtpdec_jpeg.c @@ -350,7 +350,8 @@ static int jpeg_parse_packet(AVFormatContext *ctx, PayloadContext *jpeg, return AVERROR_INVALIDDATA; } - if (off != avio_tell(jpeg->frame) - jpeg->hdr_size) { + int64_t sz = avio_tell(jpeg->frame) - jpeg->hdr_size; + if (off != sz && off != sz + 132) { av_log(ctx, AV_LOG_ERROR, "Missing packets; dropping frame.\n"); return AVERROR(EAGAIN); --
There are always 132 bytes additional bytes which are not expected.
I attached a dump of the UDP stream.
Attachments (1)
Note:
See TracTickets
for help on using tickets.
Wireshark dump of the UDP stream