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

Michael Niedermayer michaelni at gmx.at
Tue Mar 19 01:14:21 CET 2013


On Mon, Mar 18, 2013 at 11:36:02PM +0100, Stefano Sabatini wrote:
> On date Friday 2013-03-08 19:30:28 +0100, Michael Niedermayer encoded:
> > On Fri, Mar 08, 2013 at 06:21:11PM +0100, Stefano Sabatini wrote:
> [...]
> > > Look, I'm for the library-level hack if that works, but please let's
> > > try to find a less hacky solution (I don't have idea how cropping
> > > relates to coded_w/h, to VP6F specifically and what "messes up" means
> > > in this case and I'd prefer other people to deal with that).
> > > 
> > > As is, the code is not particularly intelligible, unless you have a
> > > familiarity with the internal working of those codecs (which is not
> > > good for generic code).
> > 
> > i agree but i dont know a simple & pretty solution to this ATM ...
> 
> New hack in attachment.
> -- 
> FFmpeg = Furious and Funny Most Portable Empowered Guru

>  utils.c |    6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> e5f27e6ea752aa376fde8556c0c08994d58c84c9  0001-lavc-utils-add-VP6F-hack-for-setting-correct-video-s.patch
> From dd18a25cbbf54fd0d7d1c21a81cfac9df967f508 Mon Sep 17 00:00:00 2001
> From: Stefano Sabatini <stefasab at gmail.com>
> Date: Mon, 18 Mar 2013 23:17:55 +0100
> Subject: [PATCH] lavc/utils: add VP6F hack for setting correct video size in
>  stream
> 
> For some obscure reasons avcodec_set_dimensions() resets the width/height
> so that the resulting value set in the stream is equal to the
> corresponding coded_width/height, which is not the same as the correct
> width/height in case of the H.264 and VP6F codecs.
> 
> This adds a codec-specific hack for VP6F which disables the call to
> avcodec_set_dimensions() in avcodec_open2(), like it is done with H264. A
> proper fix needs to be found yet.
> 
> Fix trac ticket #1386.
> 
> Based on a patch by Michael Niedermayer.
> 
> Trolled-By: Daemon404
> ---
>  libavcodec/utils.c |    6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/libavcodec/utils.c b/libavcodec/utils.c
> index 94e8b57..ab914c1 100644
> --- a/libavcodec/utils.c
> +++ b/libavcodec/utils.c
> @@ -1078,9 +1078,9 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code
>      if ((ret = av_opt_set_dict(avctx, &tmp)) < 0)
>          goto free_and_end;
>  
> -    //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 && avctx->width && avctx->height) &&
> +        avctx->codec_id != AV_CODEC_ID_H264 && avctx->codec_id != AV_CODEC_ID_VP6F) {

this changes
!(A && B)

to
!A && !B


[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Everything should be made as simple as possible, but not simpler.
-- Albert Einstein
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130319/ac0c7c06/attachment.asc>


More information about the ffmpeg-devel mailing list