[FFmpeg-trac] #8211(avformat:new): ffplay does'nt play mjpeg stream
FFmpeg
trac at avcodec.org
Mon Mar 22 22:42:04 EET 2021
#8211: ffplay does'nt play mjpeg stream
-------------------------------------+------------------------------------
Reporter: anhsoft | Owner:
Type: enhancement | Status: new
Priority: wish | Component: avformat
Version: git-master | Resolution:
Keywords: rtsp mjpeg | Blocked By:
Blocking: | Reproduced by developer: 0
Analyzed by developer: 1 |
-------------------------------------+------------------------------------
Changes (by cehoyos):
* analyzed: 0 => 1
Comment:
Sorry for my bad interpretation of the ticket, I had originally found an
Android binary but no source code!
The issue is that the restart interval in the attached dump (and according
to the original description also in the rtp header) is 0x3de (990) for the
first frame and has similar values between 986 and 1026 for the remaining
frames. If I force the restart interval for each frame to 0x28 (40) in the
decoder, the stream plays fine.
Looking at RFC 2435 I don't see an obvious bug in
libavformat/rtpdec_jpeg.c and to the best of my knowledge there is no bug
related to the restart interval in FFmpeg's jpeg decoder indicating that
in the end, my interpretation may not have been so far off.
I don't know how this issue can be fixed reliably.
{{{
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index 20f310fd70..9a4c1b8b2b 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -1802,6 +1802,7 @@ static int mjpeg_decode_dri(MJpegDecodeContext *s)
if (get_bits(&s->gb, 16) != 4)
return AVERROR_INVALIDDATA;
s->restart_interval = get_bits(&s->gb, 16);
+s->restart_interval = 40;
s->restart_count = 0;
av_log(s->avctx, AV_LOG_DEBUG, "restart interval: %d\n",
s->restart_interval);
}}}
--
Ticket URL: <https://trac.ffmpeg.org/ticket/8211#comment:18>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list