Opened 12 years ago

Closed 12 years ago

#916 closed defect (fixed)

ffmpeg doen't check that udp port which it selects for incoming rtp already receives packets

Reported by: Dmitry Volyntsev Owned by:
Priority: normal Component: avformat
Version: git-master Keywords: rtsp rtp udp
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: yes

Description

RTSP session brakes some times and rstp server doesn't receive any notification about it and still sends packet in rtp session. new ffmpeg instance request the same port for incoming streams and doesn't detect it receives two stream simultaneously but tries constantly re-synchronize with two interleaved streams.

Actually, the real case occurred very rarely (4 times per one day).But steps below help to reproduce it in stable manner (using iptables drops)

Steps to reproducing:
Remote side: AXIS 211W Network Camera
Command line:
1) ffmpeg -v 10 -an -i rtsp://<login>:<passwd>@<ip-addr>/mpeg4/media.amp -vcodec mpeg1video -r 25 -sameq -acodec mp2 -strict experimental -y -f mpegts ts.ts -debug 99
2) sudo iptables -I OUTPUT -p tcp -d <ip-addr> -s <local-ip> --source-port <local-port-for-rtp> -j DROP
3) killall ffmpeg
3) ffmpeg -v 10 -an -i rtsp://<login>:<passwd>@<ip-addr>/mpeg4/media.amp -vcodec mpeg1video -r 25 -sameq -acodec mp2 -strict experimental -y -f mpegts ts.ts -debug 99

ffmpeg version: ffmpeg -v
ffmpeg version git-2011-12-30-9896d9e

OS: Linux 3.0.0-14-generic, ubuntu 11.10, 64-bit

wireshark log analysis:
1) packet 60 - first ffmpeg instance
first ffmpeg instance setups 5000-5001 ports for rtp and rtsp
2) packet 9029 - icmp due to iptables drops
3) packet 9321 - second ffmpeg instance
4) packet 9357 - first ffmpeg instance setups 5000-5001 ports for rtp and rtsp -AGAIN!

But it brakes RFC http://www.ietf.org/rfc/rfc3550.txt:
5.2 Multiplexing RTP Sessions
Separate audio and video streams SHOULD NOT be carried in a single
RTP session and demultiplexed based on the payload type or SSRC
fields.

Proposed solution 1: (before sending to remote side local ports during session negotiation ffmpeg should check there are incoming packets on this port or not):

@@ -205,6 +221,9 @@ static int rtp_open(URLContext *h, const char *uri, int flags)

s->rtp_fd = ffurl_get_file_handle(s->rtp_hd);
s->rtcp_fd = ffurl_get_file_handle(s->rtcp_hd);


+ if(!rtp_validate_udp_port(s->rtp_fd))
+ goto fail;
+

h->max_packet_size = s->rtp_hd->max_packet_size;
h->is_streamed = 1;
return 0;

Proposed solution 2: (ffmpeg should verify incoming packets on remote ports it should be (rtsp_port-1) and rejects other packets):
I still working on it. I'm newby in ffmpeg internal and I wish know how to get udp data of incoming RTP packet here: libavformat/rtpdec.c: rtp_valid_packet_in_sequence() without braking framework encapsulation of modules

Attachments (8)

rtps_collide.tcap.tar.gz (1.7 MB ) - added by Dmitry Volyntsev 12 years ago.
wireshark log
rtps_rtcp_collide.tcap (12.5 KB ) - added by Dmitry Volyntsev 12 years ago.
the same previos log with rtcp packet added to filter
ffmpeg_issue_reproduce.tcap (440.0 KB ) - added by Dmitry Volyntsev 12 years ago.
wireshark log complimentary to second post
ffmpeg_issue_fix.tcap (426.8 KB ) - added by Dmitry Volyntsev 12 years ago.
wireshark log complimentary to second post: after fix
ffmpeg_fix_rtp_udp_port_issue.patch (1.4 KB ) - added by Dmitry Volyntsev 12 years ago.
proposed patch
ffmpeg_916_issue_fix.tcap (214.7 KB ) - added by Dmitry Volyntsev 12 years ago.
wireshark log after patches 0001-fix-rtp-916-issue.patch & 0002-fix-rtp-916-issue-patch-2.patch were applied
0001-fix-rtp-916-issue.patch (2.2 KB ) - added by Dmitry Volyntsev 12 years ago.
final committed patch 1
0002-fix-rtp-916-issue-patch-2.patch (1.7 KB ) - added by Dmitry Volyntsev 12 years ago.
final committed patch 2

Change History (12)

by Dmitry Volyntsev, 12 years ago

Attachment: rtps_collide.tcap.tar.gz added

wireshark log

by Dmitry Volyntsev, 12 years ago

Attachment: rtps_rtcp_collide.tcap added

the same previos log with rtcp packet added to filter

by Dmitry Volyntsev, 12 years ago

Attachment: ffmpeg_issue_reproduce.tcap added

wireshark log complimentary to second post

by Dmitry Volyntsev, 12 years ago

Attachment: ffmpeg_issue_fix.tcap added

wireshark log complimentary to second post: after fix

comment:1 by Dmitry Volyntsev, 12 years ago

I've checked what other implementation of RTP/RTSP do in this case.
1) LIVE555 library (inside vlc media player)
2) gstreamer framework
Both of them just request no udp port from special range, but use port which an OS provides.
It this case local udp ports grow sequentially and issue case doesn't occur. Remote side after some period of time stops sending packets to old ports.

proposed patch against latest-master:

diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index d32f49e..bf2be6a 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -1157,18 +1157,14 @@ int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, i
                 goto have_port;
             }
 
-            /* first try in specified port range */
-            if (RTSP_RTP_PORT_MIN != 0) {
-                while (j <= RTSP_RTP_PORT_MAX) {
-                    ff_url_join(buf, sizeof(buf), "rtp", NULL, host, -1,
-                                "?localport=%d", j);
-                    /* we will use two ports per rtp stream (rtp and rtcp) */
-                    j += 2;
-                    if (ffurl_open(&rtsp_st->rtp_handle, buf, AVIO_FLAG_READ_WRITE,
-                                   &s->interrupt_callback, NULL) == 0)
-                        goto rtp_opened;
-                }
-            }
+            /* OS will choose local port by itself */
+            ff_url_join(buf, sizeof(buf), "rtp", NULL, host, -1,
+                       "?localport=%d", 0);
+            /* we will use two ports per rtp stream (rtp and rtcp) */
+            j += 2;
+            if (ffurl_open(&rtsp_st->rtp_handle, buf, AVIO_FLAG_READ_WRITE,
+                       &s->interrupt_callback, NULL) == 0)
+               goto rtp_opened;
 
             av_log(s, AV_LOG_ERROR, "Unable to open an input RTP port\n");
             err = AVERROR(EIO);


ffmpeg log before fix (ffmpeg_issue_reproduce.tcap) :

$ ffmpeg -v 10 -an -i rtsp://<login>:<passwd>@<ip-addr>/mpeg4/media.amp -vcodec mpeg1video -r 25 -sameq -acodec mp2 -strict experimental -y -f mpegts ts40_fix2.ts -debug 100
[buffer @ 0x2d5ba40] w:640 h:480 pixfmt:yuv420p tb:1/1000000 sar:1/1 sws_param:
[mpeg1video @ 0x2d810a0] err{or,}_recognition separate: 1; 1
[mpeg1video @ 0x2d810a0] err{or,}_recognition combined: 1; 65537
[mpeg1video @ 0x2d810a0] intra_quant_bias = 96 inter_quant_bias = 0
[mpeg1video @ 0x2d810a0] Unsupported bit depth: 0
[mpeg4 @ 0x2d5be00] err{or,}_recognition separate: 1; 65537
[mpeg4 @ 0x2d5be00] err{or,}_recognition combined: 1; 65537
[mpegts @ 0x2d80880] muxrate VBR, pcr every 2 pkts, sdt every 200, pat/pmt every 40 pkts
Output #0, mpegts, to 'ts40_fix2.ts':
  Metadata:
    title           : Media Presentation
    encoder         : Lavf53.21.0
    Stream #0:0, 0, 1/90000: Video: mpeg1video, yuv420p, 640x480 [SAR 1:1 DAR 4:3], 1/25, q=2-31, 200 kb/s, 90k tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (mpeg4 -> mpeg1video)
Press [q] to stop, [?] for help
[mpeg4 @ 0x2d5be00] Unsupported bit depth: 0
[mpeg4 @ 0x2d5be00] warning: first frame is no keyframe
[mpeg4 @ 0x2d5be00] slice end not reached but screenspace end (1489164 left 765071, score= -14)
[mpeg4 @ 0x2d5be00] concealing 80 DC, 80 AC, 80 MV errors
[mpeg4 @ 0x2d5be00] slice end not reached but screenspace end (948392 left 7F7FC0, score= -28)
[mpeg4 @ 0x2d5be00] concealing 80 DC, 80 AC, 80 MV errors
[mpeg4 @ 0x2d5be00] slice end not reached but screenspace end (198558 left 7F8C6A, score= -42)
[mpeg4 @ 0x2d5be00] concealing 80 DC, 80 AC, 80 MV errors
*** drop!
[mpeg4 @ 0x2d5be00] slice end not reached but screenspace end (167431 left 7F84C0, score= -56)
[mpeg4 @ 0x2d5be00] concealing 80 DC, 80 AC, 80 MV errors
[mpeg4 @ 0x2d5be00] slice end not reached but screenspace end (153098 left 6C06D2, score= -70)
[mpeg4 @ 0x2d5be00] concealing 80 DC, 80 AC, 80 MV errors
[mpeg4 @ 0x2d5be00] slice end not reached but screenspace end (152474 left 633812, score= -84)
[mpeg4 @ 0x2d5be00] concealing 80 DC, 80 AC, 80 MV errors
[mpeg4 @ 0x2d5be00] slice end not reached but screenspace end (147680 left 7FF463, score= -98)
[mpeg4 @ 0x2d5be00] concealing 80 DC, 80 AC, 80 MV errors
*** 1 dup!
[mpeg4 @ 0x2d5be00] slice end not reached but screenspace end (143958 left 7EB50B, score= -112)
[mpeg4 @ 0x2d5be00] concealing 80 DC, 80 AC, 80 MV errors
[mpeg4 @ 0x2d5be00] slice end not reached but screenspace end (143431 left 7E1203, score= -126)
[mpeg4 @ 0x2d5be00] concealing 80 DC, 80 AC, 80 MV errors
[mpeg4 @ 0x2d5be00] slice end not reached but screenspace end (141794 left 565A8B, score= -140)
[mpeg4 @ 0x2d5be00] concealing 80 DC, 80 AC, 80 MV errors
[mpeg4 @ 0x2d5be00] slice end not reached but screenspace end (143286 left 7E1298, score= -154)
[mpeg4 @ 0x2d5be00] concealing 80 DC, 80 AC, 80 MV errors
[mpeg4 @ 0x2d5be00] slice end not reached but screenspace end (146067 left 6447D6, score= -168)
[mpeg4 @ 0x2d5be00] concealing 80 DC, 80 AC, 80 MV errors
[mpeg4 @ 0x2d5be00] slice end not reached but screenspace end (141246 left 7D45A9, score= -182)
[mpeg4 @ 0x2d5be00] concealing 80 DC, 80 AC, 80 MV errors
[mpeg4 @ 0x2d5be00] slice end not reached but screenspace end (143402 left 6E886E, score= -196)
[mpeg4 @ 0x2d5be00] concealing 80 DC, 80 AC, 80 MV errors
[mpeg4 @ 0x2d5be00] slice end not reached but screenspace end (141769 left 01426D, score= -210)
[mpeg4 @ 0x2d5be00] concealing 80 DC, 80 AC, 80 MV errors
[mpeg4 @ 0x2d5be00] slice end not reached but screenspace end (141433 left 51E12E, score= -224)
[mpeg4 @ 0x2d5be00] concealing 80 DC, 80 AC, 80 MV errors
[mpeg4 @ 0x2d5be00] slice end not reached but screenspace end (141028 left 784996, score= -238)
[mpeg4 @ 0x2d5be00] concealing 80 DC, 80 AC, 80 MV errors
[mpeg4 @ 0x2d5be00] slice end not reached but screenspace end (141409 left 366C29, score= -252)
[mpeg4 @ 0x2d5be00] concealing 80 DC, 80 AC, 80 MV errors
*** drop!
[mpeg4 @ 0x2d5be00] slice end not reached but screenspace end (140527 left 7E2F7A, score= -266)
[mpeg4 @ 0x2d5be00] concealing 80 DC, 80 AC, 80 MV errors
[mpeg4 @ 0x2d5be00] slice end not reached but screenspace end (137670 left 7E1B3C, score= -280)
[mpeg4 @ 0x2d5be00] concealing 80 DC, 80 AC, 80 MV errors
[mpeg4 @ 0x2d5be00] slice end not reached but screenspace end (142783 left 7E26BD, score= -294)
[mpeg4 @ 0x2d5be00] concealing 80 DC, 80 AC, 80 MV errors
[mpeg4 @ 0x2d5be00] slice end not reached but screenspace end (141127 left 7EB179, score= -308)
[mpeg4 @ 0x2d5be00] concealing 80 DC, 80 AC, 80 MV errors
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq a301 expected=b2cd
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq 4f67 expected=a307
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq ade1 expected=4f6d
[mpeg4 @ 0x2d5be00] slice end not reached but screenspace end (140384 left 7FE4D2, score= -322)
[mpeg4 @ 0x2d5be00] concealing 80 DC, 80 AC, 80 MV errors
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq a307 expected=b2d3
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq 4f6d expected=a30d
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq ade7 expected=4f73
[mpeg4 @ 0x2d5be00] slice end not reached but screenspace end (141124 left 70886A, score= -336)
[mpeg4 @ 0x2d5be00] concealing 80 DC, 80 AC, 80 MV errors
*** drop!
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq a30d expected=b2d9
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq 4f73 expected=a313
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq aded expected=4f79
[mpeg4 @ 0x2d5be00] slice end not reached but screenspace end (140332 left 7AB8C1, score= -350)
[mpeg4 @ 0x2d5be00] concealing 80 DC, 80 AC, 80 MV errors
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq a313 expected=b2df
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq 4f79 expected=a318
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq adf3 expected=4f7e
[mpeg4 @ 0x2d5be00] slice end not reached but screenspace end (136949 left 78E4F6, score= -364)
[mpeg4 @ 0x2d5be00] concealing 80 DC, 80 AC, 80 MV errors
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq a318 expected=b2e4
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq 4f7e expected=a31e
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq adf8 expected=4f84
[mpeg4 @ 0x2d5be00] slice end not reached but screenspace end (142038 left 7C6B6B, score= -378)
[mpeg4 @ 0x2d5be00] concealing 80 DC, 80 AC, 80 MV errors
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq a31e expected=b2ea
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq 4f84 expected=a325
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq adfe expected=4f8b
[mpeg4 @ 0x2d5be00] slice end not reached but screenspace end (192554 left 5A3B68, score= -392)
[mpeg4 @ 0x2d5be00] concealing 80 DC, 80 AC, 80 MV errors
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq a325 expected=b2f1
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq 4f8b expected=a32c
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq ae05 expected=4f92
[mpeg4 @ 0x2d5be00] slice end not reached but screenspace end (177890 left 4166F1, score= -406)
[mpeg4 @ 0x2d5be00] concealing 80 DC, 80 AC, 80 MV errors
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq a32c expected=b2f8
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq 4f92 expected=a332
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq ae0c expected=4f98
[mpeg4 @ 0x2d5be00] slice end not reached but screenspace end (156392 left 7F9E61, score= -420)
[mpeg4 @ 0x2d5be00] concealing 80 DC, 80 AC, 80 MV errors
*** drop!ffmpeg_issue_reproduce.tcap
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq a332 expected=b2fe
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq 4f98 expected=a338
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq ae12 expected=4f9e
[mpeg4 @ 0x2d5be00] slice end not reached but screenspace end (164933 left 79E083, score= -434)
[mpeg4 @ 0x2d5be00] concealing 80 DC, 80 AC, 80 MV errors
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq a338 expected=b304
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq 4f9e expected=a354
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq ae18 expected=4fba
[mpeg4 @ 0x2d5be00] slice end not reached but screenspace end (926521 left 5B179F, score= -448)
[mpeg4 @ 0x2d5be00] concealing 80 DC, 80 AC, 80 MV errors
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq a354 expected=b320
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq 4fba expected=a35b
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq ae34 expected=4fc1
[mpeg4 @ 0x2d5be00] slice end not reached but screenspace end (203023 left 7FA34D, score= -462)
[mpeg4 @ 0x2d5be00] concealing 80 DC, 80 AC, 80 MV errors
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq a35b expected=b327
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq 4fc1 expected=a362
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq ae3b expected=4fc8
[mpeg4 @ 0x2d5be00] slice end not reached but screenspace end (191018 left 4BB047, score= -476)
[mpeg4 @ 0x2d5be00] concealing 80 DC, 80 AC, 80 MV errors
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq a362 expected=b32e
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq 4fc8 expected=a369
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq ae42 expected=4fcf
[mpeg4 @ 0x2d5be00] slice end not reached but screenspace end (182860 left 7032E2, score= -490)
[mpeg4 @ 0x2d5be00] concealing 80 DC, 80 AC, 80 MV errors
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq a369 expected=b335
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq 4fcf expected=a36f
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq ae49 expected=4fd5
[mpeg4 @ 0x2d5be00] slice end not reached but screenspace end (174892 left 7F6B1C, score= -504)
[mpeg4 @ 0x2d5be00] concealing 80 DC, 80 AC, 80 MV errors
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq a36f expected=b33b
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq 4fd5 expected=a375
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq ae4f expected=4fdb
[mpeg4 @ 0x2d5be00] slice end not reached but screenspace end (175155 left 7E1E35, score= -518)
[mpeg4 @ 0x2d5be00] concealing 80 DC, 80 AC, 80 MV errors
frame=   34 fps=  0 q=0.0 size=     785kB time=00:00:01.32 bitrate=4874.3kbits/s dup=1RTP: PT=60: bad cseq a375 expected=b341
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq 4fdb expected=a37b
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq ae55 expected=4fe1
[mpeg4 @ 0x2d5be00] slice end not reached but screenspace end (149767 left 7FEF0E, score= -532)
[mpeg4 @ 0x2d5be00] concealing 80 DC, 80 AC, 80 MV errors
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq a37b expected=b347
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq 4fe1 expected=a381
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq ae5b expected=4fe7
[mpeg4 @ 0x2d5be00] slice end not reached but screenspace end (159173 left 7ACCB7, score= -546)
[mpeg4 @ 0x2d5be00] concealing 80 DC, 80 AC, 80 MV errors
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq a381 expected=b34d
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq 4fe7 expected=a387
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq ae61 expected=4fed
[mpeg4 @ 0x2d5be00] slice end not reached but screenspace end (152593 left 270A04, score= -560)
[mpeg4 @ 0x2d5be00] concealing 80 DC, 80 AC, 80 MV errors
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq a387 expected=b353
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq 4fed expected=a38d
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq ae67 expected=4ff3
[mpeg4 @ 0x2d5be00] slice end not reached but screenspace end (143620 left 7BB474, score= -574)
[mpeg4 @ 0x2d5be00] concealing 80 DC, 80 AC, 80 MV errors
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq a38d expected=b359
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq 4ff3 expected=a394
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq ae6d expected=4ffa
[mpeg4 @ 0x2d5be00] slice end not reached but screenspace end (186457 left 4B6321, score= -588)
[mpeg4 @ 0x2d5be00] concealing 80 DC, 80 AC, 80 MV errors
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq a394 expected=b360
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq 4ffa expected=a39a
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq ae74 expected=5000
[mpeg4 @ 0x2d5be00] slice end not reached but screenspace end (146408 left 7F4F34, score= -602)
[mpeg4 @ 0x2d5be00] concealing 80 DC, 80 AC, 80 MV errors
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq a39a expected=b366
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq 5000 expected=a3a1
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq ae7a expected=5007
[mpeg4 @ 0x2d5be00] slice end not reached but screenspace end (181925 left 7D86DC, score= -616)
[mpeg4 @ 0x2d5be00] concealing 80 DC, 80 AC, 80 MV errors
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq a3a1 expected=b36d
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq 5007 expected=a3a7
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq ae81 expected=500d
[mpeg4 @ 0x2d5be00] slice end not reached but screenspace end (148393 left 3C07D8, score= -630)
[mpeg4 @ 0x2d5be00] concealing 80 DC, 80 AC, 80 MV errors
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq a3a7 expected=b373
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq 500d expected=a3ad
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq ae87 expected=5013
[mpeg4 @ 0x2d5be00] slice end not reached but screenspace end (169898 left 6B72B2, score= -644)
[mpeg4 @ 0x2d5be00] concealing 80 DC, 80 AC, 80 MV errors
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq a3ad expected=b379
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq 5013 expected=a3b3
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq ae8d expected=5019
[mpeg4 @ 0x2d5be00] slice end not reached but screenspace end (153075 left 7CA4FE, score= -658)
[mpeg4 @ 0x2d5be00] concealing 80 DC, 80 AC, 80 MV errors
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq a3b3 expected=b37f
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq 5019 expected=a3b9
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq ae93 expected=501f
[mpeg4 @ 0x2d5be00] slice end not reached but screenspace end (145828 left 711F06, score= -672)
[mpeg4 @ 0x2d5be00] concealing 80 DC, 80 AC, 80 MV errors
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq a3b9 expected=b385
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq 501f expected=a3bf
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq ae99 expected=5025
[mpeg4 @ 0x2d5be00] slice end not reached but screenspace end (146979 left 700B32, score= -686)
[mpeg4 @ 0x2d5be00] concealing 80 DC, 80 AC, 80 MV errors
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq a3bf expected=b38b
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq 5025 expected=a3c4
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq ae9f expected=502a
[mpeg4 @ 0x2d5be00] slice end not reached but screenspace end (139830 left 7DF3AB, score= -700)
[mpeg4 @ 0x2d5be00] concealing 80 DC, 80 AC, 80 MV errors
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq a3c4 expected=b390
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq 502a expected=a3ca
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq aea4 expected=5030
[mpeg4 @ 0x2d5be00] slice end not reached but screenspace end (145543 left 7F6D3B, score= -714)
[mpeg4 @ 0x2d5be00] concealing 80 DC, 80 AC, 80 MV errors
*** drop!
frame=   47 fps= 44 q=0.0 size=    1055kB time=00:00:01.84 bitrate=4697.5kbits/s dup=1RTP: PT=60: bad cseq a3ca expected=b396
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq 5030 expected=a3d1
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq aeaa expected=5037
[mpeg4 @ 0x2d5be00] slice end not reached but screenspace end (179691 left 750E88, score= -728)
[mpeg4 @ 0x2d5be00] concealing 80 DC, 80 AC, 80 MV errors
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq a3d1 expected=b39d
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq 5037 expected=a3d7
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq aeb1 expected=503d
[mpeg4 @ 0x2d5be00] slice end not reached but screenspace end (173792 left 7FC7C6, score= -742)
[mpeg4 @ 0x2d5be00] concealing 80 DC, 80 AC, 80 MV errors
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq a3d7 expected=b3a3
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq 503d expected=a3de
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq aeb7 expected=5044
[mpeg4 @ 0x2d5be00] slice end not reached but screenspace end (178993 left 42B49C, score= -756)
[mpeg4 @ 0x2d5be00] concealing 80 DC, 80 AC, 80 MV errors
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq a3de expected=b3aa
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq 5044 expected=a3e4
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq aebe expected=504a
[mpeg4 @ 0x2d5be00] slice end not reached but screenspace end (174677 left 785C84, score= -770)
[mpeg4 @ 0x2d5be00] concealing 80 DC, 80 AC, 80 MV errors
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq a3e4 expected=b3b0
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq 504a expected=a3eb
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq aec4 expected=5051
[mpeg4 @ 0x2d5be00] slice end not reached but screenspace end (179863 left 7E0128, score= -784)
[mpeg4 @ 0x2d5be00] concealing 80 DC, 80 AC, 80 MV errors
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq a3eb expected=b3b7
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq 5051 expected=a3f2
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq aecb expected=5058
[mpeg4 @ 0x2d5be00] slice end not reached but screenspace end (183006 left 7D5A49, score= -798)
[mpeg4 @ 0x2d5be00] concealing 80 DC, 80 AC, 80 MV errors
*** drop!
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq a3f2 expected=b3be
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq 5058 expected=a3f9
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq aed2 expected=505f
[mpeg4 @ 0x2d5be00] slice end not reached but screenspace end (187758 left 7EB709, score= -812)
[mpeg4 @ 0x2d5be00] concealing 80 DC, 80 AC, 80 MV errors
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq a3f9 expected=b3c5
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq 505f expected=a400
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq aed9 expected=5066
[mpeg4 @ 0x2d5be00] slice end not reached but screenspace end (187201 left 4DBD6B, score= -826)
[mpeg4 @ 0x2d5be00] concealing 80 DC, 80 AC, 80 MV errors
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq a400 expected=b3cc
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq 5066 expected=a407
[mpeg4 @ 0x2d5be00] RTP: PT=60: bad cseq aee0 expected=506d
[mpeg4 @ 0x2d5be00] slice end not reached but screenspace end (189481 left 6CEF46, score= -840)
[mpeg4 @ 0x2d5be00] concealing 80 DC, 80 AC, 80 MV errors
frame=   55 fps= 39 q=0.0 Lsize=    1267kB time=00:00:02.16 bitrate=4806.5kbits/s dup=1 drop=6    
video:1169kB audio:0kB global headers:0kB muxing overhead 8.394320%
Received signal 2: terminating.

ffmpeg log after fix (ffmpeg_issue_fix.tcap):

$  ffmpeg -v 10 -an -i rtsp://<login>:<passwd>@<ip-addr>/mpeg4/media.amp -vcodec mpeg1video -r 25 -sameq -acodec mp2 -strict experimental -y -f mpegts ts40_fix2.ts -debug 100
[buffer @ 0x2316b20] w:640 h:480 pixfmt:yuv420p tb:1/1000000 sar:1/1 sws_param:
[mpeg1video @ 0x233c1a0] err{or,}_recognition separate: 1; 1
[mpeg1video @ 0x233c1a0] err{or,}_recognition combined: 1; 65537
[mpeg1video @ 0x233c1a0] intra_quant_bias = 96 inter_quant_bias = 0
[mpeg1video @ 0x233c1a0] Unsupported bit depth: 0
[mpeg4 @ 0x2316e00] err{or,}_recognition separate: 1; 65537
[mpeg4 @ 0x2316e00] err{or,}_recognition combined: 1; 65537
[mpegts @ 0x233b880] muxrate VBR, pcr every 2 pkts, sdt every 200, pat/pmt every 40 pkts
Output #0, mpegts, to 'ts40_fix2.ts':
  Metadata:
    title           : Media Presentation
    encoder         : Lavf53.21.0
    Stream #0:0, 0, 1/90000: Video: mpeg1video, yuv420p, 640x480 [SAR 1:1 DAR 4:3], 1/25, q=2-31, 200 kb/s, 90k tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (mpeg4 -> mpeg1video)
Press [q] to stop, [?] for help
[mpeg4 @ 0x2316e00] Unsupported bit depth: 0
[mpeg4 @ 0x2316e00] warning: first frame is no keyframe
*** drop!
    Last message repeated 2 times
frame=   34 fps=  0 q=0.0 size=    1323kB time=00:00:01.32 bitrate=8208.2kbits/s dup=0*** drop!  
    Last message repeated 1 times
frame=   47 fps= 46 q=0.0 size=    1812kB time=00:00:01.84 bitrate=8069.3kbits/s dup=0*** drop!  
    Last message repeated 1 times
frame=   59 fps= 38 q=0.0 size=    2331kB time=00:00:02.32 bitrate=8230.5kbits/s dup=0*** drop!  
frame=   73 fps= 35 q=0.0 size=    2907kB time=00:00:02.88 bitrate=8268.9kbits/s dup=0*** drop!  
    Last message repeated 1 times
frame=   85 fps= 33 q=0.0 size=    3408kB time=00:00:03.36 bitrate=8310.0kbits/s dup=0*** drop!   
    Last message repeated 1 times
frame=   98 fps= 32 q=0.0 size=    3891kB time=00:00:03.88 bitrate=8215.8kbits/s dup=0*** drop!   
frame=  111 fps= 31 q=0.0 size=    4397kB time=00:00:04.40 bitrate=8186.9kbits/s dup=0*** drop!   
    Last message repeated 1 times
frame=  124 fps= 30 q=0.0 size=    4927kB time=00:00:04.92 bitrate=8203.5kbits/s dup=0*** drop!   
    Last message repeated 1 times
frame=  136 fps= 29 q=0.0 size=    5424kB time=00:00:05.40 bitrate=8228.8kbits/s dup=0*** drop!   
frame=  150 fps= 29 q=0.0 size=    5939kB time=00:00:05.96 bitrate=8162.5kbits/s dup=0*** drop!   
frame=  163 fps= 29 q=0.0 size=    6479kB time=00:00:06.48 bitrate=8190.8kbits/s dup=0*** drop!   
    Last message repeated 1 times
frame=  176 fps= 28 q=0.0 size=    6981kB time=00:00:07.00 bitrate=8169.3kbits/s dup=0*** drop!   
    Last message repeated 1 times
frame=  189 fps= 28 q=0.0 size=    7463kB time=00:00:07.52 bitrate=8130.4kbits/s dup=0*** drop!   
frame=  203 fps= 28 q=0.0 size=    8018kB time=00:00:08.08 bitrate=8129.0kbits/s dup=0*** drop!   
    Last message repeated 1 times
frame=  216 fps= 28 q=0.0 size=    8555kB time=00:00:08.60 bitrate=8148.9kbits/s dup=0*** drop!   
    Last message repeated 1 times
frame=  229 fps= 27 q=0.0 size=    9101kB time=00:00:09.12 bitrate=8174.9kbits/s dup=0*** drop!   
frame=  243 fps= 27 q=0.0 size=    9681kB time=00:00:09.68 bitrate=8192.9kbits/s dup=0*** drop!   
frame=  257 fps= 27 q=0.0 size=   10222kB time=00:00:10.24 bitrate=8178.0kbits/s dup=0*** drop!   
    Last message repeated 1 times
frame=  270 fps= 27 q=0.0 size=   10776kB time=00:00:10.76 bitrate=8203.9kbits/s dup=0*** drop!   
    Last message repeated 1 times
frame=  283 fps= 27 q=0.0 size=   11264kB time=00:00:11.28 bitrate=8180.3kbits/s dup=0*** drop!   
frame=  297 fps= 27 q=0.0 size=   11841kB time=00:00:11.84 bitrate=8192.4kbits/s dup=0*** drop!   
frame=  311 fps= 27 q=0.0 size=   12397kB time=00:00:12.40 bitrate=8190.1kbits/s dup=0*** drop!   
    Last message repeated 1 times
frame=  324 fps= 27 q=0.0 size=   12958kB time=00:00:12.92 bitrate=8216.4kbits/s dup=0*** drop!   
    Last message repeated 1 times
frame=  337 fps= 27 q=0.0 size=   13517kB time=00:00:13.44 bitrate=8238.9kbits/s dup=0*** drop!   
frame=  351 fps= 27 q=0.0 size=   14103kB time=00:00:14.00 bitrate=8252.1kbits/s dup=0*** drop!   
    Last message repeated 1 times
frame=  364 fps= 27 q=0.0 size=   14627kB time=00:00:14.52 bitrate=8252.3kbits/s dup=0*** drop!   
    Last message repeated 1 times
frame=  377 fps= 26 q=0.0 size=   15104kB time=00:00:15.04 bitrate=8226.7kbits/s dup=0*** drop!   
frame=  391 fps= 26 q=0.0 size=   15661kB time=00:00:15.60 bitrate=8223.8kbits/s dup=0*** drop!   
frame=  405 fps= 26 q=0.0 size=   16221kB time=00:00:16.16 bitrate=8223.0kbits/s dup=0*** drop!   
    Last message repeated 1 times
frame=  418 fps= 26 q=0.0 size=   16723kB time=00:00:16.68 bitrate=8213.1kbits/s dup=0*** drop!   
    Last message repeated 1 times
frame=  431 fps= 26 q=0.0 size=   17220kB time=00:00:17.20 bitrate=8201.4kbits/s dup=0*** drop!   
frame=  445 fps= 26 q=0.0 size=   17842kB time=00:00:17.76 bitrate=8230.0kbits/s dup=0*** drop!   
    Last message repeated 1 times
frame=  457 fps= 26 q=0.0 size=   18333kB time=00:00:18.24 bitrate=8233.7kbits/s dup=0*** drop!   
    Last message repeated 1 times
frame=  470 fps= 26 q=0.0 size=   18876kB time=00:00:18.76 bitrate=8242.7kbits/s dup=0*** drop!   
frame=  483 fps= 26 q=0.0 size=   19409kB time=00:00:19.28 bitrate=8247.0kbits/s dup=0*** drop!   
frame=  496 fps= 26 q=0.0 size=   19975kB time=00:00:19.80 bitrate=8264.3kbits/s dup=0*** drop!   
frame=  509 fps= 26 q=0.0 size=   20481kB time=00:00:20.32 bitrate=8257.0kbits/s dup=0*** drop!   
    Last message repeated 1 times
frame=  521 fps= 26 q=0.0 size=   21042kB time=00:00:20.80 bitrate=8287.5kbits/s dup=0*** drop!   
    Last message repeated 1 times
frame=  534 fps= 26 q=0.0 size=   21545kB time=00:00:21.32 bitrate=8278.3kbits/s dup=0frame=  548 fps= 26 q=0.0 size=   22127kB time=00:00:21.88 bitrate=8284.4kbits/s dup=0*** drop!   
    Last message repeated 1 times
frame=  561 fps= 26 q=0.0 size=   22638kB time=00:00:22.40 bitrate=8279.0kbits/s dup=0*** drop!   
    Last message repeated 1 times
frame=  573 fps= 26 q=0.0 size=   23146kB time=00:00:22.88 bitrate=8287.2kbits/s dup=0*** drop!   
frame=  587 fps= 26 q=0.0 size=   23693kB time=00:00:23.44 bitrate=8280.4kbits/s dup=0*** drop!   
    Last message repeated 1 times
frame=  599 fps= 26 q=0.0 size=   24211kB time=00:00:23.92 bitrate=8291.7kbits/s dup=0*** drop!   
frame=  613 fps= 26 q=0.0 size=   24797kB time=00:00:24.48 bitrate=8298.0kbits/s dup=0*** drop!   
frame=  626 fps= 26 q=0.0 size=   25348kB time=00:00:25.00 bitrate=8306.1kbits/s dup=0*** drop!   
    Last message repeated 1 times
frame=  639 fps= 26 q=0.0 size=   25868kB time=00:00:25.52 bitrate=8303.6kbits/s dup=0*** drop!   
    Last message repeated 1 times
frame=  651 fps= 26 q=0.0 size=   26395kB time=00:00:26.00 bitrate=8316.5kbits/s dup=0*** drop!   
frame=  658 fps= 26 q=0.0 Lsize=   26629kB time=00:00:26.28 bitrate=8300.9kbits/s dup=0 drop=77    
video:24632kB audio:0kB global headers:0kB muxing overhead 8.109508%
Received signal 2: terminating.

Last edited 12 years ago by Dmitry Volyntsev (previous) (diff)

comment:2 by Carl Eugen Hoyos, 12 years ago

Keywords: udp added
Reproduced by developer: unset

Please consider sending patches to ffmpeg-devel, they receive more attention there.

by Dmitry Volyntsev, 12 years ago

proposed patch

by Dmitry Volyntsev, 12 years ago

Attachment: ffmpeg_916_issue_fix.tcap added

wireshark log after patches 0001-fix-rtp-916-issue.patch & 0002-fix-rtp-916-issue-patch-2.patch were applied

by Dmitry Volyntsev, 12 years ago

final committed patch 1

by Dmitry Volyntsev, 12 years ago

final committed patch 2

comment:3 by Dmitry Volyntsev, 12 years ago

Patches with fixes were committed to upstream (http://ffmpeg.org/pipermail/ffmpeg-devel/2012-January/119515.html) , so ticket could be closed

comment:4 by Carl Eugen Hoyos, 12 years ago

Resolution: fixed
Status: newclosed

Thank you for the patches!

Note: See TracTickets for help on using tickets.