Thanks, I will look at it. and I made progress myself :D I managed to fix the sws_scale problem, but now, and I think thats very strange, avcodec_encode_video works extact to times well but at the third call of write_vid_frame it crashes.
Alex > -----Ursprüngliche Nachricht----- > Von: "Varol Okan" <[email protected]> > Gesendet: 23.12.08 22:42:52 > An: Libav* user questions and discussions <[email protected]> > Betreff: Re: [libav-user] Converting QImage(Qt) to AVFrame > I described my approach under > http://qtdvd.com/guides/ffmpeg.html > > The final product is qrender of the QDVDAuthor suite. You can check out > the code in qrender/engine/ffmpeg_enc.cpp > > Hope this helps > > Varol :) > Ps. The audio part was what took me longest. > > [email protected] wrote: > > 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 > > > > _______________________________________________ > libav-user mailing list > [email protected] > https://lists.mplayerhq.hu/mailman/listinfo/libav-user > -- Carpe Temporem (Nutze die Zeit) _______________________________________________________________________ Sensationsangebot verlängert: WEB.DE FreeDSL - Telefonanschluss + DSL für nur 16,37 Euro/mtl.!* http://dsl.web.de/?ac=OM.AD.AD008K15039B7069a _______________________________________________ libav-user mailing list [email protected] https://lists.mplayerhq.hu/mailman/listinfo/libav-user
