[FFmpeg-user] Detecting 24 FPS pulldown in MPEG-2 DVD streams

Robert Krüger krueger at lesspain.de
Mon Jul 1 09:28:13 CEST 2013


Hi,

I have files created using Apple's Compressor that are MPEG-2 files
for in 24p disguised in a 29.97 pulldown scheme. The files are OK and
work in Apple's DVD authoring solution DVD Studio Pro.

Files are detected by ffmpeg/ffprobe as follows:

ffprobe -i ~/tmp/playground/dvd-24p/Compressor-24p-NTSC.m2v -show_streams
ffprobe version N-54160-gfb0df5c Copyright (c) 2007-2013 the FFmpeg developers
  built on Jun 24 2013 11:53:38 with llvm-gcc 4.2.1 (LLVM build 2336.11.00)
  configuration: --disable-optimizations --disable-mmx --disable-stripping
  libavutil      52. 37.101 / 52. 37.101
  libavcodec     55. 16.100 / 55. 16.100
  libavformat    55.  9.100 / 55.  9.100
  libavdevice    55.  2.100 / 55.  2.100
  libavfilter     3. 77.101 /  3. 77.101
  libswscale      2.  3.100 /  2.  3.100
  libswresample   0. 17.102 /  0. 17.102
Input #0, mpegvideo, from
'/Users/krueger/tmp/playground/dvd-24p/Compressor-24p-NTSC.m2v':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: mpeg2video (Main), yuv420p, 720x480 [SAR 32:27
DAR 16:9], 30.25 fps, 59.94 tbr, 1200k tbn, 59.94 tbc
[STREAM]
index=0
codec_name=mpeg2video
codec_long_name=MPEG-2 video
profile=Main
codec_type=video
codec_time_base=1001/60000
codec_tag_string=[0][0][0][0]
codec_tag=0x0000
width=720
height=480
has_b_frames=1
sample_aspect_ratio=32:27
display_aspect_ratio=16:9
pix_fmt=yuv420p
level=8
timecode=01:00:00:00
id=N/A
r_frame_rate=60000/1001
avg_frame_rate=121/4
time_base=1/1200000
start_pts=N/A
start_time=N/A
duration_ts=N/A
duration=N/A
bit_rate=N/A
nb_frames=N/A
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=0
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
[/STREAM]

My question is now, can I do better than this detecting the pulldown
scheme? Maybe this is rather a libav-user question if the answer is, I
have to do it programmatically, which I suspect.

(I know I should not write this but ..)

<the tool who must not be mentioned here> reports the file as (excerpt):

Frame rate                       : 23.976 fps
Scan type                        : Progressive
Scan order                       : 2:3 Pulldown

and I am looking to do the same with ffmpeg (libs or command line).

Another thing that I found noteworthy is, that when decoding the file
into still frames for testing purposes, It uses 29.97 as the output
frame rate (which AFAICS is correct if not reversing the pulldown), I
observe that there are no interlacing artefacts in the resulting
frames which I would expect if pulldown was applied. Instead frames
are repeated from time to time, which will result in the stuttering
effect well-known from watching badly converted NTSC->PAL material.
Could it be the case that ffmpeg honors the repeat flags in the stream
on a frame rather than on a field basis?

I have to add that my knowledge as far as the implications of pulldown
for the MPEG-2 bitstream are concerned, is very limited, so my
assumption may be total BS.

If this is considered a bug or you are interested in a sample, I can
submit a trac issue with a small sample file.

This is the command line and output from extracting the still frames:

ffmpeg -i ~/tmp/playground/dvd-24p/Compressor-24p-NTSC.m2v
~/tmp/playground/dvd-24p/24p-pulldown-%3d.png
ffmpeg version N-54160-gfb0df5c Copyright (c) 2000-2013 the FFmpeg developers
  built on Jun 24 2013 11:53:38 with llvm-gcc 4.2.1 (LLVM build 2336.11.00)
  configuration: --disable-optimizations --disable-mmx --disable-stripping
  libavutil      52. 37.101 / 52. 37.101
  libavcodec     55. 16.100 / 55. 16.100
  libavformat    55.  9.100 / 55.  9.100
  libavdevice    55.  2.100 / 55.  2.100
  libavfilter     3. 77.101 /  3. 77.101
  libswscale      2.  3.100 /  2.  3.100
  libswresample   0. 17.102 /  0. 17.102
Input #0, mpegvideo, from
'/Users/krueger/tmp/playground/dvd-24p/Compressor-24p-NTSC.m2v':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: mpeg2video (Main), yuv420p, 720x480 [SAR 32:27
DAR 16:9], 30.25 fps, 59.94 tbr, 1200k tbn, 59.94 tbc
[swscaler @ 0x7fa1ba001c00] No accelerated colorspace conversion found
from yuv420p to rgb24.
[swscaler @ 0x7fa1ba009400] No accelerated colorspace conversion found
from yuv420p to rgb24.
[swscaler @ 0x7fa1ba011c00] No accelerated colorspace conversion found
from yuv420p to rgb24.
Output #0, image2, to
'/Users/krueger/tmp/playground/dvd-24p/24p-pulldown-%3d.png':
  Metadata:
    encoder         : Lavf55.9.100
    Stream #0:0: Video: png, rgb24, 720x480 [SAR 32:27 DAR 16:9],
q=2-31, 200 kb/s, 90k tbn, 29.97 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (mpeg2video -> png)
Press [q] to stop, [?] for help
frame=   60 fps=0.0 q=0.0 Lsize=N/A time=00:00:02.00 bitrate=N/A
dup=12 drop=0
video:7894kB audio:0kB subtitle:0 global headers:0kB muxing overhead
-100.000272%

I found this in the archives:

http://permalink.gmane.org/gmane.comp.video.ffmpeg.devel/159880

But it looks as if it was never committed.

Thanks in advance,

Robert


More information about the ffmpeg-user mailing list