<HTML><BODY>Thank you for your reply. I used AV_HWDEVICE_TYPE_CUDA for cuvid decoder. Is it correct?<br><br><br><blockquote style="border-left:1px solid #0857A6; margin:10px; padding:0 0 0 10px;">
Среда, 24 апреля 2019, 17:00 +03:00 от Philippe Gorley <philippe.gorley@savoirfairelinux.com>:<br>
<br>
<div id="">
<div class="js-helper js-readmsg-msg">
<style type="text/css"></style>
<div>
<div id="style_15561144440000000435_BODY">On 2019-04-24 7:34 a.m., Ахмед Анам via Libav-user wrote:<br>
> Hello.<br>
> <br>
> I studied */hw-decode.c/* example and in this example a decoder is <br>
> choosen based on an input video file (calling function <br>
> /*av_find_best_stream(input_ctx, AVMEDIA_TYPE_VIDEO, -1, -1, &decoder, <br>
> 0),* /where /*decoder */is a local variable of type /*AVCodec**/). <br>
> I try to decode H264 videostream using hw-acceleration. To find a proper <br>
> decoder I use /*avcodec_find_decoder(codec_id) *///function. Now for <br>
> decoding h264 stream I use /*AV_CODEC_ID_H264 */as the argument for this <br>
> function**/*. */Is it correct? I don't see the difference in CPU and <br>
> GPU utilization for hardware-accelerated decoding. Even for multiple <br>
> streams.<br>
AV_CODEC_ID_H264 is correct.<br>
<br>
To set up a hardware decoder, you need to set <br>
AVCodecContext.hw_device_ctx. In hw_decode.c, that happens in the <br>
hw_decoder_init function with av_hwdevice_ctx_create.<br>
<br>
FFmpeg takes care of setting up the per-frame hardware context as you <br>
decode.<br>
<br>
The choice of which hardware decoder is used is up to you <br>
(AVHWDeviceType enum: <br>
<a href="https://ffmpeg.org/doxygen/trunk/hwcontext_8h.html" target="_blank">https://ffmpeg.org/doxygen/trunk/hwcontext_8h.html</a>). In the example, <br>
av_hwdevice_find_type_by_name is called to get the type from the first <br>
command line argument.<br>
<br>
> -- <br>
> С уважением, Ахмед Анам.<br>
> Best regards, Akhmed Anam.<br>
> <br>
> _______________________________________________<br>
> Libav-user mailing list<br>
> <a href="mailto:Libav-user@ffmpeg.org">Libav-user@ffmpeg.org</a><br>
> <a href="https://ffmpeg.org/mailman/listinfo/libav-user" 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">libav-user-request@ffmpeg.org</a> with subject "unsubscribe".<br>
> <br>
<br>
-- <br>
Philippe Gorley<br>
Free Software Consultant | Montréal, Qc<br>
Savoir-faire Linux<br>
_______________________________________________<br>
Libav-user mailing list<br>
<a href="mailto:Libav-user@ffmpeg.org">Libav-user@ffmpeg.org</a><br>
<a href="https://ffmpeg.org/mailman/listinfo/libav-user" 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">libav-user-request@ffmpeg.org</a> with subject "unsubscribe".</div>
</div>
</div>
</div>
</blockquote>
<br>
<br>-- <br>С уважением, Ахмед Анам.<br>Best regards, Akhmed Anam.<br></BODY></HTML>