Encode YUV/NV12 to PNG using libav
Apr 17, 2021 YUV libav image png
Encode a YUVNV12 to PNG using libav
used this for creating thumbnail out of camera captured nv12 buffers on an soc.
#include <thumbnail.h>
//Initialize once
thumbnail thumb(inWidth,inHeight,thumbWidth,thumbHeight);
//Save PNG thumbs as required
thumb.savepng ("out.png", Ybuffer, UVbuffer);
// or
thumb.savepng ("out.png", YUVbuffer, YUVbuffer + inWidth*inHeight);