[FFmpeg-cvslog] lavc/utils: add VP6F hack for setting correct video size in stream

Stefano Sabatini git at videolan.org
Tue Mar 19 23:42:04 CET 2013


ffmpeg | branch: master | Stefano Sabatini <stefasab at gmail.com> | Mon Mar 18 23:17:55 2013 +0100| [33b054986767a76bff64fe3091cca2eea07c27de] | committer: Stefano Sabatini

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

See thread:
Subject: [FFmpeg-devel] [PATCH] ffprobe: Stash and use width and height before opening the codec
Date: Fri,  1 Mar 2013 10:41:34 -0500

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=33b054986767a76bff64fe3091cca2eea07c27de
---

 libavcodec/utils.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index b245914..e46e907 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -1080,9 +1080,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)){
-
+    // only call avcodec_set_dimensions() for non H.264/VP6F 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 || avctx->codec_id == AV_CODEC_ID_VP6F))) {
     if (avctx->coded_width && avctx->coded_height)
         avcodec_set_dimensions(avctx, avctx->coded_width, avctx->coded_height);
     else if (avctx->width && avctx->height)



More information about the ffmpeg-cvslog mailing list