[Libav-user] QImage(RGB32) to AVFrame(RGB32)
Valeriy Shtoma
shtomavaleriy at gmail.com
Wed Apr 18 08:04:32 EEST 2018
Hi to all dear developers,
I want to convert QImage to AVFrame and than push it to
filter. But when I pushed AVFrame, I got an error:
[in @ 0x11c71c200] Changing frame properties on the fly
is not supported by all filters.
and than
[libx264 @ 0x10ea52c00] Input picture width (640) is greater
than stride (0)
But in this case my picture 1280x720...
I know, that my code wrong(not correct pointers and linesize)
What I’m doing wrong?
My code:
Varian 1:
AV_PIX_FMT_ARGB or AV_PIX_FMT_RGB32
QImage img = ...;
AVFrame *frame = av_frame_alloc();
avpicture_fill((AVPicture*)frame, img.bits(), AV_PIX_FMT_ARGB,
img.width(), img.height());
Variant 2:
AVFrame *frame = av_frame_alloc();
av_image_alloc(frame->data, frame->linesize, w, h, AV_PIX_FMT_ARGB, 1);
frame->width = w;
frame->height = h;
frame->format = AV_PIX_FMT_ARGB;
frame->linesize[0] = w;
av_image_fill_arrays(frame->data, frame->linesize, (uint8_t*)img.bits(),
AV_PIX_FMT_ARGB, w, h, 1);
Thanks for attention. :)
Kind Regards,
Valeriy V Shtoma
More information about the Libav-user
mailing list