[FFmpeg-user] How to determine the video is interlaced

Tim Nicholson nichot20 at yahoo.com
Tue Apr 17 18:22:59 CEST 2012

On 06/04/12 12:34, Carl Eugen Hoyos wrote:
> 韩瑞松 <babyboy-8686 <at> 163.com> writes:
>>  Can I determine the video is interlaced by ffmpeg?
> Yes, there is a new filter, "idet", test reports are welcome.

Well. I have had some interesting initial results.
Using a command line of the form:-

ffmpeg -i $in_file -an \
-vf idet \
-c:v $codec \
-an -t 10 \
-y -f mov /dev/null

The results I get vary depending upon the value of $codec.

If I chose a value for codec that has the same pix_fmt as the source
material then I get sensible answers, eg:-

[idet @ 0x17eeee0] Single frame detection: TFF:83 BFF:0 Progressive:1
[idet @ 0x17eeee0] Multi frame detection: TFF:120 BFF:0 Progressive:0

For tff interlaced material with a mix of a talking head in an otherwise
static studio, and sport material.

However if I chose a codec that has a different pix_fmt to the source
ffmpeg does the following:-

"auto-inserting filter 'auto-inserted scale 0' between the filter 'src'
and the filter 'Parsed_idet_0'"

and then I get a very different result as by default the auto inserted
filter handles the material as progressive so by the time it gets to the
idet filter it has been screwed up and I get:-

idet @ 0x17ef2a0] Single frame detection: TFF:0 BFF:0 Progressive:6

[idet @ 0x17ef2a0] Multi frame detection: TFF:0 BFF:0 Progressive:120

So for accurate results one first needs to determine the pix_fmt and
then chose a suitable codec, or alternatively change the default
behaviour of the scale filter to not always work progressively. Or is
there are better command line that  does not require an output file?
(afaik you have to have an output file or ffmpeg winges)


More information about the ffmpeg-user mailing list