Hi to everybody,
I've got the following problem:
I'm trying to encode a movie out of different QImages(Part of the Qt library).
Therefore I've written this function:
bool MediaSaver::write_vid_frame(uint8_t** data,int linesize)
{
AVPacket pkt;
int out_size;
if(sws_cont)//means we've got different input-output pixelformat
{
sws_scale(sws_cont,(uint8_t**)data,&linesize,0,codcon->height,frm->data,frm->linesize);
}
else
{
frm->data[0]=data[0];
frm->data[1]=data[1];
frm->data[2]=data[2];
frm->data[3]=data[3];
}
av_init_packet(&pkt);
pkt.stream_index= vid->index;
if(cont->flags&AVFMT_RAWPICTURE)
{
pkt.flags|=PKT_FLAG_KEY;
pkt.data=(uint8_t*)frm;
pkt.size=sizeof(AVPicture);
}
else
{
out_size=avcodec_encode_video(codcon, video_outbuf,
video_outbuf_size, frm);
if(out_size<=0)
return false;
if (codcon->coded_frame->pts != AV_NOPTS_VALUE)
pkt.pts= av_rescale_q(codcon->coded_frame->pts, codcon->time_base,
vid->time_base);
if(codcon->coded_frame->key_frame)
pkt.flags |= PKT_FLAG_KEY;
pkt.data=video_outbuf;
pkt.size=out_size;
}
where codcon is a CodexContext* and frm is an AVFrame* wich are alloced proper.
Then I call it:
write_vid_frame((uint8_t**)im.bits(),im.bytesPerLine());
where im is my QImage.At this point my programm crashes.
All necessary initalization has been done.
Greetings and have a nice christmas
Alex
_______________________________________________________________________
Täglich 1.000.000 Euro gewinnen! Jetzt kostenlos WEB.DE MillionenKlick
spielen! https://millionenklick.web.de/[email protected]@home
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user