Opened 9 years ago

Closed 9 years ago

#4790 closed defect (duplicate)

Error in `ffmpeg': double free or corruption with -segment

Reported by: Roman Gaufman Owned by:
Priority: normal Component: undetermined
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

I'm using git-2015-08-14-a604289. It seems when I add the -segment option while transcoding, I am getting a double free or corruption and ffmpeg dies :(

How to reproduce:

$ ffmpeg -use_wallclock_as_timestamps 1 -loglevel debug -an -rtsp_transport tcp -i rtsp://127.0.0.1:10105/proxyStream -dn -map 0 -pix_fmt yuv420p -codec:v libx264 -preset ultrafast -crf 30.0 -f segment -segment_time 60 -segment_wrap 10 -segment_list_flags live -segment_list_size 10 -reset_timestamps 1 -segment_list 52797b29c5399f4bf505e3d7.csv -y 52797b29c5399f4bf505e3d7_%02d.mkv
ffmpeg version git-2015-08-14-a604289 Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.9.2 (Ubuntu 4.9.2-10ubuntu13)
  configuration: --enable-libx264 --enable-libfdk_aac --enable-gpl --enable-nonfree --enable-shared --enable-pic
  libavutil      54. 30.100 / 54. 30.100
  libavcodec     56. 57.100 / 56. 57.100
  libavformat    56. 40.101 / 56. 40.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 33.100 /  5. 33.100
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.101 /  1.  2.101
  libpostproc    53.  3.100 / 53.  3.100
Splitting the commandline.
Reading option '-use_wallclock_as_timestamps' ... matched as AVOption 'use_wallclock_as_timestamps' with argument '1'.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'debug'.
Reading option '-an' ... matched as option 'an' (disable audio) with argument '1'.
Reading option '-rtsp_transport' ... matched as AVOption 'rtsp_transport' with argument 'tcp'.
Reading option '-i' ... matched as input file with argument 'rtsp://127.0.0.1:10105/proxyStream'.
Reading option '-dn' ... matched as option 'dn' (disable data) with argument '1'.
Reading option '-map' ... matched as option 'map' (set input stream mapping) with argument '0'.
Reading option '-pix_fmt' ... matched as option 'pix_fmt' (set pixel format) with argument 'yuv420p'.
Reading option '-codec:v' ... matched as option 'codec' (codec name) with argument 'libx264'.
Reading option '-preset' ... matched as AVOption 'preset' with argument 'ultrafast'.
Reading option '-crf' ... matched as AVOption 'crf' with argument '30.0'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'segment'.
Reading option '-segment_time' ... matched as AVOption 'segment_time' with argument '60'.
Reading option '-segment_wrap' ... matched as AVOption 'segment_wrap' with argument '10'.
Reading option '-segment_list_flags' ... matched as AVOption 'segment_list_flags' with argument 'live'.
Reading option '-segment_list_size' ... matched as AVOption 'segment_list_size' with argument '10'.
Reading option '-reset_timestamps' ... matched as AVOption 'reset_timestamps' with argument '1'.
Reading option '-segment_list' ... matched as AVOption 'segment_list' with argument '52797b29c5399f4bf505e3d7.csv'.
Reading option '-y' ... matched as option 'y' (overwrite output files) with argument '1'.
Reading option '52797b29c5399f4bf505e3d7_%02d.mkv' ... matched as output file.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option loglevel (set logging level) with argument debug.
Applying option y (overwrite output files) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input file rtsp://127.0.0.1:10105/proxyStream.
Applying option an (disable audio) with argument 1.
Successfully parsed a group of options.
Opening an input file: rtsp://127.0.0.1:10105/proxyStream.
[rtsp @ 0x1890880] SDP:
v=0
o=- 1440149753036288 1 IN IP4 192.168.0.2
s=LIVE555 Streaming Media v2015.08.07
i=LIVE555 Streaming Media v2015.08.07
t=0 0
a=tool:LIVE555 Streaming Media v2015.08.07
a=type:broadcast
a=control:*
a=range:npt=0-
a=x-qt-text-nam:LIVE555 Streaming Media v2015.08.07
a=x-qt-text-inf:LIVE555 Streaming Media v2015.08.07
m=video 0 RTP/AVP 96
c=IN IP4 0.0.0.0
b=AS:3000
a=rtpmap:96 MP4V-ES/90000
a=fmtp:96 profile-level-id=1;config=000001B001000001B5090000010000000120008C4007A8A021E0A31F
a=control:track1

Failed to parse interval end specification ''
[rtsp @ 0x1890880] video codec set to: mpeg4
[rtsp @ 0x1890880] hello state=0
Failed to parse interval end specification ''
[mpeg4 @ 0x18935e0] warning: first frame is no keyframe
[rtsp @ 0x1890880] invalid dts/pts combination 129613521537465
[rtsp @ 0x1890880] invalid dts/pts combination 129613521541293
[rtsp @ 0x1890880] All info found
Input #0, rtsp, from 'rtsp://127.0.0.1:10105/proxyStream':
  Metadata:
    title           : LIVE555 Streaming Media v2015.08.07
    comment         : LIVE555 Streaming Media v2015.08.07
  Duration: N/A, start: 1440150239.305167, bitrate: N/A
    Stream #0:0, 3, 1/90000: Video: mpeg4 (Simple Profile), 1 reference frame, yuv420p(left), 640x480 [SAR 10:11 DAR 40:33], 1/30, 30 fps, 30 tbr, 90k tbn, 30 tbc
Successfully opened the file.
Parsing a group of options: output file 52797b29c5399f4bf505e3d7_%02d.mkv.
Applying option dn (disable data) with argument 1.
Applying option map (set input stream mapping) with argument 0.
Applying option pix_fmt (set pixel format) with argument yuv420p.
Applying option codec:v (codec name) with argument libx264.
Applying option f (force format) with argument segment.
Successfully parsed a group of options.
Opening an output file: 52797b29c5399f4bf505e3d7_%02d.mkv.
Successfully opened the file.
detected 4 logical cores
[graph 0 input from stream 0:0 @ 0x18b1000] Setting 'video_size' to value '640x480'
[graph 0 input from stream 0:0 @ 0x18b1000] Setting 'pix_fmt' to value '0'
[graph 0 input from stream 0:0 @ 0x18b1000] Setting 'time_base' to value '1/90000'
[graph 0 input from stream 0:0 @ 0x18b1000] Setting 'pixel_aspect' to value '10/11'
[graph 0 input from stream 0:0 @ 0x18b1000] Setting 'sws_param' to value 'flags=2'
[graph 0 input from stream 0:0 @ 0x18b1000] Setting 'frame_rate' to value '30/1'
[graph 0 input from stream 0:0 @ 0x18b1000] w:640 h:480 pixfmt:yuv420p tb:1/90000 fr:30/1 sar:10/11 sws_param:flags=2
[format @ 0x18b0c20] compat: called with args=[yuv420p]
[format @ 0x18b0c20] Setting 'pix_fmts' to value 'yuv420p'
[AVFilterGraph @ 0x18b1580] query_formats: 4 queried, 3 merged, 0 already done, 0 delayed
[libx264 @ 0x1956720] using mv_range_thread = 40
[libx264 @ 0x1956720] using SAR=10/11
[libx264 @ 0x1956720] using cpu capabilities: MMX2 SSE2Fast SSSE3 Cache64 SlowShuffle
[libx264 @ 0x1956720] profile Constrained Baseline, level 3.0
[libx264 @ 0x1956720] 264 - core 148 r2 73ae2d1 - H.264/MPEG-4 AVC codec - Copyleft 2003-2015 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=25 scenecut=0 intra_refresh=0 rc=crf mbtree=0 crf=30.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=0
[segment @ 0x18afe80] Selected stream id:0 type:video
Output #0, segment, to '52797b29c5399f4bf505e3d7_%02d.mkv':
  Metadata:
    title           : LIVE555 Streaming Media v2015.08.07
    comment         : LIVE555 Streaming Media v2015.08.07
    encoder         : Lavf56.40.101
    Stream #0:0, 0, 1/1000: Video: h264 (libx264), -1 reference frame, yuv420p(left), 640x480 [SAR 10:11 DAR 40:33], 1/30, q=-1--1, 30 fps, 1k tbn, 30 tbc
    Metadata:
      encoder         : Lavc56.57.100 libx264
Stream mapping:
  Stream #0:0 -> #0:0 (mpeg4 (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[mpeg4 @ 0x1e5dec0] warning: first frame is no keyframe
[rtsp @ 0x1890880] invalid dts/pts combination 129613521544911
[rtsp @ 0x1890880] invalid dts/pts combination 129613521548510
[rtsp @ 0x1890880] invalid dts/pts combination 129613521552125
[rtsp @ 0x1890880] invalid dts/pts combination 129613521555717
[rtsp @ 0x1890880] invalid dts/pts combination 129613521559328
[rtsp @ 0x1890880] invalid dts/pts combination 129613521562932
[rtsp @ 0x1890880] invalid dts/pts combination 129613521566530
[rtsp @ 0x1890880] invalid dts/pts combination 129613521570194
[rtsp @ 0x1890880] invalid dts/pts combination 129613521573837
Past duration 0.915993 too large
[libx264 @ 0x1956720] frame=   0 QP=27.00 NAL=3 Slice:I Poc:0   I:1200 P:0    SKIP:0    size=919 bytes
[segment @ 0x18afe80] segment:'52797b29c5399f4bf505e3d7_00.mkv' starts with packet stream:0 pts:0 pts_time:0 frame:0
[segment @ 0x18afe80] stream:0 start_pts_time:0 pts:0 pts_time:0 dts:0 dts_time:0 -> pts:0 pts_time:0 dts:0 dts_time:0
[matroska @ 0x1e6b520] Writing block at offset 813, size 1515, pts 0, dts 0, duration 33, keyframe 1
*** Error in `ffmpeg': double free or corruption (fasttop): 0x0000000001954ea0 ***
Aborted (core dumped)

For example if I remove the segments stuff, it works correctly:

ffmpeg -use_wallclock_as_timestamps 1 -an -rtsp_transport tcp -i rtsp://127.0.0.1:10105/proxyStream -dn -map 0 -pix_fmt yuv420p -codec:v libx264 -preset ultrafast -crf 30.0 -y asd.mkv
ffmpeg version git-2015-08-14-a604289 Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.9.2 (Ubuntu 4.9.2-10ubuntu13)
  configuration: --enable-libx264 --enable-libfdk_aac --enable-gpl --enable-nonfree --enable-shared --enable-pic
  libavutil      54. 30.100 / 54. 30.100
  libavcodec     56. 57.100 / 56. 57.100
  libavformat    56. 40.101 / 56. 40.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 33.100 /  5. 33.100
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.101 /  1.  2.101
  libpostproc    53.  3.100 / 53.  3.100
[mpeg4 @ 0x20bf3e0] warning: first frame is no keyframe
Input #0, rtsp, from 'rtsp://127.0.0.1:10105/proxyStream':
  Metadata:
    title           : LIVE555 Streaming Media v2015.08.07
    comment         : LIVE555 Streaming Media v2015.08.07
  Duration: N/A, start: 1440150366.212056, bitrate: N/A
    Stream #0:0: Video: mpeg4 (Simple Profile), yuv420p, 640x480 [SAR 10:11 DAR 40:33], 30 fps, 30 tbr, 90k tbn, 30 tbc
[libx264 @ 0x2184040] using SAR=10/11
[libx264 @ 0x2184040] using cpu capabilities: MMX2 SSE2Fast SSSE3 Cache64 SlowShuffle
[libx264 @ 0x2184040] profile Constrained Baseline, level 3.0
[libx264 @ 0x2184040] 264 - core 148 r2 73ae2d1 - H.264/MPEG-4 AVC codec - Copyleft 2003-2015 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=25 scenecut=0 intra_refresh=0 rc=crf mbtree=0 crf=30.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=0
Output #0, matroska, to 'asd.mkv':
  Metadata:
    title           : LIVE555 Streaming Media v2015.08.07
    comment         : LIVE555 Streaming Media v2015.08.07
    encoder         : Lavf56.40.101
    Stream #0:0: Video: h264 (libx264) (H264 / 0x34363248), yuv420p, 640x480 [SAR 10:11 DAR 40:33], q=-1--1, 30 fps, 1k tbn, 30 tbc
    Metadata:
      encoder         : Lavc56.57.100 libx264
Stream mapping:
  Stream #0:0 -> #0:0 (mpeg4 (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[mpeg4 @ 0x2693940] warning: first frame is no keyframe
Past duration 0.926323 too large
frame=   49 fps= 23 q=-1.0 Lsize=     208kB time=00:00:02.00 bitrate= 850.0kbits/s dup=0 drop=1    
video:206kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.561731%
[libx264 @ 0x2184040] frame I:1     Avg QP:27.00  size:  4042
[libx264 @ 0x2184040] frame P:48    Avg QP:26.83  size:  4306
[libx264 @ 0x2184040] mb I  I16..4: 100.0%  0.0%  0.0%
[libx264 @ 0x2184040] mb P  I16..4:  2.7%  0.0%  0.0%  P16..4: 39.4%  0.0%  0.0%  0.0%  0.0%    skip:57.8%
[libx264 @ 0x2184040] coded y,uvDC,uvAC intra: 52.6% 22.7% 7.1% inter: 16.5% 6.1% 1.3%
[libx264 @ 0x2184040] i16 v,h,dc,p: 54% 18% 20%  7%
[libx264 @ 0x2184040] i8c dc,h,v,p: 74% 13% 11%  2%
[libx264 @ 0x2184040] kb/s:842.86
Exiting normally, received signal 2.

Change History (1)

comment:1 by Carl Eugen Hoyos, 9 years ago

Priority: importantnormal
Resolution: duplicate
Status: newclosed

Please remember to always test current FFmpeg git head before reporting a problem and please tell us if https://ffmpeg.org/bugreports.html is unclear!

Duplicate of ticket #4777.

Note: See TracTickets for help on using tickets.