[FFmpeg-devel] [PATCH] lavfi/drawtext: change minimum value for timecode_rate
Gyan Doshi
gyandoshi at gmail.com
Thu Nov 2 07:47:05 EET 2017
Prompted by an issue reported at StackExchange, patch changes minimum
value for timecode_rate to 1.
The user-supplied value for timecode_rate is rounded to nearest integer.
So, a supplied value of 0.49 or lower is rounded to 0. This throws a
misleading error message that says "Timecode frame rate must be specified".
Regards,
Gyan
-------------- next part --------------
From 24d9c412d136c80b09f7168e971446bc400e8554 Mon Sep 17 00:00:00 2001
From: Gyan Doshi <gyandoshi at gmail.com>
Date: Thu, 2 Nov 2017 11:08:21 +0530
Subject: [PATCH] lavfi/drawtext: change minimum value for timecode_rate
The user-supplied value for timecode_rate is rounded to nearest integer.
So, a supplied value of 0.49 or lower is rounded to 0. This throws a
misleading error message that says "Timecode frame rate must be specified".
Changed minimum acceptable value to 1. Tested locally.
Documented the change and also noted supported framerates for drop TC.
---
doc/filters.texi | 4 +++-
libavfilter/vf_drawtext.c | 6 +++---
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/doc/filters.texi b/doc/filters.texi
index 6f6dfcff48..61e27fea6f 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -7365,7 +7365,9 @@ format. It can be used with or without text parameter. @var{timecode_rate}
option must be specified.
@item timecode_rate, rate, r
-Set the timecode frame rate (timecode only).
+Set the timecode frame rate (timecode only). Value will be rounded to nearest
+integer. Minimum value is "1".
+Drop-frame timecode is supported for frame rates 30 & 60.
@item tc24hmax
If set to 1, the output of the timecode option will wrap around at 24 hours.
diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c
index f6151443bb..251d453e0b 100644
--- a/libavfilter/vf_drawtext.c
+++ b/libavfilter/vf_drawtext.c
@@ -233,9 +233,9 @@ static const AVOption drawtext_options[]= {
{"timecode", "set initial timecode", OFFSET(tc_opt_string), AV_OPT_TYPE_STRING, {.str=NULL}, CHAR_MIN, CHAR_MAX, FLAGS},
{"tc24hmax", "set 24 hours max (timecode only)", OFFSET(tc24hmax), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS},
- {"timecode_rate", "set rate (timecode only)", OFFSET(tc_rate), AV_OPT_TYPE_RATIONAL, {.dbl=0}, 0, INT_MAX, FLAGS},
- {"r", "set rate (timecode only)", OFFSET(tc_rate), AV_OPT_TYPE_RATIONAL, {.dbl=0}, 0, INT_MAX, FLAGS},
- {"rate", "set rate (timecode only)", OFFSET(tc_rate), AV_OPT_TYPE_RATIONAL, {.dbl=0}, 0, INT_MAX, FLAGS},
+ {"timecode_rate", "set rate (timecode only)", OFFSET(tc_rate), AV_OPT_TYPE_RATIONAL, {.dbl=1}, 1, INT_MAX, FLAGS},
+ {"r", "set rate (timecode only)", OFFSET(tc_rate), AV_OPT_TYPE_RATIONAL, {.dbl=1}, 1, INT_MAX, FLAGS},
+ {"rate", "set rate (timecode only)", OFFSET(tc_rate), AV_OPT_TYPE_RATIONAL, {.dbl=1}, 1, INT_MAX, FLAGS},
{"reload", "reload text file for each frame", OFFSET(reload), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS},
{ "alpha", "apply alpha while rendering", OFFSET(a_expr), AV_OPT_TYPE_STRING, { .str = "1" }, .flags = FLAGS },
{"fix_bounds", "check and fix text coords to avoid clipping", OFFSET(fix_bounds), AV_OPT_TYPE_BOOL, {.i64=1}, 0, 1, FLAGS},
--
2.12.2.windows.2
More information about the ffmpeg-devel
mailing list