[FFmpeg-devel] avcodec_open() sets wrong video height

Reimar Döffinger Reimar.Doeffinger at gmx.de
Tue Oct 18 17:43:47 CEST 2011


On Tue, Oct 18, 2011 at 12:38:25PM +0200, Michael Niedermayer wrote:
> On Mon, Oct 17, 2011 at 08:32:57PM -0700, Unga wrote:
> > Hi all
> > 
> > This is ffmpeg 0.7.5.
> > 
> > 
> > The avcodec_open() sets wrong video height in pCodecCtx (AVCodecContext).
> > 
> > 
> > printf("pCodecCtx->width  4: %d\n", pCodecCtx->width); // DEBUG
> > printf("pCodecCtx->height 4: %d\n", pCodecCtx->height); // DEBUG  
> >   
> >   // Open codec
> >   if(avcodec_open(pCodecCtx, pCodec)<0)
> >     return -1; // Could not open codec
> > printf("pCodecCtx->width  5: %d\n", pCodecCtx->width); // DEBUG
> > printf("pCodecCtx->height 5: %d\n", pCodecCtx->height); // DEBUG  
> > 
> > 
> > This produces:
> > pCodecCtx->width  4: 1920
> > pCodecCtx->height 4: 1080
> > 
> > pCodecCtx->width  5: 1920
> > pCodecCtx->height 5: 1088
> > 
> 
> most likely 1088 is the actual value of the height of the video stream
> some containers can override this ...

This is also ticket 156, see also my mail "H264: try to keep container-provided dimensions."
Could probably be considered a broken file since the cropping is not set
correctly in the H.264 stream, though it would be better to keep the
container size somehow.


More information about the ffmpeg-devel mailing list