[FFmpeg-devel] ffmpeg crash with out of memory error (perspective filter?)

Joshua Grauman jnfo-c at grauman.com
Tue Jun 14 23:27:06 CEST 2011


I want, but don't know enough ;) Maybe you can help me. I ran valgrind on 
the following command:

valgrind --tool=memcheck --leak-check=full --track-origins=yes 
/usr/local/ffmpeg/ffmpeg_g -i Hebrew1/Hebrew1/00000.MTS -t 1 -vf 
mp=perspective=`qts2 getCrop.cpp -.8`:0 -aspect 4:3 -r 30 -b 2000k -ab 
256k hebrew12b.mp4

Here is the output. I should note that I didn't see all the memory leaks 
listed when I ran the same command without the -vf=mp=perspective stuff...

Any help would be appreciated!

Josh

==2838==
==2838== HEAP SUMMARY:
==2838==     in use at exit: 80,110,920 bytes in 117 blocks
==2838==   total heap usage: 2,072 allocs, 1,955 frees, 161,701,859 bytes allocated
==2838==
==2838== 64 bytes in 1 blocks are definitely lost in loss record 2 of 13
==2838==    at 0x4C26676: memalign (vg_replace_malloc.c:581)
==2838==    by 0x4C266CF: posix_memalign (vg_replace_malloc.c:709)
==2838==    by 0xA46691: av_mallocz (mem.c:90)
==2838==    by 0x52838E: avformat_alloc_output_context2 (utils.c:2774)
==2838==    by 0x43C457: opt_output_file (ffmpeg.c:3876)
==2838==    by 0x43F852: parse_options (cmdutils.c:286)
==2838==    by 0x43B16D: main (ffmpeg.c:4532)
==2838==
==2838== 4,176 bytes in 1 blocks are definitely lost in loss record 6 of 13
==2838==    at 0x4C274A8: malloc (vg_replace_malloc.c:236)
==2838==    by 0x47E685: vf_open (vf_perspective.c:315)
==2838==    by 0x4056D7: init (vf_mp.c:776)
==2838==    by 0x4485A4: avfilter_graph_parse (graphparser.c:130)
==2838==    by 0x439C58: T.688 (ffmpeg.c:421)
==2838==    by 0x43B1C4: main (ffmpeg.c:4552)
==2838==
==2838== 2,333,136 (152 direct, 2,332,984 indirect) bytes in 1 blocks are definitely lost in loss record 8 of 13
==2838==    at 0x4C26676: memalign (vg_replace_malloc.c:581)
==2838==    by 0x4C266CF: posix_memalign (vg_replace_malloc.c:709)
==2838==    by 0xA46604: av_malloc (mem.c:90)
==2838==    by 0x444727: avfilter_ref_buffer (avfilter.c:49)
==2838==    by 0x455192: request_frame (vsrc_buffer.c:195)
==2838==    by 0x445278: avfilter_request_frame (avfilter.c:471)
==2838==    by 0x44D8E1: request_frame (vf_mp.c:840)
==2838==    by 0x445278: avfilter_request_frame (avfilter.c:471)
==2838==    by 0x43D796: get_filtered_video_frame (cmdutils.c:930)
==2838==    by 0x437152: output_packet (ffmpeg.c:1711)
==2838==    by 0x43A9F5: T.688 (ffmpeg.c:2762)
==2838==    by 0x43B1C4: main (ffmpeg.c:4552)
==2838==
==2838== 2,337,272 (152 direct, 2,337,120 indirect) bytes in 1 blocks are definitely lost in loss record 10 of 13
==2838==    at 0x4C274A8: malloc (vg_replace_malloc.c:236)
==2838==    by 0x4581FB: new_mp_image (mp_image.c:182)
==2838==    by 0x44E64F: vf_get_image (vf_mp.c:498)
==2838==    by 0x47EA81: put_image (vf_perspective.c:265)
==2838==    by 0x44DB13: end_frame (vf_mp.c:880)
==2838==    by 0x44665E: avfilter_end_frame (avfilter.c:534)
==2838==    by 0x4551B7: request_frame (vsrc_buffer.c:197)
==2838==    by 0x445278: avfilter_request_frame (avfilter.c:471)
==2838==    by 0x44D8E1: request_frame (vf_mp.c:840)
==2838==    by 0x445278: avfilter_request_frame (avfilter.c:471)
==2838==    by 0x43D796: get_filtered_video_frame (cmdutils.c:930)
==2838==    by 0x437152: output_packet (ffmpeg.c:1711)
==2838==
==2838== 12,441,600 bytes in 1 blocks are possibly lost in loss record 11 of 13
==2838==    at 0x4C26676: memalign (vg_replace_malloc.c:581)
==2838==    by 0x4C266CF: posix_memalign (vg_replace_malloc.c:709)
==2838==    by 0xA46604: av_malloc (mem.c:90)
==2838==    by 0x47EC87: config (vf_perspective.c:111)
==2838==    by 0x44D9BE: config_inprops (vf_mp.c:816)
==2838==    by 0x444FB7: avfilter_config_links (avfilter.c:267)
==2838==    by 0x444EFF: avfilter_config_links (avfilter.c:244)
==2838==    by 0x4471AC: avfilter_graph_config (avfiltergraph.c:119)
==2838==    by 0x439C7C: T.688 (ffmpeg.c:429)
==2838==    by 0x43B1C4: main (ffmpeg.c:4552)
==2838==
==2838== 62,994,672 (4,104 direct, 62,990,568 indirect) bytes in 27 blocks are definitely lost in loss record 13 of 13
==2838==    at 0x4C26676: memalign (vg_replace_malloc.c:581)
==2838==    by 0x4C266CF: posix_memalign (vg_replace_malloc.c:709)
==2838==    by 0xA46604: av_malloc (mem.c:90)
==2838==    by 0x444727: avfilter_ref_buffer (avfilter.c:49)
==2838==    by 0x455192: request_frame (vsrc_buffer.c:195)
==2838==    by 0x445278: avfilter_request_frame (avfilter.c:471)
==2838==    by 0x44D8E1: request_frame (vf_mp.c:840)
==2838==    by 0x445278: avfilter_request_frame (avfilter.c:471)
==2838==    by 0x43D796: get_filtered_video_frame (cmdutils.c:930)
==2838==    by 0x437152: output_packet (ffmpeg.c:1711)
==2838==    by 0x43A6AE: T.688 (ffmpeg.c:2740)
==2838==    by 0x43B1C4: main (ffmpeg.c:4552)
==2838==
==2838== LEAK SUMMARY:
==2838==    definitely lost: 8,648 bytes in 31 blocks
==2838==    indirectly lost: 67,660,672 bytes in 85 blocks
==2838==      possibly lost: 12,441,600 bytes in 1 blocks
==2838==    still reachable: 0 bytes in 0 blocks
==2838==         suppressed: 0 bytes in 0 blocks
==2838==
==2838== For counts of detected and suppressed errors, rerun with: -v
==2838== ERROR SUMMARY: 466785 errors from 86 contexts (suppressed: 4 from 4)

> On Mon, Jun 13, 2011 at 10:00:29PM -0700, Joshua Grauman wrote:
>> Hello all,
>>
>> Unless I'm missing something, I think I must have found a memory leak in
>> ffmpeg (probably the perspective filter?). The following command runs
>> fine (ie. produces good output), but if I run it for too long (~6000+
>> frames), eventually the frame rate starts to drop and finally the process
>> gets killed with an out of memory error. Anyone want to help me debug it?
>
> i want but iam too busy :(
>
> valgrind should be able to pinpoint the leak
>
> [...]
>


More information about the ffmpeg-devel mailing list