[FFmpeg-user] Detect if an MTS file is interlaced or not?

Thomas Worth dev at rarevision.com
Sun Jun 12 14:40:37 CEST 2011


On Wed, Jun 8, 2011 at 2:13 AM, Thomas Worth <dev at rarevision.com> wrote:
> I'd like to know if there's a way to tell if an MTS file is
> interlaced, preferably without having to decode it first. The problem
> I have is that libav always returns 59.94 for the frame rate of
> interlaced NTSC streams, even though we know it's 29.97. And of
> course, r_frame_rate always returns 0 with the "mpegts" format so I am
> left to calculate the frame count manually. I need the correct frame
> rate to do this, however and there's no way of telling ahead of time
> whether the input video will be interlaced or not. Any ideas?
>

Sorry to nag, but I didn't get a response to this. All I need is a way
to determine whether an input MTS file (with an H.264 stream) is
interlaced or not. I thought this could be accomplished by reading
values from the MTS format context, but I've had no luck. I even tried
decoding an AVFrame and reading the avframe->interlaced_frame value,
but it did not report the frame as interlaced even though the video is
indeed interlaced (comments in avcodec.h say this value is set by the
decoder).

Obviously VLC is playing the file back at its intended frame rate even
though the frame rate reported by avformat is 59.94 (the actual frame,
not field rate should be 29.97). Where is it getting this information?
It doesn't seem to be getting it from r_frame_rate, since that is
always double the playback rate with MTS it seems.


More information about the ffmpeg-user mailing list