[Libav-user] Hardware accell encoding
linux2 at orion15.org
Fri Sep 9 21:59:32 EEST 2016
> 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.
nvenc is going to encode yuv video into h264 stream, I am not sure the output format is what you want.
To get "random" frames encoded, you will have to do something like GOP=1 and mark all frames key frames somehow.
Sounds like you are trying to create a slide show from random frames in a video stream?
Pure theory YMMV...
If you want to use nvenc directly you need to transform AVFrame to EncodeFrameConfig
NVENCSTATUS CNvEncoder::EncodeFrame(EncodeFrameConfig *pEncodeFrame, bool bFlush, uint32_t width, uint32_t height)
Should be able to create your own convertAvFrametoEncoded
REF: convertYUVpitchtoNV12 convertYUVpitchtoYUV444
Setting ecoded->yuv, encoded->yuv, encoded->yuv, dstwidth, dstheight from
av_frame->data av_frame->data av_frame->data, av_frame->width, av_frame->height, av_frame->linesize
but I think the output will not be a "VIDEO FRAME"
More information about the Libav-user