[Libav-user] decoding mp4 questions

Adam Billyard adambillyard at googlemail.com
Sat Jun 14 12:40:03 CEST 2014


Hi All,


All the examples I can find of using swscale to convert an AVFrame from YUV to RGB, use the *CodecContext* width and height:

eg

 sws_getContext(pCodecCtx->width, pCodecCtx->height, 
                        pCodecCtx->pix_fmt, 
                         dst_width, dst_height, PIX_FMT_RGB24, SWS_BILINEAR, 
                        NULL, NULL, NULL);


But when I decode a 1024x768 mp4 movie, the CodecContext->width is 8 and height 1024..  Is that expected?

So I have been using:

sws_getContext(frame->width, frame->height, pCodecCtx->pix_fmt,
			 dst_width, dst_height, PIX_FMT_RGB24, SWS_BILINEAR,
                         NULL, NULL, NULL);


ie after decoding an AVFrame, I use its (now known) size to get my sws context.  Is this correct?


Lastly, I find this works fine for .mov and .avi containers, but for .mp4 movies, it all runs but looks like I'm just getting chroma with extra crud of missing/stale macroblocks..

Video of me pointing at an iPad screen looks like this:
http://i614.photobucket.com/albums/tt229/ElektraGlide/ScreenShot2014-06-14at113519_zps126c6638.png

Any ideas?




More information about the Libav-user mailing list