This allows for dropping or duplication to match a particular start time.
---
 libavfilter/vf_fps.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavfilter/vf_fps.c b/libavfilter/vf_fps.c
index 7f51752..704f697 100644
--- a/libavfilter/vf_fps.c
+++ b/libavfilter/vf_fps.c
@@ -54,6 +54,7 @@ typedef struct FPSContext {
 #define V AV_OPT_FLAG_VIDEO_PARAM
 static const AVOption options[] = {
     { "fps", "A string describing desired output framerate", OFFSET(fps), 
AV_OPT_TYPE_STRING, { .str = "25" }, .flags = V },
+    { "first_pts", "Assume the first PTS should be this value.", 
OFFSET(first_pts), AV_OPT_TYPE_INT64, { .i64 = AV_NOPTS_VALUE}, INT64_MIN, 
INT64_MAX, V|F },
     { NULL },
 };
 
@@ -177,7 +178,10 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
             if (ret < 0)
                 return ret;
 
-            s->first_pts = s->pts = buf->pts;
+            if (s->first_pts != AV_NOPTS_VALUE)
+                s->pts = s->first_pts;
+            else
+                s->first_pts = s->pts = buf->pts;
         } else {
             av_log(ctx, AV_LOG_WARNING, "Discarding initial frame(s) with no "
                    "timestamp.\n");
-- 
1.8.1.2

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to