version
#define LIBAVCODEC_VERSION_MAJOR 60
#define LIBAVCODEC_VERSION_MINOR 15
#define LIBAVCODEC_VERSION_MICRO 100
note
不使用AVOutputFormat
code
void CFfmpegOps::EncodeRGB24ToPNG(const char *infile, const char *width_str, const char *height_str, const char *outfile)
{
if ((!infile) || (!width_str) || (!height_str) || (!outfile))
{
return;
}
int width = 0;
int height = 0;
AVFrame *rgb24frame = nullptr;
int rgb24frame_bytes = 0;
AVPixelFormat rgb24_fmt = AV_PIX_FMT_RGB24;
int ret = -1;
FILE *in_fp = nullptr;
size_t n = 0;
AVPacket *pkt = nullptr;
const AVCodec *png_encoder = nullptr;
AVCodecContext *png_encoder_ctx = nullptr;
FILE *out_fp = nullptr;
try
{
width = std::stoi(width_str);
height = std::stoi(height_str);
}
catch (const std::exception &e)
{
return;
}
rgb24frame = av_fr