[FFmpeg-trac] #5799(undetermined:new): Memory psudo-leak when FF_API_CODED_FRAME enabled

FFmpeg trac at avcodec.org
Fri Aug 26 17:44:26 EEST 2016


#5799: Memory psudo-leak when FF_API_CODED_FRAME enabled
-------------------------------------+-------------------------------------
             Reporter:  DeHackEd     |                    Owner:
                 Type:  defect       |                   Status:  new
             Priority:  normal       |                Component:
              Version:  git-master   |  undetermined
             Keywords:               |               Resolution:
             Blocking:               |               Blocked By:
Analyzed by developer:  0            |  Reproduced by developer:  0
-------------------------------------+-------------------------------------

Comment (by DeHackEd):

 Very well. I also simplified the command-line a bit. I resize the video so
 that the encoding process will go faster.

 {{{
 $ cat w*.ts | ffmpeg-stock -f mpegts -i - -c:v mpeg2video -s 320x240 -b 5M
 -map 0:v -f mpegts -y /dev/null
 ffmpeg version N-81456-g5006627 Copyright (c) 2000-2016 the FFmpeg
 developers
   built with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-17)
   configuration: --disable-filters --enable-
 filter='acrossfade,adelay,adrawgraph,aecho,aevalsrc,aeval,afade,aformat,aloop,anull,amerge,amix,anull,anullsrc,anullsink,aresample,asetps,asetrate,asplit,blackdetect,blend,channelmap,channelsplit,chorus,extrastereo,concat,crop,cropdetect,delogo,deshake,detelecine,drawbox,drawtext,fade,field,format,framestep,framepack,interlace,interleve,null,nullsink,nullsrc,overlay,pan,pp,pullup,psnr,setfield,setpts,scale,settb,split,spp,telecine,volume,volumedetect,yadif'
 --disable-demuxers --enable-
 demuxer='aac,ac3,asf,avi,concat,dts,dv*,eac3,flv,g*,h264,hevc,hls,image2,m4v,matroska,mjpeg,mov,mp3,mpegps,mpets,mpegtsraw,mpegvideo,ogg,pcm*,rawvideo,rtsp,wav,webm*'
 --disable-muxers --enable-
 muxer='ac3,apng,af2,avi,dash,dv,eac3,flv,h264hevc,hls,mat*,mjpeg,md5,mov,mp3,mp4,mpeg*,ogg,opus,pcm*,rawvideo,wav,webm*'
 --disable-encoders --enable-
 encoder='mpeg2video,mpeg1video,ac3*,adpcm*,pcm*,aac,mjpeg,libfdk_aac,libx26*'
 --disable-decoders --enable-
 decoder='aac,aac_fixed,ac3,ac3_fixed,adpcm*,bmp,dvaudio,dvsub,eac3*,gif,gsm,flv,ffv*,hevc,h26*,mjpeg,mp*,opus,pcm*,png,ppm,snow,theora,text,vc1,vp8,vp9,wmc*'
 --enable-libx264 --extra-cflags='-gdwarf-2 -I/home/sean/src/GIT/x264
 -march=core2' --extra-ldflags='-L/home/sean/src/GIT/x264 -lstdc++'
 --enable-gpl --extra-ldflags=-ldl --enable-libfdk-aac --enable-nonfree
 --disable-vdpau --disable-outdevs --disable-hwaccels --disable-indevs
 --disable-lzma --disable-bzlib --disable-zlib --disable-libx265
   libavutil      55. 29.100 / 55. 29.100
   libavcodec     57. 54.100 / 57. 54.100
   libavformat    57. 48.100 / 57. 48.100
   libavdevice    57.  0.102 / 57.  0.102
   libavfilter     6. 55.100 /  6. 55.100
   libswscale      4.  1.100 /  4.  1.100
   libswresample   2.  1.100 /  2.  1.100
   libpostproc    54.  0.100 / 54.  0.100
 [h264 @ 0x1a58ee0] SPS unavailable in decode_picture_timing
 [h264 @ 0x1a58ee0] non-existing PPS 0 referenced
 [h264 @ 0x1a58ee0] SPS unavailable in decode_picture_timing
 [h264 @ 0x1a58ee0] non-existing PPS 0 referenced
 [h264 @ 0x1a58ee0] decode_slice_header error
 [h264 @ 0x1a58ee0] no frame!
 [h264 @ 0x1a58ee0] SPS unavailable in decode_picture_timing
 [h264 @ 0x1a58ee0] non-existing PPS 0 referenced
 [h264 @ 0x1a58ee0] SPS unavailable in decode_picture_timing
 [h264 @ 0x1a58ee0] non-existing PPS 0 referenced
 [h264 @ 0x1a58ee0] decode_slice_header error
 [h264 @ 0x1a58ee0] no frame!
 [h264 @ 0x1a58ee0] SPS unavailable in decode_picture_timing
 [h264 @ 0x1a58ee0] non-existing PPS 0 referenced
 [h264 @ 0x1a58ee0] SPS unavailable in decode_picture_timing
 [h264 @ 0x1a58ee0] non-existing PPS 0 referenced
 [h264 @ 0x1a58ee0] decode_slice_header error
 [h264 @ 0x1a58ee0] no frame!
 [h264 @ 0x1a58ee0] SPS unavailable in decode_picture_timing
 [h264 @ 0x1a58ee0] non-existing PPS 0 referenced
 [h264 @ 0x1a58ee0] SPS unavailable in decode_picture_timing
 [h264 @ 0x1a58ee0] non-existing PPS 0 referenced
 [h264 @ 0x1a58ee0] decode_slice_header error
 [h264 @ 0x1a58ee0] no frame!
 [h264 @ 0x1a58ee0] SPS unavailable in decode_picture_timing
 [h264 @ 0x1a58ee0] non-existing PPS 0 referenced
 [h264 @ 0x1a58ee0] SPS unavailable in decode_picture_timing
 [h264 @ 0x1a58ee0] non-existing PPS 0 referenced
 [h264 @ 0x1a58ee0] decode_slice_header error
 [h264 @ 0x1a58ee0] no frame!
 [h264 @ 0x1a58ee0] SPS unavailable in decode_picture_timing
 [h264 @ 0x1a58ee0] non-existing PPS 0 referenced
 [h264 @ 0x1a58ee0] SPS unavailable in decode_picture_timing
 [h264 @ 0x1a58ee0] non-existing PPS 0 referenced
 [h264 @ 0x1a58ee0] decode_slice_header error
 [h264 @ 0x1a58ee0] no frame!
 [h264 @ 0x1a58ee0] SPS unavailable in decode_picture_timing
 [h264 @ 0x1a58ee0] non-existing PPS 0 referenced
 [h264 @ 0x1a58ee0] SPS unavailable in decode_picture_timing
 [h264 @ 0x1a58ee0] non-existing PPS 0 referenced
 [h264 @ 0x1a58ee0] decode_slice_header error
 [h264 @ 0x1a58ee0] no frame!
 [h264 @ 0x1a58ee0] SPS unavailable in decode_picture_timing
 [h264 @ 0x1a58ee0] non-existing PPS 0 referenced
 [h264 @ 0x1a58ee0] SPS unavailable in decode_picture_timing
 [h264 @ 0x1a58ee0] non-existing PPS 0 referenced
 [h264 @ 0x1a58ee0] decode_slice_header error
 [h264 @ 0x1a58ee0] no frame!
 [h264 @ 0x1a58ee0] SPS unavailable in decode_picture_timing
 [h264 @ 0x1a58ee0] non-existing PPS 0 referenced
 [h264 @ 0x1a58ee0] SPS unavailable in decode_picture_timing
 [h264 @ 0x1a58ee0] non-existing PPS 0 referenced
 [h264 @ 0x1a58ee0] decode_slice_header error
 [h264 @ 0x1a58ee0] no frame!
 [h264 @ 0x1a58ee0] SPS unavailable in decode_picture_timing
 [h264 @ 0x1a58ee0] non-existing PPS 0 referenced
 [h264 @ 0x1a58ee0] SPS unavailable in decode_picture_timing
 [h264 @ 0x1a58ee0] non-existing PPS 0 referenced
 [h264 @ 0x1a58ee0] decode_slice_header error
 [h264 @ 0x1a58ee0] no frame!
 [h264 @ 0x1a58ee0] SPS unavailable in decode_picture_timing
 [h264 @ 0x1a58ee0] non-existing PPS 0 referenced
 [h264 @ 0x1a58ee0] SPS unavailable in decode_picture_timing
 [h264 @ 0x1a58ee0] non-existing PPS 0 referenced
 [h264 @ 0x1a58ee0] decode_slice_header error
 [h264 @ 0x1a58ee0] no frame!
 [h264 @ 0x1a58ee0] SPS unavailable in decode_picture_timing
 [h264 @ 0x1a58ee0] non-existing PPS 0 referenced
 [h264 @ 0x1a58ee0] SPS unavailable in decode_picture_timing
 [h264 @ 0x1a58ee0] non-existing PPS 0 referenced
 [h264 @ 0x1a58ee0] decode_slice_header error
 [h264 @ 0x1a58ee0] no frame!
 [h264 @ 0x1a58ee0] SPS unavailable in decode_picture_timing
 [h264 @ 0x1a58ee0] non-existing PPS 0 referenced
 [h264 @ 0x1a58ee0] SPS unavailable in decode_picture_timing
 [h264 @ 0x1a58ee0] non-existing PPS 0 referenced
 [h264 @ 0x1a58ee0] decode_slice_header error
 [h264 @ 0x1a58ee0] no frame!
 Input #0, mpegts, from 'pipe:':
   Duration: N/A, start: 16129.943311, bitrate: N/A
   Program 1
     Stream #0:0[0x1e1]: Video: h264 (High) ([27][0][0][0] / 0x001B),
 yuv420p(tv), 1280x720 [SAR 1:1 DAR 16:9], Closed Captions, 59.94 fps,
 59.94 tbr, 90k tbn, 119.88 tbc
     Stream #0:1[0x1e2](eng): Audio: aac (LC) ([15][0][0][0] / 0x000F),
 48000 Hz, stereo, fltp, 320 kb/s
     Stream #0:2[0x1e4](enm): Audio: aac (LC) ([15][0][0][0] / 0x000F),
 48000 Hz, stereo, fltp, 64 kb/s (visual impaired)
 Please use -b:a or -b:v, -b is ambiguous
 [mpeg2video @ 0x1aad5c0] too many threads/slices (16), reducing to 15
 [mpegts @ 0x1abdc00] Using AVStream.codec to pass codec parameters to
 muxers is deprecated, use AVStream.codecpar instead.
 Output #0, mpegts, to '/dev/null':
   Metadata:
     encoder         : Lavf57.48.100
     Stream #0:0: Video: mpeg2video (Main), yuv420p, 320x240 [SAR 4:3 DAR
 16:9], q=2-31, 5000 kb/s, 59.94 fps, 90k tbn, 59.94 tbc
     Metadata:
       encoder         : Lavc57.54.100 mpeg2video
     Side data:
       cpb: bitrate max/min/avg: 0/0/5000000 buffer size: 0 vbv_delay: -1
 Stream mapping:
   Stream #0:0 -> #0:0 (h264 (native) -> mpeg2video (native))
 [h264 @ 0x1ac57e0] co located POCs unavailable
 ^Cframe=145785 fps=349 q=2.0 Lsize= 1140321kB time=00:40:32.41
 bitrate=3840.4kbits/s speed=5.82x
 video:1039833kB audio:0kB subtitle:0kB other streams:0kB global
 headers:0kB muxing overhead: 9.663832%
 Exiting normally, received signal 2.
 }}}

 Memory usage near the start:
 {{{
 $ grep VmRSS /proc/61027/status
 VmRSS:    137252 kB
 }}}
 20 minute mark:
 {{{
 $ grep VmRSS /proc/61027/status
 VmRSS:    170440 kB
 }}}
 40 minute mark:
 {{{
 $ grep VmRSS /proc/61027/status
 VmRSS:    201296 kB
 }}}

 Times are approximate.

 I discussed this briefly in #ffmpeg-devel with Btbn. It looks like a huge
 chain of side data are being added to the coded_frame field and not being
 cleaned up as it goes, at least until shutdown.

--
Ticket URL: <https://trac.ffmpeg.org/ticket/5799#comment:2>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list