[FFmpeg-devel] [PATCH] avfilter/vf_telecine: Fix AV desync by using the first input timestamp
--- libavfilter/vf_telecine.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libavfilter/vf_telecine.c b/libavfilter/vf_telecine.c index a0f28d4..4b46ac4 100644 --- a/libavfilter/vf_telecine.c +++ b/libavfilter/vf_telecine.c @@ -38,6 +38,7 @@ typedef struct { int first_field; char *pattern; unsigned int pattern_pos; +int64_t start_time; AVRational pts; double ts_unit; @@ -89,6 +90,8 @@ static av_cold int init(AVFilterContext *ctx) s-pts.den += *p - '0'; } +s-start_time = -1; + s-out_cnt = (max + 1) / 2; av_log(ctx, AV_LOG_INFO, Telecine pattern %s yields up to %d frames per frame, pts advance factor: %d/%d\n, s-pattern, s-out_cnt, s-pts.num, s-pts.den); @@ -173,6 +176,9 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpicref) TelecineContext *s = ctx-priv; int i, len, ret = 0, nout = 0; +if (s-start_time 0) +s-start_time = inpicref-pts; + len = s-pattern[s-pattern_pos] - '0'; s-pattern_pos++; @@ -235,7 +241,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpicref) return AVERROR(ENOMEM); } -frame-pts = outlink-frame_count * s-ts_unit; +frame-pts = s-start_time + outlink-frame_count * s-ts_unit; ret = ff_filter_frame(outlink, frame); } av_frame_free(inpicref); -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avfilter/vf_telecine: Fix AV desync by using the first input timestamp
On Thu, Mar 26, 2015 at 01:16:16AM +0530, Himangi Saraogi wrote: --- libavfilter/vf_telecine.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libavfilter/vf_telecine.c b/libavfilter/vf_telecine.c index a0f28d4..4b46ac4 100644 --- a/libavfilter/vf_telecine.c +++ b/libavfilter/vf_telecine.c @@ -38,6 +38,7 @@ typedef struct { int first_field; char *pattern; unsigned int pattern_pos; +int64_t start_time; AVRational pts; double ts_unit; @@ -89,6 +90,8 @@ static av_cold int init(AVFilterContext *ctx) s-pts.den += *p - '0'; } +s-start_time = -1; should be AV_NOPTS_VALUE timestaps can be negative so -1 could occur as a normal start time [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB During times of universal deceit, telling the truth becomes a revolutionary act. -- George Orwell signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] avfilter/vf_telecine: Fix AV desync by using the first input timestamp
--- libavfilter/vf_telecine.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libavfilter/vf_telecine.c b/libavfilter/vf_telecine.c index a0f28d4..9789f37 100644 --- a/libavfilter/vf_telecine.c +++ b/libavfilter/vf_telecine.c @@ -38,6 +38,7 @@ typedef struct { int first_field; char *pattern; unsigned int pattern_pos; +int64_t start_time; AVRational pts; double ts_unit; @@ -89,6 +90,8 @@ static av_cold int init(AVFilterContext *ctx) s-pts.den += *p - '0'; } +s-start_time = AV_NOPTS_VALUE; + s-out_cnt = (max + 1) / 2; av_log(ctx, AV_LOG_INFO, Telecine pattern %s yields up to %d frames per frame, pts advance factor: %d/%d\n, s-pattern, s-out_cnt, s-pts.num, s-pts.den); @@ -173,6 +176,9 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpicref) TelecineContext *s = ctx-priv; int i, len, ret = 0, nout = 0; +if (s-start_time == AV_NOPTS_VALUE) +s-start_time = inpicref-pts; + len = s-pattern[s-pattern_pos] - '0'; s-pattern_pos++; @@ -235,7 +241,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpicref) return AVERROR(ENOMEM); } -frame-pts = outlink-frame_count * s-ts_unit; +frame-pts = s-start_time + outlink-frame_count * s-ts_unit; ret = ff_filter_frame(outlink, frame); } av_frame_free(inpicref); -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avfilter/vf_telecine: Fix AV desync by using the first input timestamp
Himangi Saraogi himangi774 at gmail.com writes: -frame-pts = outlink-frame_count * s-ts_unit; +frame-pts = s-start_time + outlink-frame_count * s-ts_unit; I believe this should be: frame-pts = s-start_time != AV_NOPTS_VALUE ? s-start_time : 0 + outlink-frame_count * s-ts_unit; possibly with a different formatting... Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] avfilter/vf_telecine: Fix AV desync by using the first input timestamp
--- libavfilter/vf_telecine.c | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libavfilter/vf_telecine.c b/libavfilter/vf_telecine.c index a0f28d4..c75395a 100644 --- a/libavfilter/vf_telecine.c +++ b/libavfilter/vf_telecine.c @@ -38,6 +38,7 @@ typedef struct { int first_field; char *pattern; unsigned int pattern_pos; +int64_t start_time; AVRational pts; double ts_unit; @@ -89,6 +90,8 @@ static av_cold int init(AVFilterContext *ctx) s-pts.den += *p - '0'; } +s-start_time = AV_NOPTS_VALUE; + s-out_cnt = (max + 1) / 2; av_log(ctx, AV_LOG_INFO, Telecine pattern %s yields up to %d frames per frame, pts advance factor: %d/%d\n, s-pattern, s-out_cnt, s-pts.num, s-pts.den); @@ -173,6 +176,9 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpicref) TelecineContext *s = ctx-priv; int i, len, ret = 0, nout = 0; +if (s-start_time == AV_NOPTS_VALUE) +s-start_time = inpicref-pts; + len = s-pattern[s-pattern_pos] - '0'; s-pattern_pos++; @@ -235,7 +241,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpicref) return AVERROR(ENOMEM); } -frame-pts = outlink-frame_count * s-ts_unit; +frame-pts = ((s-start_time == AV_NOPTS_VALUE) ? 0 : s-start_time) + + outlink-frame_count * s-ts_unit; ret = ff_filter_frame(outlink, frame); } av_frame_free(inpicref); -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avfilter/vf_telecine: Fix AV desync by using the first input timestamp
On Thu, Mar 26, 2015 at 04:35:28AM +0530, Himangi Saraogi wrote: --- libavfilter/vf_telecine.c | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) applied thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The real ebay dictionary, page 3 Rare item - Common item with rare defect or maybe just a lie Professional - 'Toy' made in china, not functional except as doorstop Experts will know - The seller hopes you are not an expert signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel