[FFmpeg-user] Converting a 23.98p source to 29.97i ProRes w/interlaced 3:2 pulldown?

Carl Eugen Hoyos cehoyos at ag.or.at
Tue Oct 27 12:30:18 CET 2015


On Tuesday 27 October 2015 12:03:33 pm Carl Eugen Hoyos wrote:
> Mel Matsuoka <melmatsuoka <at> gmail.com> writes:
> > I had to add the "setfield" filter in order to
> > flag the UFF field order in the encoded ProRes
> > (Final Cut Pro was still interpreting it as a
> > Progressive file, even though the interlacing
> > was baked in to the file).
>
> Do you know how this should be flagged correctly?
> After all, there are still progressive frames in
> the output file: Are they supposed to be flagged
> as interlaced or does the intended output contain
> frames alternatingly flagged progressive and tff?
> I would like to test this with you if possible.

Please test if attached patch works.

Thank you, Carl Eugen
-------------- next part --------------
diff --git a/libavfilter/vf_telecine.c b/libavfilter/vf_telecine.c
index 37343bc..1f3d645 100644
--- a/libavfilter/vf_telecine.c
+++ b/libavfilter/vf_telecine.c
@@ -174,6 +174,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpicref)
     AVFilterLink *outlink = ctx->outputs[0];
     TelecineContext *s = ctx->priv;
     int i, len, ret = 0, nout = 0;
+    int interlaced = 0;
 
     if (s->start_time == AV_NOPTS_VALUE)
         s->start_time = inpicref->pts;
@@ -209,6 +210,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpicref)
         nout++;
         len--;
         s->occupied = 0;
+        interlaced = 1;
     }
 
     while (len >= 2) {
@@ -220,6 +222,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpicref)
                                 s->planeheight[i]);
         nout++;
         len -= 2;
+        interlaced = 0;
     }
 
     if (len >= 1) {
@@ -241,6 +244,10 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpicref)
         }
 
         av_frame_copy_props(frame, inpicref);
+        if (interlaced) {
+            frame->interlaced_frame = 1;
+            frame->top_field_first  = s->first_field == 0;
+        }
         frame->pts = ((s->start_time == AV_NOPTS_VALUE) ? 0 : s->start_time) +
                      av_rescale(outlink->frame_count, s->ts_unit.num,
                                 s->ts_unit.den);


More information about the ffmpeg-user mailing list