Re: I want to resize getted frame from movie file.
Dear:
I want to watch fixed display size from movie file. (eg. 640x480) I'm trying to use img_resample function. I don't know what i do before calling img_resample_init function. something following line.
if(packet.stream_index == m_nVideoStream) { // decoding next frame. bytesDecoded = avcodec_decode_video(m_pCodecCtx, m_pFrame, &frameFinished, packet.data, packet.size);
if(frameFinished) { img_convert((AVPicture *)m_pFrameRGB, PIX_FMT_RGB24, (AVPicture*)m_pFrame, m_pCodecCtx->pix_fmt, m_pCodecCtx->width, m_pCodecCtx->height); // m_pFrame has YUV frame ImgReSampleContext *s; s = img_resample_init( 640, 480, width, height); // initialize resample
you'd better use img_resample_full_init(...) to initialize the resample context !
img_resample(s, m_pic, (AVPicture *)m_pFrameRGB); // error occur
How do you initialize the "m_pic"? you should fill "m_pic" with yuv420(640x480) layout buffer firstly There is an important note that img_resample(...) is only happy with YUV420 pix format,but not RGB
img_resample_close(s); Jeon,Chang-Min Thanks.
Take care!
participants (1)
-
ffmpeg@gmail.com