[Libav-user] Fwd: 971108 - ffmpeg doesn't use GPU

hamidi hamidi at gmail.com
Wed Feb 6 11:56:02 EET 2019


I could run hw_decode.c on Windows by changing the extension to cpp. I
commented some parts of decode_write function (from line 110 to 140)
because I just wanted to examine whether decoding is successful. After
that, instead of writing to a new file, I prefer to SHOW the decoded frame.
Since the decoded frame is in a hardware surface, which I prefer and it's
good that this is the case, I need a way to SHOW it, but I don't know how.
Maybe you sense that I'm not speaking correctly. It's because I'm still a
newbie. So please show me a way to show the decoded frame in this sample
code on screen *without requirement to move it to system memory*. For
example, please complete the sample code to do so.
Thanks

On Sat, Feb 2, 2019 at 8:18 AM hamidi <hamidi at gmail.com> wrote:

> Thanks JP May for replying. Your response seems too expert for me. I'm too
> newbie in FFMpeg and Libav materials. Although I'll try to find the
> meanings of your text, I've to get close to it step by step. Please accept
> me to ask more questions in each step.
> Thanks
>
> On Wed, Jan 30, 2019 at 7:22 PM JP May <jpm at smhk.com> wrote:
>
>> hamidi, there are definitely some problems getting it to use the hardware
>> decoder. For us we have such a problem on iOS builds.
>>
>> We have to use code something like this to be sure it finds a hardware
>> decoder ...
>>
>> #include <libavcodec/videotoolbox.h>
>> static enum AVPixelFormat find_pixel_format(struct AVCodecContext *s,
>> const enum AVPixelFormat *fmt) {
>>     while (*fmt != AV_PIX_FMT_NONE) {
>>         if (*fmt == AV_PIX_FMT_VIDEOTOOLBOX) {
>>             if (s->hwaccel_context == NULL) {
>>                 int result = av_videotoolbox_default_init(s);
>>                 if (result < 0) {
>>                 printf("       the 'SPS/PPS problem' has happened.\n");
>>                 printf("       you are NOT getting hardware decoding on
>> this stream.\n");
>>                     return s->pix_fmt;
>>                 }
>>                 else {
>>                 printf("       the test was OK....\n");
>>                 }
>>             }
>>             return *fmt;
>>         }
>>         ++fmt;
>>     }
>>     return s->pix_fmt;
>> }
>>
>>
>> the problem seems to relate to finding the SPS/PPS information on a
>> variety of sources
>> see,
>>
>> https://stackoverflow.com/q/25787347/294884
>>
>> a couple yrs ago there was a patch on the 264 problem (which I think was
>> not incorporated..)
>>
>> https://ffmpeg.org/pipermail/ffmpeg-devel/2016-June/194842.html
>>
>> we really have not been able to solve the issue in the 265 case.
>>
>> If this info is relevant to your case, I hope it helps …
>>
>>
>>
>> On Jan 30, 2019, at 7:58 AM, hamidi <hamidi at gmail.com> wrote:
>>
>> I got the latest version binaries of ffmpeg from here
>> <https://ffmpeg.zeranoe.com/builds/>. When I examine CPU and GPU usages
>> when I play a video by its ffplay, I see that GPU is used during play. Not
>> much using of CPU also indicates it. But when I get the latest version
>> sources from the original site, I can't use GPU. ….
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>> Libav-user mailing list
>> Libav-user at ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/libav-user
>>
>> To unsubscribe, visit link above, or email
>> libav-user-request at ffmpeg.org with subject "unsubscribe".
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20190206/887977f1/attachment.html>


More information about the Libav-user mailing list