Actually av_image_alloc() should set it for you so you shouldn't need to set it yourself.
Gabriel. http://lives-video.com https://www.openhub.net/accounts/salsaman On Wed, Apr 18, 2018 at 10:49 AM, salsaman <[email protected]> wrote: > linesize should be w * 4 for ARGB I think. > > Gabriel. > > > http://lives-video.com > https://www.openhub.net/accounts/salsaman > > On Wed, Apr 18, 2018 at 2:04 AM, Valeriy Shtoma <[email protected]> > wrote: > >> 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 >> _______________________________________________ >> Libav-user mailing list >> [email protected] >> http://ffmpeg.org/mailman/listinfo/libav-user >> > >
_______________________________________________ Libav-user mailing list [email protected] http://ffmpeg.org/mailman/listinfo/libav-user
