[FFmpeg-devel] [PATCH] avfillter/buffersrc: activate and EOF fix

Paul B Mahol onemda at gmail.com
Thu Nov 2 11:56:00 EET 2023


On Wed, Nov 1, 2023 at 3:13 PM Nicolas George <george at nsup.org> wrote:

> Paul B Mahol (12023-11-01):
> > It fixes it for me, ffmpeg no longer keeps sending frames to EOF
> > filtergraph.
> > And no more memory is allocated and never freed.
>
> And that is just LUCK because you changed unrelated things. You have to
> provide a PROOF, starting with what was wrong in the original code.
>
> > I ask you, kindly, once more time, to provide way how to trigger memory
> > boom (OOM) with those patches applied.
>
> I just ran the test case you gave in my usual testing environment. There
> is nothing I can tell you more, I can just copy-paste the result.
>
> Anyway, in the process of analyzing the bug and writing the proof for
> your fix, you should be able to find out why it is still happening ins
> subtly different circumstances.
>
>
> ffmpeg version N-112636-g53f9d14063 Copyright (c) 2000-2023 the FFmpeg
> developers
>   built with gcc 13 (Debian 13.2.0-5)
>   configuration: --enable-shared --disable-static --enable-gpl
> --enable-libx264 --enable-libopus --enable-libass --enable-libfreetype
> --enable-opengl --assert-level=2
>   libavutil      58. 31.100 / 58. 31.100
>   libavcodec     60. 32.102 / 60. 32.102
>   libavformat    60. 17.100 / 60. 17.100
>   libavdevice    60.  4.100 / 60.  4.100
>   libavfilter     9. 13.100 /  9. 13.100
>   libswscale      7.  6.100 /  7.  6.100
>   libswresample   4. 13.100 /  4. 13.100
>   libpostproc    57.  4.100 / 57.  4.100
> [Parsed_scale_2 @ 0x557c9a7e6fc0] w:720 h:-2 flags:'' interl:0
> [Parsed_hqdn3d_4 @ 0x557c9a7f4640] ls:4.000000 cs:3.000000 lt:6.000000
> ct:4.500000
> [h264 @ 0x557c9a7e7e40] Reinit context to 640x480, pix_fmt: yuv420p
> Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '../test_clip.mp4':
>   Metadata:
>     major_brand     : isom
>     minor_version   : 512
>     compatible_brands: isomiso2avc1mp41
>     encoder         : Lavf60.17.100
>   Duration: 00:07:50.00, start: 0.000000, bitrate: 1594 kb/s
>   Stream #0:0[0x1](und): Video: h264 (High), 1 reference frame (avc1 /
> 0x31637661), yuv420p(progressive, left), 640x480 [SAR 1:1 DAR 4:3], 1592
> kb/s, 25 fps, 25 tbr, 12800 tbn (default)
>     Metadata:
>       handler_name    : VideoHandler
>       vendor_id       : [0][0][0][0]
>       encoder         : Lavc60.32.102 libx264
> [out#0/mp4 @ 0x557c9b07e000] Adding streams from explicit maps...
> [vost#0:0/copy @ 0x557c9b07f080] Created video stream from input stream 0:0
> Output #0, mp4, to '../test_clip.mp4_copy.mp4':
>   Metadata:
>     major_brand     : isom
>     minor_version   : 512
>     compatible_brands: isomiso2avc1mp41
>     encoder         : Lavf60.17.100
>   Stream #0:0(und): Video: h264 (High), 1 reference frame (avc1 /
> 0x31637661), yuv420p(progressive, left), 640x480 (0x0) [SAR 1:1 DAR 4:3],
> q=2-31, 1592 kb/s, 25 fps, 25 tbr, 12800 tbn (default)
>     Metadata:
>       handler_name    : VideoHandler
>       vendor_id       : [0][0][0][0]
>       encoder         : Lavc60.32.102 libx264
> [out#1/image2 @ 0x557c9b0c1640] Adding streams from explicit maps...
> [out#1/image2 @ 0x557c9b0c1640] Creating output stream from an explicitly
> mapped complex filtergraph 0, output [thumb_out]
> [vost#1:0/mjpeg @ 0x557c9b0c44c0] Created video stream from complex
> filtergraph 0:[unsharp:default]
> [vost#1:0/mjpeg @ 0x557c9b0c44c0]
> Stream mapping:
>   Stream #0:0 (h264) -> split:default
>   Stream #0:0 -> #0:0 (copy)
>   unsharp:default -> Stream #1:0 (mjpeg)
> Press [q] to stop, [?] for help
> [h264 @ 0x557c9a8099c0] Reinit context to 640x480, pix_fmt: yuv420p
> [Parsed_scale_2 @ 0x557c9a80fa80] w:720 h:-2 flags:'' interl:0
> [Parsed_hqdn3d_4 @ 0x557c9a7e4180] ls:4.000000 cs:3.000000 lt:6.000000
> ct:4.500000
> [graph 0 input from stream 0:0 @ 0x557c9b0d9dc0] w:640 h:480
> pixfmt:yuv420p tb:1/12800 fr:25/1 sar:1/1
> [swscaler @ 0x557c9b0ddb00] deprecated pixel format used, make sure you
> did set range correctly
> [Parsed_scale_2 @ 0x557c9a80fa80] w:640 h:480 fmt:yuv420p sar:1/1 -> w:720
> h:540 fmt:yuvj420p sar:1/1 flags:0x00000004
> [Parsed_setsar_3 @ 0x557c9a80dcc0] w:720 h:540 sar:1/1 dar:4/3 -> sar:1/1
> dar:4/3
> [Parsed_unsharp_5 @ 0x557c9a80fdc0] effect:sharpen type:luma msize_x:5
> msize_y:5 amount:1.00
> [Parsed_unsharp_5 @ 0x557c9a80fdc0] effect:none type:chroma msize_x:5
> msize_y:5 amount:0.00
> [vost#1:0/mjpeg @ 0x557c9b0c44c0] *** 10500 dup!
> [vost#1:0/mjpeg @ 0x557c9b0c44c0] More than 1000 frames duplicated
> Output #1, image2, to 'test_clip.mp4_img2.jpg':
>   Metadata:
>     major_brand     : isom
>     minor_version   : 512
>     compatible_brands: isomiso2avc1mp41
>     encoder         : Lavf60.17.100
>   Stream #1:0: Video: mjpeg, 1 reference frame, yuvj420p(pc, progressive,
> left), 720x540 (0x0) [SAR 1:1 DAR 4:3], q=2-31, 200 kb/s, 25 fps, 25 tbn
>     Metadata:
>       encoder         : Lavc60.32.102 mjpeg
>     Side data:
>       cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: N/A
> Error while filtering: Resource temporarily unavailable
> [vist#0:0/h264 @ 0x557c9a833f00] Decoder thread received EOF packet
> [vist#0:0/h264 @ 0x557c9a833f00] Decoder returned EOF, finishing
> [vist#0:0/h264 @ 0x557c9a833f00] Terminating decoder thread
> [out#0/mp4 @ 0x557c9b07e000] All streams finished
> [out#0/mp4 @ 0x557c9b07e000] Terminating muxer thread
> [AVIOContext @ 0x557c9b0c0000] Statistics: 83790919 bytes written, 2
> seeks, 323 writeouts
> [out#0/mp4 @ 0x557c9b07e000] Output file #0 (../test_clip.mp4_copy.mp4):
> [out#0/mp4 @ 0x557c9b07e000]   Output stream #0:0 (video): 10511 packets
> muxed (83686326 bytes);
> [out#0/mp4 @ 0x557c9b07e000]   Total: 10511 packets (83686326 bytes) muxed
> [out#0/mp4 @ 0x557c9b07e000] video:81725kB audio:0kB subtitle:0kB other
> streams:0kB global headers:0kB muxing overhead: 0.124977%
> [out#1/image2 @ 0x557c9b0c1640] Nothing was written into output file,
> because at least one of its streams received no packets.
> frame=    0 fps=0.0 q=0.0 Lsize=   81827kB time=00:07:00.32
> bitrate=1594.8kbits/s dup=10500 drop=0 speed= 142x
> [in#0/mov,mp4,m4a,3gp,3g2,mj2 @ 0x557c9a7e72c0] Terminating demuxer thread
> [in#0/mov,mp4,m4a,3gp,3g2,mj2 @ 0x557c9a7e72c0] Input file #0
> (../test_clip.mp4):
> [in#0/mov,mp4,m4a,3gp,3g2,mj2 @ 0x557c9a7e72c0]   Input stream #0:0
> (video): 10513 packets read (83701450 bytes); 10511 frames decoded; 0
> decode errors;
> [in#0/mov,mp4,m4a,3gp,3g2,mj2 @ 0x557c9a7e72c0]   Total: 10513 packets
> (83701450 bytes) demuxed
> [AVIOContext @ 0x557c9a7e5d40] Statistics: 83871773 bytes read, 2 seeks
> Conversion failed!
>

You applied both patches? At correct order?
I probably should merge patches into single one.


>
> --
>   Nicolas George
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
>


More information about the ffmpeg-devel mailing list