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

Derek Buitenhuis derek.buitenhuis at gmail.com
Thu Mar 7 04:53:47 CET 2013


On 2013-03-06 8:37 PM, Stefano Sabatini wrote:
> Approach seems acceptable (and fixes ticket #1386), but I wonder if
> there is some way to avoid this at the library level.
> 
> w/h resets happens in libavcodec/utils.c:879, in avcodec_open2():
> 
>     //We only call avcodec_set_dimensions() for non h264 codecs so as not to overwrite previously setup dimensions
>     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)
>         avcodec_set_dimensions(avctx, avctx->coded_width, avctx->coded_height);
>     else if (avctx->width && avctx->height)
>         avcodec_set_dimensions(avctx, avctx->width, avctx->height);
>     }
> 
> and I really don't know why it is done this way.

I don't know either, and it looks hacky...

- Derek


More information about the ffmpeg-devel mailing list