[Libav-user] Encode with hardware example

Shu Wang halfelf.ronin at gmail.com
Fri Nov 3 06:21:51 EET 2017


For encoding, yes, I don't need to worry copying from host to device.
For decoding, part of. In official example, they use av_hwframe_transfer_data
to copy from device memory to host,  but nothing tricky. (in hw_decode.c
and qsvdec.c)

The problem I have is how to do this: decode in gpu -> do some process for
frames in gpu -> encode in gpu, only copy to device at start and copy from
in the end. There's no example to wrap raw device pointer to a hardware
av_frame.

On Fri, Nov 3, 2017 at 12:01 PM, From Seattle <fromseattle at gmail.com> wrote:

> So if you use h264_nvenc as codec, you don't have to worry about copying
> to/from gpu memory? The encoding and decoding will be done on hardware?
>
> On Thu, Nov 2, 2017 at 7:47 PM, Shu Wang <halfelf.ronin at gmail.com> wrote:
>
>> I'm using nvenc to encode h264. If reading frame from host memory, it's
>> nothing special from libx264.
>>
>> But there is another problem I'd like to ask help here.
>> I don't know how to create a hw av_frame directly from device memory.
>> For example, hw decoding usually output a hw av_frame, which usually
>> following av_hwframe_transfer_data to copy it back. What if I want to
>> encoding it in device memory directly?
>>
>>
>>
>> On Fri, Nov 3, 2017 at 7:33 AM, From Seattle <fromseattle at gmail.com>
>> wrote:
>>
>>> Hi Everyone,
>>>
>>> Can anyone provide an example of encoding use hardware? In the examples
>>> come along with ffmpeg, there is only hw_decode.cpp, I wish there is a
>>> similar one like hw_encode.cpp.
>>>
>>> Really appreciated.
>>>
>>> Frank.
>>>
>>> _______________________________________________
>>> Libav-user mailing list
>>> Libav-user at ffmpeg.org
>>> http://ffmpeg.org/mailman/listinfo/libav-user
>>>
>>>
>>
>> _______________________________________________
>> Libav-user mailing list
>> Libav-user at ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/libav-user
>>
>>
>
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user
>
>


-- 
Shu. Wang @ Bestminr
http://halfelf.me
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20171103/60589cd2/attachment.html>


More information about the Libav-user mailing list