Opened 8 years ago

Last modified 8 years ago

#5604 new defect

read rtmp stream occur Packet mismatch

Reported by: heibaijun Owned by:
Priority: normal Component: undetermined
Version: unspecified Keywords: rtmp flv
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no



built with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-16)
configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --disable-ffserver --disable-ffplay --enable-shared --disable-static --enable-runtime-cpudetect --enable-gpl --enable-version3 --enable-postproc --enable-avfilter --enable-pthreads --enable-bzlib --enable-libfreetype --disable-debug --enable-libfaac --enable-libx264 --enable-libfdk-aac --enable-nonfree --disable-stripping --enable-pic --extra-libs=-lstdc++
libavutil 55. 17.103 / 55. 17.103
libavcodec 57. 24.102 / 57. 24.102
libavformat 57. 25.100 / 57. 25.100
libavdevice 57. 0.101 / 57. 0.101
libavfilter 6. 31.100 / 6. 31.100
libswscale 4. 0.100 / 4. 0.100
libswresample 2. 0.101 / 2. 0.101
libpostproc 54. 0.100 / 54. 0.100


CentOS release 6.6 (Final) 2.6.32-504.el6.x86_64


ffmpeg -re -i rtmp:// -c:v copy -c:a copy -f flv rtmp://


[flv @ 0x34db420] type:8, size:194, last:-1, dts:800 pos:5786
[flv @ 0x34db420] 1 AF 0
old_flv_size=0 type=8 size=195 ts=832 total=206
[flv @ 0x34db420] type:8, size:195, last:-1, dts:832 pos:5995
[flv @ 0x34db420] 1 AF 0
old_flv_size=0 type=8 size=204 ts=864 total=215 ---------------------> function append_flv_data print
[flv @ 0x34db420] type:8, size:204, last:-1, dts:864 pos:6205
[flv @ 0x34db420] 1 AF 0
[rtmp @ 0x34dbce0] ff_rtmp_packet_read EIO
[AVIOContext @ 0x34dd280] read avio failed ret = 0 start=0x34e67ab end=0x34e67ab

Last message repeated 7 times ---------------------> function avio_r8 return 0 print

[flv @ 0x34db420] type:0, size:0, last:-1, dts:0 pos:6416
old_flv_size=0 type=9 size=43 ts=854 total=54 ---------------------> function avio_feof->fill_buffer->append_flv_data
[flv @ 0x34db420] size =0 FFERROR_REDO ---------------------> size = 0 goto leave
[flv @ 0x34db420] Packet mismatch 721421142 11
old_flv_size=0 type=9 size=39125 ts=885 total=39136
old_flv_size=0 type=8 size=192 ts=896 total=203
old_flv_size=0 type=8 size=203 ts=928 total=214 -------------------->function append_flv_data print right
[flv @ 0x34db420] type:0, size:51968, last:721421142, dts:237568 pos:45830 ------>size is invalid
[flv @ 0x34db420] Skipping flv packet: type 0, size 51968, flags 0.
old_flv_size=0 type=9 size=2019 ts=935 total=2030
old_flv_size=0 type=8 size=195 ts=960 total=206
old_flv_size=0 type=9 size=3186 ts=989 total=3197
old_flv_size=0 type=8 size=196 ts=992 total=207


In function flv_read_packet, before Packet mismatch happen, rtmp read return EIO, avio_r8 return 0, so var type, size and dts equal zero,
then function goto tag leave, at this time avio_rb32 read next packet, var last equal first four byte
after Packet mismatch happen, rtmp read packet is right
so rtmp level is right and flv level is wrong
avio_r8 and avio_rb32 can not return failed state
because flv packet is wrong, can not read right size

Change History (1)

comment:1 by Carl Eugen Hoyos, 8 years ago

Keywords: rtmp flv added; Packet mismatch removed
Priority: criticalnormal

Please explain how the issue can be reproduced and provide the command line you tested together with the complete, uncut console output to make this a valid ticket.

Note: See TracTickets for help on using tickets.