970530 - 如何在ffmpeg中通过GPU解码 [英] 970530 - how to decode by GPU in ffmpeg

查看:1244
本文介绍了970530 - 如何在ffmpeg中通过GPU解码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

平台:Windows

应用程序:WinForm应用程序

语言:C#

解码器:ffmpeg





我们正在使用ffmpeg来解码通过网络发送给我们的帧。该程序是用C#编写的,并使用FFmpegInvoke以及avcodec-56.dll和avutil-54.dll等所需的DLL来解码帧。为此,我们需要使用GPU而不是CPU。现在使用CPU并且解码完成没有任何问题。

我的问题是如何告诉ffmpeg使用GPU而不是CPU进行解码?

是否有任何示例代码为此目的?

谢谢



我尝试过:



我认为这个问题并没有发现任何线索。

platform: Windows
application: WinForm application
language: C#
decoder: ffmpeg

Hi
We're using ffmpeg to decode frames sent via network to us. The program is written in C# and uses FFmpegInvoke as well as the required DLL's like avcodec-56.dll and avutil-54.dll for decoding the frames. We need to use GPU instead of CPU for this purpose. Now CPU is used and decoding is done without any problem.
My question is that how can I tell ffmpeg use GPU instead of CPU for decoding?
Is there any sample code for this purpose?
Thanks

What I have tried:

I googlized this problem and found no clue.

推荐答案

首先阅读 HWAccelIntro - FFmpeg [ ^ ]。



用于API检查是否有合适的解码器可用并选择用于解码(要求已构建的库支持该解码器):

Start by reading HWAccelIntro – FFmpeg[^].

For usage with the API check if an appropriate decoder is available and select that for decoding (requires that the library has been built with support for that decoder):
// C/C++ example to use the DXVA2 decoder
AVCodec* decoder = avcodec_find_decoder_by_name ("h264_dxva2");
avcodec_open2 (decoder_ctx, decoder, NULL);


这篇关于970530 - 如何在ffmpeg中通过GPU解码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆