[Libav-user] Hardware accell encoding
Charles
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
See
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[0], encoded->yuv[1], encoded->yuv[2], dstwidth, dstheight from
av_frame->data[0] av_frame->data[1] av_frame->data[2], av_frame->width, av_frame->height, av_frame->linesize
but I think the output will not be a "VIDEO FRAME"
Thanks
cco
More information about the Libav-user
mailing list