[FFmpeg-trac] #5224(avcodec:new): Excessive memory use in H.264 decoder with threading enabled

FFmpeg trac at avcodec.org
Tue Feb 9 18:04:03 CET 2016

#5224: Excessive memory use in H.264 decoder with threading enabled
             Reporter:  jkqxz        |                    Owner:
                 Type:  defect       |                   Status:  new
             Priority:  normal       |                Component:  avcodec
              Version:  unspecified  |               Resolution:
             Keywords:  h264         |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |

Comment (by heleppkes):

 Replying to [comment:3 cehoyos]:
 > Replying to [comment:2 kierank]:
 > > Replying to [comment:1 cehoyos]:
 > > > Replying to [ticket:5224 jkqxz]:
 > > > > Given a stream with gaps in frame_num, the threaded decoder may
 allocate many more frames than it should.  (Up to thread count *
 num_ref_frames whole frame buffers.)
 > > >
 > > > I believe you are simply describing how multi-threaded decoding
 works or what do I miss?
 > >
 > > He/she has exactly explained the problem, you clearly are missing
 > The OP is unhappy that FFmpeg is allocating 8*16 frames when decoding a
 H.264 video with 16 reference frames using eight threads. I suspect that
 this is how multithreaded H.264 decoding works: What do I miss?

 You miss that a "normal" file would not do this since the references are
 shared, and these 16 "dummy" frames per thread are never accessed and
 discarded again shortly after (although only after all threads already
 allocated them).

Ticket URL: <https://trac.ffmpeg.org/ticket/5224#comment:4>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker

More information about the FFmpeg-trac mailing list