[Libav-user] Hardware accell encoding

Leandro Raffo ljraffo at gmail.com
Fri Sep 9 17:38:55 EEST 2016


2016-09-09 10:55 GMT-03:00 Charles <linux2 at orion15.org>:
> On 09/08/2016 09:57 AM, Leandro Raffo wrote:
>>
>> 2016-09-07 22:18 GMT-03:00 Charles <linux2 at orion15.org>:
>>>
>>> On 09/07/2016 10:06 AM, Leandro Raffo wrote:
>>>>
>>>>
>>>> Do the ffmpeg libraries expose hardware encoding capabilities? (I'm
>>>> mainly looking for NVENC). I've been looking at the ffmpeg source code
>>>> for a bit now, but I cannot find where it is implemented, although I
>>>> could encode directly with the executable (I compiled), hope I get
>>>> some kind of response this time, I'm sorry if my mails are too
>>>> newbie/dumb for this mail list but I want to learn to use the ffmpeg
>>>> api libraries and I'm going at a snail's pace :).
>>>> _______________________________________________
>>>
>>> Yes, you need to have the NVidia Video SDK when you build.
>>>
>>> ./configure --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg
>>> --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man
>>> --extra-cflags=-I../Video_Codec_SDK_7.0.1/Samples/common/inc [...]
>>> --enable-nvenc [...] blah blah blah
>>>
>>> The path --extra-cflags=-I is to the nvEncodeAPI.h file needed and
>>> --enable-nvenc adds the h.264 encoder
>>>
>>> See ./libavcodec/nvenc.c
>>>
>>> Thanks
>>> cco
>>
>>
>> Charles thanks for your answer. I've already compiled using the Nvidia
>> SDK, the thing is that SDK example code is.. uhm.. so I was trying to
>
>
> lol ... yes the Nvidia Sample code is uhm...
>
> You can verify you ffmpeg is build with nvenc
>
> linux2 8:28am avlib >> ffmpeg -encoders |& grep h264_nvenc
>  V..... h264_nvenc           NVIDIA NVENC H.264 encoder (codec h264)
>
> I am not following what you trying to do? Use ffmpeg or direct to nvidia
> nvenc...
>
> Thanks
> cco
>
>> read FFmpeg's source code instead looking how were you using it.
>> Reading the nvenc.c code and correct me If I'm wrong but setting up an
>> AVCodecContext, calling ff_nvenc_encode_frame with a frame and receive
>> a packet to write would do it?

I'm trying to encode AVFrames using the GPU from C code, so I was
trying to see how ffmpeg's source code was doing it and asking for a
pointer on it (or its location lol). I've already encoded directly
with ffmpeg (to see its working) but I need to encode random AVFrames
not an entire video. Also giving a yuv420 video to the Nvidia ENC
samples produces a corrupted video.


More information about the Libav-user mailing list