[FFmpeg-devel] [PATCH] libx264: fix overwriting preset rc_lookahead

Andrew Wason rectalogic at rectalogic.com
Mon Sep 12 21:08:45 CEST 2011


This fixes https://ffmpeg.org/trac/ffmpeg/ticket/448 - at least for
rc_lookahead. A similar problem still exists for the flags2 based
options.

Andrew
-------------- next part --------------
diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index 4fd117f..e1096bb 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -584,6 +584,7 @@ static const AVCodecDefault x264_defaults[] = {
     { "qdiff",            "-1" },
     { "qblur",            "-1" },
     { "qcomp",            "-1" },
+    { "rc_lookahead",     "-1" },
     { "refs",             "-1" },
     { "sc_threshold",     "-1" },
     { "trellis",          "-1" },
diff --git a/libavcodec/options.c b/libavcodec/options.c
index b3c562e..549d04a 100644
--- a/libavcodec/options.c
+++ b/libavcodec/options.c
@@ -472,7 +472,7 @@ static const AVOption options[]={
 {"psy_trellis", "specify psycho visual trellis", OFFSET(psy_trellis), FF_OPT_TYPE_FLOAT, {.dbl = -1 }, -1, FLT_MAX, V|E},
 {"aq_mode", "specify aq method", OFFSET(aq_mode), FF_OPT_TYPE_INT, {.dbl = -1 }, -1, INT_MAX, V|E},
 {"aq_strength", "specify aq strength", OFFSET(aq_strength), FF_OPT_TYPE_FLOAT, {.dbl = -1.0 }, -1, FLT_MAX, V|E},
-{"rc_lookahead", "specify number of frames to look ahead for frametype", OFFSET(rc_lookahead), FF_OPT_TYPE_INT, {.dbl = 40 }, 0, INT_MAX, V|E},
+{"rc_lookahead", "specify number of frames to look ahead for frametype", OFFSET(rc_lookahead), FF_OPT_TYPE_INT, {.dbl = 40 }, -1, INT_MAX, V|E},
 {"ssim", "ssim will be calculated during encoding", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_SSIM }, INT_MIN, INT_MAX, V|E, "flags2"},
 {"intra_refresh", "use periodic insertion of intra blocks instead of keyframes", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_INTRA_REFRESH }, INT_MIN, INT_MAX, V|E, "flags2"},
 {"crf_max", "in crf mode, prevents vbv from lowering quality beyond this point", OFFSET(crf_max), FF_OPT_TYPE_FLOAT, {.dbl = DEFAULT }, 0, 51, V|E},


More information about the ffmpeg-devel mailing list