[FFmpeg-devel] [PATCH] ffprobe: Stash and use width and height before opening the codec

Stefano Sabatini stefasab at gmail.com
Fri Mar 8 00:21:24 CET 2013


On date Thursday 2013-03-07 12:40:12 +0100, Michael Niedermayer encoded:
> On Wed, Mar 06, 2013 at 10:52:34PM -0500, Derek Buitenhuis wrote:
> > On 2013-03-06 8:58 PM, Michael Niedermayer wrote:
> > > -    if (!( avctx->coded_width && avctx->coded_height && avctx->width && avctx->height && avctx->codec_id == AV_CODEC_ID_H264)){
> > > +    if (!( avctx->coded_width && avctx->coded_height && avctx->width && avctx->height &&
> > > +           (avctx->codec_id == AV_CODEC_ID_H264 || avctx->codec_id == AV_CODEC_ID_VP6F))){
> > 
> > I dislike this. This is a codec specific hack which could be handled
> > generically in ffprobe.c...
> 
> ffprobe is the only application affected by this ?

I don't like the hack as well, but the alternative is an
application-level hack (which possibly affects all the applications
using the API that way), so hack for hack I prefer the less invasive
hack.

So the question is: why is the hack required for h264 and vp6f in the
first place (and only for those codecs)?

Why width and height (which have been computed by
avformat_find_stream_info(), are overwritten by coded_width/height
when calling avcodec_open2()?

Why codec_width/height are different from width/height, assuming that
lowres is *not* enabled and:

    /**
     * Bitstream width / height, may be different from width/height if lowres enabled.
     * - encoding: unused
     * - decoding: Set by user before init if known. Codec should override / dynamically change if needed.
     */
    int coded_width, coded_height;
?

The issue is related to:
commit 4b4a02b8474bc669eaed8eab496d9cd25a08ab7f
Author: Michael Niedermayer <michaelni at gmx.at>
Date:   Tue Nov 29 17:23:05 2011 +0100

    lavc: dont call set_dimensions() on h264 codec init.
    This fixes ffprobe showing an incorrect width with
    http://panda-test-harness-videos.s3.amazonaws.com/panda.mp4
    
    Idea-by: Joakim Plate <elupus at ecce.se>
    Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
-- 
FFmpeg = Free Formidable Mastodontic Power Enlightened Gadget


More information about the ffmpeg-devel mailing list