Opened 6 years ago

Closed 6 years ago

#2962 closed defect (fixed)

MPEG TS stream: Failed assertion

Reported by: Underground78 Owned by:
Priority: important Component: avformat
Version: git-master Keywords: mpegts crash abort regression
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no


Summary of the bug:
Trying to open a MPEG TS stream leads to a failed assertion in libavformat/mpegts.c at line 1865: av_assert0(pos >= TS_PACKET_SIZE);. This assertion was added in

How to reproduce:
I was able to reproduce using a RTSP stream but unfortunately it's locked by my ISP (Free in France). Someone else was able to reproduce with another locked stream from another ISP.

Change History (8)

comment:1 Changed 6 years ago by Underground78

Note to self: Original ticket:

comment:2 Changed 6 years ago by cehoyos

  • Keywords mpegts crash abort added
  • Priority changed from normal to important

If you cannot provide a sample, please provide a gdb backtrace.

comment:3 Changed 6 years ago by Underground78

Here is a package to reproduce the bug on Windows streaming a file with VLC (thanks to Kasper):

  1. Run the .bat file
  2. Run ffmpeg -i rtp://

You will have to adapt that on Linux but it should be pretty much straightforward.

Last edited 6 years ago by Underground78 (previous) (diff)

comment:4 Changed 6 years ago by cehoyos

  • Keywords regression added
  • Reproduced by developer set
  • Status changed from new to open
(gdb) r -i rtp://
Starting program: /home/cehoyos/test/cehoyos/FFmpeg/ffmpeg_g -i rtp://
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/".
ffmpeg version N-56297-g7ac6c63 Copyright (c) 2000-2013 the FFmpeg developers
  built on Sep 15 2013 23:50:37 with gcc 4.7 (SUSE Linux)
  configuration: --enable-gpl
  libavutil      52. 43.100 / 52. 43.100
  libavcodec     55. 31.101 / 55. 31.101
  libavformat    55. 16.102 / 55. 16.102
  libavdevice    55.  3.100 / 55.  3.100
  libavfilter     3. 84.100 /  3. 84.100
  libswscale      2.  5.100 /  2.  5.100
  libswresample   0. 17.103 /  0. 17.103
  libpostproc    52.  3.100 / 52.  3.100
Assertion pos >= 188 failed at libavformat/mpegts.c:1865

Program received signal SIGABRT, Aborted.
0x00007ffff6048d25 in raise () from /lib64/
(gdb) bt
#0  0x00007ffff6048d25 in raise () from /lib64/
#1  0x00007ffff604a1a8 in abort () from /lib64/
#2  0x0000000000561755 in handle_packet (ts=ts@entry=0x16f0360,
    packet=packet@entry=0x17249a8 "G@D\033") at libavformat/mpegts.c:1865
#3  0x0000000000565aff in ff_mpegts_parse_packet (ts=0x16f0360, pkt=<optimized out>,
    buf=0x17249a8 "G@D\033", buf@entry=0x17248ec "G", len=1128, len@entry=1316)
    at libavformat/mpegts.c:2413
#4  0x000000000059efb4 in mpegts_handle_packet (ctx=<optimized out>, data=0x16ee320,
    st=<optimized out>, pkt=<optimized out>, timestamp=<optimized out>, buf=0x17248ec "G",
    len=1316, seq=58721, flags=2) at libavformat/rtpdec_mpegts.c:86
#5  0x000000000059952c in rtp_parse_packet_internal (s=s@entry=0x16ea1e0,
    pkt=pkt@entry=0x7fffffffd190, buf=0x17248ec "G", buf@entry=0x17248e0 "\200\241\345a",
    len=1316, len@entry=1328) at libavformat/rtpdec.c:638
#6  0x000000000059a6e1 in rtp_parse_one_packet (len=1328, bufptr=<optimized out>,
    pkt=0x7fffffffd190, s=0x16ea1e0) at libavformat/rtpdec.c:785
#7  ff_rtp_parse_packet (s=0x16ea1e0, pkt=pkt@entry=0x7fffffffd190,
    bufptr=bufptr@entry=0x16e9cc0, len=len@entry=1328) at libavformat/rtpdec.c:815
#8  0x00000000005aa43b in ff_rtsp_fetch_packet (s=0x16e8080, pkt=0x7fffffffd190)
    at libavformat/rtsp.c:2034
#9  0x00000000005ca312 in ff_read_packet (s=s@entry=0x16e8080, pkt=pkt@entry=0x7fffffffd190)
    at libavformat/utils.c:651
#10 0x00000000005cc230 in read_frame_internal (s=s@entry=0x16e8080,
    pkt=pkt@entry=0x7fffffffd3b0) at libavformat/utils.c:1307
#11 0x00000000005cf71f in avformat_find_stream_info (ic=0x16e8080, options=0x0)
    at libavformat/utils.c:2791
#12 0x0000000000460acb in open_input_file (o=o@entry=0x7fffffffd700,
    filename=<optimized out>) at ffmpeg_opt.c:809
#13 0x000000000045f5b4 in open_files (inout=inout@entry=0xc9975f "input",
    open_file=open_file@entry=0x4606f0 <open_input_file>, l=<optimized out>,
    l=<optimized out>) at ffmpeg_opt.c:2494
#14 0x0000000000466909 in ffmpeg_parse_options (argc=argc@entry=3,
    argv=argv@entry=0x7fffffffdd98) at ffmpeg_opt.c:2531
#15 0x000000000045d198 in main (argc=3, argv=0x7fffffffdd98) at ffmpeg.c:3393

comment:5 Changed 6 years ago by cehoyos

Command lines to reproduce the problem:

$ ffmpeg -f lavfi -i testsrc stream.ts


$ vlc stream.ts --sout="#rtp{dst=,port=4444,sdp=rtsp://, mux=ts}" --loop

comment:6 Changed 6 years ago by Underground78

Any news about this?

comment:7 Changed 6 years ago by Underground78

Note that if I comment out the assert, the IPTV stream I used to reproduce this issue can be decoded just fine.

comment:8 Changed 6 years ago by michael

  • Resolution set to fixed
  • Status changed from open to closed
Note: See TracTickets for help on using tickets.