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

Don Moir donmoir at comcast.net
Tue Oct 18 17:31:01 CEST 2011


>per Michael
>Please explain what exactly you do, what you expect and what happens
>with enough detail so we could reproduce the issue
>I think you simply hit a very well known issue that croping is not
>supported but if you belive otherwise we need more information

With this ticket:

https://avcodec.org/trac/ffmpeg/ticket/465

There is an attached sample test.flv which can be used to reproduce the 
problem.

o - With this sample, prior to avcodec_open the AVCodecContext height is 
correct which is 216.

o - After avcodec_open the AVCodecContext height is incorrect and shows 224.

o - All frames have the correct height when processing.

Outside of ffmpeg related apps, test.flv plays correctly at the 216 height.

In my own app, I recognize the condtion and correct it but can't say I like 
it.

----- Original Message ----- 
From: "Unga" <unga888 at yahoo.com>
To: "FFmpeg development discussions and patches" <ffmpeg-devel at ffmpeg.org>
Sent: Tuesday, October 18, 2011 8:20 AM
Subject: Re: [FFmpeg-devel] avcodec_open() sets wrong video height


----- 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
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel at ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel 



More information about the ffmpeg-devel mailing list