<div dir="ltr">Could you, please, provide me any information about codec configuration? Is there any site, doc, anything?</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Em qua., 22 de mar. de 2023 às 10:09, mr N <<a href="mailto:mohamednmn28105@gmail.com">mohamednmn28105@gmail.com</a>> escreveu:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">
There is no one-size-fits-all solution to your issue of 
high memory usage during video decoding. The cause could be a 
combination of factors, including hardware limitations, software 
optimizations, codec configuration, and external factors. It is best to 
approach this issue systematically, analyzing each potential cause and 
optimizing your code accordingly.

</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Mar 22, 2023 at 1:43 PM Edimar Rangel <<a href="mailto:edimar.rangel@gmail.com" target="_blank">edimar.rangel@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi<div><br></div><div>I'm facing a high memory usage consumption on video decoding, seems to be some memory leak, but I did not manage to find it.</div><div><br></div><div>Processor:11th Gen Intel(R) Core(TM) i5-11400H @ 2.70GHz   2.69 GHz, 6 cores, 12 threads</div><div>GPU: NVIDIA GeForce RTX 3050 Laptop GPU, 4gb GDDR6 6001.0 MHz</div><div>OS: </div><div><br></div><div>I've tried with CUDA, D3D11VA and DXVA2, until now DXVA2 presents the best results.</div><div><br></div><div>These are the steps:</div><div><br></div><div><ol><li>Initialize TAVHWDeviceType by av_hwdevice_find_type_by_name('dxva2')</li><li>Initialize PAVCodec by avcodec_find_decoder(), it's TAVCodecId parameter can assume one of these values 

[Mpeg4, H264, HEVC, MJPEG]</li><li>Initialize PAVCodecHWConfig by:<br>while True do<br>begin<br>  vHWConfig := avcodec_get_hw_config(fCodec, vCount);<br><br>  Inc(vCount);<br><br>  if not Assigned(vHWConfig) then<br>    Break;<br><br>  if ((vHWConfig.methods and AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX) <> 0) and (vHWConfig.device_type = vType) then<br>    fHWPixelFormat := vHWConfig.pix_fmt;<br>end;<br></li><li>Use av_hwdevice_ctx_create to set in PAVCodecContext.hw_device_ctx variable</li><li>When decoding I'm using avcodec_send_packet and avcodec_receive_frame functions</li><li>Using av_hwframe_transfer_data to copy from GPU memory to CPU memory</li><li>Finally I'm using sws_getContext and sw_scale to convert the image</li><li>After decoding these variables are been cleaned:<br>av_frame_free(@vSWFrame);<br>av_buffer_unref(@vBuffer);<br>av_freep(@vBuffer);<br>av_packet_unref(@vPacket);<br>av_packet_free(@vPacket);<br></li></ol><div><br></div><div>I'm using Delphi 10.3 and FastMM4  doesn't report any memory leak, but all the RAM available it's being used.</div></div><div><br></div><div>Is there any known issue that can be causing this?</div></div>
_______________________________________________<br>
Libav-user mailing list<br>
<a href="mailto:Libav-user@ffmpeg.org" target="_blank">Libav-user@ffmpeg.org</a><br>
<a href="https://ffmpeg.org/mailman/listinfo/libav-user" rel="noreferrer" target="_blank">https://ffmpeg.org/mailman/listinfo/libav-user</a><br>
<br>
To unsubscribe, visit link above, or email<br>
<a href="mailto:libav-user-request@ffmpeg.org" target="_blank">libav-user-request@ffmpeg.org</a> with subject "unsubscribe".<br>
</blockquote></div>
_______________________________________________<br>
Libav-user mailing list<br>
<a href="mailto:Libav-user@ffmpeg.org" target="_blank">Libav-user@ffmpeg.org</a><br>
<a href="https://ffmpeg.org/mailman/listinfo/libav-user" rel="noreferrer" target="_blank">https://ffmpeg.org/mailman/listinfo/libav-user</a><br>
<br>
To unsubscribe, visit link above, or email<br>
<a href="mailto:libav-user-request@ffmpeg.org" target="_blank">libav-user-request@ffmpeg.org</a> with subject "unsubscribe".<br>
</blockquote></div>