[FFmpeg-devel] [PATCH] move set_context_opts call for video encoders to fix ... (was: Re: strict experimental)

Janne Grunau janne-ffmpeg
Fri Sep 24 14:10:40 CEST 2010


On Fri, Sep 24, 2010 at 12:21:19PM +0200, Carl Eugen Hoyos wrote:
> Hi!
> 
> Wei?t Du, warum strict experimental f?r Video nicht funktioniert?
> Folgender Patch ist sinnvoll, da rv20 nicht korrekt encoded, aber mit dem 
> Patch schaffe ich es einfach nicht mehr, rv20 zu verwenden. egal welche 
> Optionen ich auf der Kommandozeile angebe:
> 
> Index: libavcodec/rv20enc.c
> ===================================================================
> --- libavcodec/rv20enc.c        (revision 25162)
> +++ libavcodec/rv20enc.c        (working copy)
> @@ -65,6 +65,7 @@
>       MPV_encode_init,
>       MPV_encode_picture,
>       MPV_encode_end,
> +    .capabilities = CODEC_CAP_EXPERIMENTAL,
>       .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
>       .long_name= NULL_IF_CONFIG_SMALL("RealVideo 2.0"),
>   };
> 
> Hast Du eine Idee?

yes, strict_std_complience is only set after the find_codec_id_or_die
call for video encoders. see attached patch for a possible fix.

Janne
-------------- next part --------------
commit 7240aadf429855433e641843b85198cfd5981a95
Author: Janne Grunau <janne at grunau.be>
Date:   Fri Sep 24 14:01:37 2010 +0200

    set video codec context options earlier to allow use of experimental video encoders

diff --git a/ffmpeg.c b/ffmpeg.c
index 9d7b2e5..11610a6 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -3396,6 +3396,8 @@ static void new_video_stream(AVFormatContext *oc)
         AVCodec *codec;
         AVRational fps= frame_rate.num ? frame_rate : (AVRational){25,1};
 
+        set_context_opts(video_enc, avcodec_opts[AVMEDIA_TYPE_VIDEO], AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM);
+
         if (video_codec_name) {
             codec_id = find_codec_or_die(video_codec_name, AVMEDIA_TYPE_VIDEO, 1,
                                          video_enc->strict_std_compliance);
@@ -3408,8 +3410,6 @@ static void new_video_stream(AVFormatContext *oc)
 
         video_enc->codec_id = codec_id;
 
-        set_context_opts(video_enc, avcodec_opts[AVMEDIA_TYPE_VIDEO], AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM);
-
         if (codec && codec->supported_framerates && !force_fps)
             fps = codec->supported_framerates[av_find_nearest_q_idx(fps, codec->supported_framerates)];
         video_enc->time_base.den = fps.num;



More information about the ffmpeg-devel mailing list