Opened 4 years ago

Last modified 4 years ago

#3535 new defect

Too Short RTP/JPEG packet.

Reported by: ozsaffer Owned by:
Priority: normal Component: undetermined
Version: unspecified Keywords: rtsp rtp mjpeg
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:

I am consuming an RTSP/JPEG stream from an axis IP video camera and there appear to be an issue with the RTP packet size / the resolution. When I run the ffmpeg command (requesting an image resolution of 2048x1536) I get the following error:

[rtsp @ 0x1b448c0] hello state=0
[rtsp @ 0x1b448c0] Reserved q value 0
[rtsp @ 0x1b448c0] Too short RTP/JPEG packet.

However when I lower the resolution on the down to 1600x1200, there are no errors and the stream is good.

How to reproduce:
ffmpeg -v debug -i "rtsp://<ip_address>/axis-media/media.amp?videocodec=jpeg&resolution=2048x1536" -vcodec copy -f null /dev/null

ffmpeg version git-2013-09-26-32cde96 Copyright (c) 2000-2013 the FFmpeg developers
built on Sep 26 2013 13:47:53 with gcc 4.6 (Ubuntu/Linaro? 4.6.3-1ubuntu5)

Patches should be submitted to the ffmpeg-devel mailing list and not this bug tracker.

Change History (6)

comment:1 Changed 4 years ago by cehoyos

  • Keywords mjpeg added; jpeg removed

Please test current FFmpeg git head and provide a failing command line together with the complete, uncut console output to make this a valid ticket.

comment:2 follow-up: Changed 4 years ago by ozsaffer

Hi,

Thanks for the reply,

I have downloaded and built the latest version of ffmpeg, and I am still getting the same error message (see below). The process continues to run and I have to kill it manually (ctrl-c).

ffmpeg$ ffmpeg -v debug -i "rtsp://192.168.0.90/axis-media/media.amp?videocodec=jpeg" -f null /dev/null

ffmpeg version 2.2.git Copyright (c) 2000-2014 the FFmpeg developers

built on Apr 6 2014 10:34:17 with gcc 4.6 (Ubuntu/Linaro? 4.6.3-1ubuntu5)
configuration: --prefix=/home/thomas/ffmpeg_build --extra-cflags=-I/home/thomas/ffmpeg_build/include --extra-ldflags=-L/home/thomas/ffmpeg_build/lib --bindir=/home/thomas/bin --extra-libs=-ldl --enable-gpl --enable-libass --enable-libfdk-aac --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree --enable-x11grab
libavutil 52. 74.100 / 52. 74.100
libavcodec 55. 57.100 / 55. 57.100
libavformat 55. 36.101 / 55. 36.101
libavdevice 55. 11.100 / 55. 11.100
libavfilter 4. 3.100 / 4. 3.100
libswscale 2. 6.100 / 2. 6.100
libswresample 0. 18.100 / 0. 18.100
libpostproc 52. 3.100 / 52. 3.100

Splitting the commandline.
Reading option '-v' ... matched as option 'v' (set logging level) with argument 'debug'.
Reading option '-i' ... matched as input file with argument 'rtsp://root:oink....piggy@192.168.0.90/axis-media/media.amp?videocodec=jpeg'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'null'.
Reading option '/dev/null' ... matched as output file.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option v (set logging level) with argument debug.
Successfully parsed a group of options.
Parsing a group of options: input file rtsp://192.168.0.90/axis-media/media.amp?videocodec=jpeg.
Successfully parsed a group of options.
Opening an input file: rtsp://192.168.0.90/axis-media/media.amp?videocodec=jpeg.
[rtsp @ 0x1ce0940] SDP:
v=0
o=- 1396746078623612 1396746078623612 IN IP4 192.168.0.90
s=Media Presentation
e=NONE
t=0 0
a=control:rtsp://192.168.0.90:554/axis-media/media.amp?videocodec=jpeg
a=range:npt=0.000000-
m=video 0 RTP/AVP 26
c=IN IP4 0.0.0.0
a=framesize:26 2048-1536
a=control:rtsp://192.168.0.90:554/axis-media/media.amp/trackID=1?videocodec=jpeg

[udp @ 0x1ce7b20] end receive buffer size reported is 131072
[udp @ 0x1ce2c60] end receive buffer size reported is 131072
[rtsp @ 0x1ce0940] hello state=0
[rtsp @ 0x1ce0940] Reserved q value 0
[rtsp @ 0x1ce0940] Too short RTP/JPEG packet.

Last message repeated 755 times

[rtsp @ 0x1ce0940] Reserved q value 0
[rtsp @ 0x1ce0940] Too short RTP/JPEG packet.

Last message repeated 755 times

[rtsp @ 0x1ce0940] Reserved q value 0
[rtsp @ 0x1ce0940] Too short RTP/JPEG packet.

Last message repeated 755 times

[rtsp @ 0x1ce0940] Reserved q value 0
[rtsp @ 0x1ce0940] Too short RTP/JPEG packet.

Last message repeated 756 times

[rtsp @ 0x1ce0940] Reserved q value 0
[rtsp @ 0x1ce0940] Too short RTP/JPEG packet.

Last message repeated 756 times

[rtsp @ 0x1ce0940] Reserved q value 0
[rtsp @ 0x1ce0940] Too short RTP/JPEG packet.

Last message repeated 756 times

[rtsp @ 0x1ce0940] Could not find codec parameters for stream 0 (Video: mjpeg): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
rtsp://192.168.0.90/axis-media/media.amp?videocodec=jpeg: could not find codec parameters

comment:3 Changed 4 years ago by cehoyos

I am just blindly guessing but did you try increasing RECVBUF_SIZE in libavformat/rtsp.c?

comment:4 Changed 4 years ago by ozsaffer

Hi,

Thanks for the idea, I tried the following two sizes, unfortunately none of them worked.

#define RECVBUF_SIZE 12 * RTP_MAX_PACKET_LENGTH 10 * RTP_MAX_PACKET_LENGTH
#define RECVBUF_SIZE 40 * RTP_MAX_PACKET_LENGTH
10 * RTP_MAX_PACKET_LENGTH

I also tried setting the RTP packet length in the libavformat/rtpdec.h

#define RTP_MAX_PACKET_LENGTH 16384 8192

But I still get the same error.

comment:5 in reply to: ↑ 2 Changed 4 years ago by cehoyos

Replying to ozsaffer:

[udp @ 0x1ce7b20] end receive buffer size reported is 131072

There is also an option -buffer_size that you could try...

comment:6 Changed 4 years ago by ozsaffer

Hi,

Thanks for the reply. I tried the -buffer_size option, using a variety of sizes. I assume it is after the input source (as below).

ffmpeg -i "rtsp://192.168.101.90/axis-media/media.amp?videocodec=jpeg" -buffer_size 131072 -f null /dev/null

But I still have the same issue. I have an alternate approach to solve the problem that requires some more engineering. I will process the RTP/H264 stream instead, which does not have this issue. I was trying to avoid the CPU overhead of decoding h.264, but it appears unavoidable.

Thanks again.

Note: See TracTickets for help on using tickets.