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

Unga unga888 at yahoo.com
Tue Oct 18 14:20:39 CEST 2011


----- Original Message -----

> From: Michael Niedermayer <michaelni at gmx.at>
> To: FFmpeg development discussions and patches <ffmpeg-devel at ffmpeg.org>
> Cc: 
> Sent: Tuesday, October 18, 2011 10:38 AM
> Subject: Re: [FFmpeg-devel] avcodec_open() sets wrong video height
> 
> 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 ...
> 

Not sure on this, but dump_format() shows correctly.

> 
> 
>> 
>>  The full program is attached.
> 
> does it behave differently from ffmpeg itself ?
> 

I would say yes. When  a mp4 (showing 1088) encoded to webm using ffmpeg, the tutorial03a shows correctly for the webm file as 1080):

./tutorial03a /tmp/output.webm 
[matroska,webm @ 0x29507010] Estimating duration from bitrate, this may be inaccurate
Input #0, matroska,webm, from '/tmp/output.webm':
  Duration: 00:00:24.73, start: 0.000000, bitrate: N/A
    Stream #0.0: Video: vp8, yuv420p, 1920x1080, PAR 1:1 DAR 16:9, 23.98 fps, 23.98 tbr, 1k tbn, 23.98 tbc (default)
    Stream #0.1: Audio: vorbis, 44100 Hz, stereo, s16 (default)
pCodecCtx->width  1: 1920
pCodecCtx->height 1: 1080
pCodecCtx->width  2: 1920
pCodecCtx->height 2: 1080
pCodecCtx->width  3: 1920
pCodecCtx->height 3: 1080
pCodecCtx->width  4: 1920
pCodecCtx->height 4: 1080
pCodecCtx->width  5: 1920
pCodecCtx->height 5: 1080

Regards
Unga


More information about the ffmpeg-devel mailing list