No subject


Tue Aug 25 22:50:44 CEST 2009


video sources.

The input frame rate is going to be embedded in your source video. If
you're encoding from a native broadcast MPEG stream (from an ATSC
capture or extracted from a DirecTiVo or from DVD), it could very well
be *both* 24000/1001 and 30000/1001, and the MPEG stream includes
special field-order flags that are used by the output device to
determine how it should draw the fields during playback.

So I will take your question to mean "How do I know when I need to use
inverse telecine?" When you know the answer to that question, then you
know your output framerate.

If your source video contains primarily 24000/1001 frames, they're
already progressive and should be output at 24000/1001 FPS. No
problem.

If your source video contains primarily 30000/1001 frames *but is not
telecined*, they're interlaced and should be deinterlaced with your
preferred deinterlacer and output at 30000/1001 FPS.

If your source video contains primarily 30000/1001 frames *but is
telecined*, you need to perform inverse telecine on the telecined
parts, which results in 24000/1001 FPS output.

It gets complicated when your source video is 30000/1001 and has both
telecined and non-telecined content. You need to pick one or the
other. I use the script below that checks twenty one-second samples of
video at various spots throughout the input stream to
pseudo-statistically determine if the video is primarily telecined.

If the result is "TELECINE=true", then most of the video appears to be
telecined and your output frame rate should be 24000/1001 FPS and you
should use the filmdint filter to put the telecined parts together as
24000/1001 FPS and to deinterlace the other parts, but they'll be a
bit jerky since it will have to drop frames on those parts). filmdint
needs to be the first filter in the filter chain so it has access to
the MPEG field-order flags.

If the result is "TELECINE=false", then most of the video does not
appear to be telecined and your output frame rate should be 30000/1001
FPS and you should use your deinterlacer filter of choice. The parts
that are telecined will be jerky since they'll include duplicated
frames.

Hope this is helpful.

   -jrs


---- script start ----
#!/bin/bash

echo "Detecting telecine'd content"
TOTAL=0
SIZE=`stat -c %s "$1"`
let STEPS=20
let STEP=SIZE/STEPS
echo "#  of telecine'd frames detected in a ~1 second sample of video
at various offsets:"
for MUL in `seq 0 $(( $STEPS-1 ))`; do
  let sb=STEP*MUL
  fc=`mplayer -vo null -nosound -sb $sb -frames 30 -vf pullup
-benchmark -quiet -v "$1" 2>/dev/null | grep -c '0+\.1\.+2\|0++1'`
  echo "# $MUL x $STEP = $sb: $fc"
  let TOTAL=TOTAL+fc
done
echo TOTAL=$TOTAL

let TARGET=29*STEPS/2  # more than half the seconds show telecine?
echo TARGET=$TARGET
if [[ $TOTAL -gt $TARGET ]]; then
  echo TELECINE=true
else
  echo TELECINE=false
fi
---- script end ----


More information about the MEncoder-users mailing list