[MEncoder-users] problems with AVCHD (.mts) + Deinterlace + ofps

Matt Henson matt.henson at gmail.com
Mon Dec 22 00:39:05 CET 2008


Good day,
I'm developing a product that uses mencoder to transcode user-generated
content into H.264 video for viewing on the internet. I'm having difficulty
with a specific case and would appreciate any help.

Mencoder dev-SVN-r27749-4.1.2

Input:
AVCHD Video (.mts file from a Canon HF-100 HD video camera), 29.97fps,
interlaced, 1920x1080

Desired output:
H.264 (.264 file) that will be muxed with MP4Box, 1280x720 (scaled from
orig), progressive, 23.976fps (to reduce CPU requirement for viewing over
the internet), 2.5 mb/sec

I'm using YADIF to deinterlace. Since I don't want 60fps, I use mode 0.

Here's my current mencoder command line (Pass 2 of the 2-pass shown. Pass 1
is similar except for x264 options):

mencoder "$1" -o "$outdir/${iFile%%.*}_temp.264" -demuxer lavf -passlogfile
"$outdir/${iFile%%.*}"_temp.log -ovc x264 -x264encopts
bitrate=$itemVideoBitrate:frameref=4:bframes=16:b_adapt:b_pyramid:weight_b:partitions=all:8x8dct:me=umh:subq=7:trellis=2:mixed_refs:brdo:threads=auto:pass=2:analyse=all
-of rawvideo -nosound -vf scale=1280:720,yadif=0 -fps 29.97 -ofps 23.976

The actual output with this configuration is a video that's actually
29.97fps. So, when I mux it with the audio and tell Mp4box that the frame
rate is 23.976, the resulting file is too long (in duration), the video is
slow so the audio ends before the video does. I'm also getting a ton of
duplicate frame warnings (output from mencoder is below)

I've also tried:
- Use yadif=1 and -fps 59.94, and the result was the same
- Switch order of scale and yadif (In retrospect, I should go back to
deinterlacing before scaling to improve video quality, but that's not the
problem I'm trying to solve right now).
- ofps=29.97, (or remove -ofps) and the resuting frame rate is correct
(29.97).

I use this same receipe with other videos (including lots of progressive
scan as well as interlaced .m2t MPEG-2 HD videos from older HD cameras) and
it has always given me the 23.976fps that I want.

Here's what mencoder sends to the console:
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264)
==========================================================================
VDec: vo config request - 1920 x 1080 (preferred colorspace: Planar YV12)
VDec: using Planar I420 as output csp (no 1)
Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
SwScaler: reducing / aligning filtersize 7 -> 8
SwScaler: reducing / aligning filtersize 7 -> 8
SwScaler: reducing / aligning filtersize 7 -> 6
SwScaler: reducing / aligning filtersize 7 -> 6
[swscaler @ 0x889b500]BICUBIC scaler, from yuv420p to yuv420p using MMX2
[swscaler @ 0x889b500]using 8-tap MMX scaler for horizontal luminance
scaling
[swscaler @ 0x889b500]using 8-tap MMX scaler for horizontal chrominance
scaling
[swscaler @ 0x889b500]using n-tap MMX scaler for vertical scaling (YV12
like)
[swscaler @ 0x889b500]1920x1080 -> 1280x720
x264 [info]: using SAR=1/1
x264 [info]: using cpu capabilities: MMX2 SSE2Slow
Pos:   0.0s      2f ( 2%)  0.00fps Trem:   0min   0mb  A-V:0.000 [0:0]
1 duplicate frame(s)!
Pos:   0.0s      3f ( 2%)  0.00fps Trem:   0min   0mb  A-V:0.000 [0:0]
1 duplicate frame(s)!
Pos:   0.1s      5f ( 3%)  0.00fps Trem:   0min   0mb  A-V:0.000 [0:0]
1 duplicate frame(s)!
Pos:   0.1s      6f ( 3%)  0.00fps Trem:   0min   0mb  A-V:0.000 [0:0]
1 duplicate frame(s)!
Pos:   0.2s      7f ( 3%)  0.00fps Trem:   0min   0mb  A-V:0.000 [0:0]
1 duplicate frame(s)!
Pos:   0.2s      8f ( 4%)  0.00fps Trem:   0min   0mb  A-V:0.000 [0:0]
1 duplicate frame(s)!
Pos:   0.3s     11f ( 4%)  0.00fps Trem:   0min   0mb  A-V:0.000 [0:0]
1 duplicate frame(s)!
Pos:   0.3s     13f ( 5%)  0.00fps Trem:   0min   0mb  A-V:0.000 [0:0]
1 duplicate frame(s)!
---- Skipped a bunch of Duplicate Frame Warnings-----
1 duplicate frame(s)!
Pos:   7.7s    253f (94%)  1.90fps Trem:   0min   1mb  A-V:0.000 [1279:0]
1 duplicate frame(s)!
Pos:   7.8s    257f (96%)  1.89fps Trem:   0min   1mb  A-V:0.000 [1294:0]
1 duplicate frame(s)!
Pos:   8.0s    261f (97%)  1.89fps Trem:   0min   1mb  A-V:0.000 [1283:0]
1 duplicate frame(s)!
Pos:   8.0s    263f (98%)  1.88fps Trem:   0min   1mb  A-V:0.000 [1285:0]
1 duplicate frame(s)!
Pos:   8.2s    267f (99%)  1.89fps Trem:   0min   1mb  A-V:0.000 [1278:0]
1 duplicate frame(s)!
Pos:   8.3s    270f (99%)  1.87fps Trem:   0min   1mb  A-V:0.000 [1286:0]
Flushing video frames.

Video stream: 1315.195 kbit/s  (164399 B/s)  size: 1474219 bytes  8.967
secs  270 frames
x264 [info]: slice I:1     Avg QP:23.54  size: 69952
x264 [info]: slice P:34    Avg QP:25.18  size: 23034
x264 [info]: slice B:96    Avg QP:28.35  size:  6463
x264 [info]: consecutive B-frames:  0.8%  0.0%  9.2% 86.2%  3.8%  0.0%
0.0%  0.0%  0.0%  0.0%  0.0%  0.0%  0.0%  0.0%  0.0%  0.0%  0.0%
x264 [info]: mb I  I16..4: 11.3% 69.4% 19.2%
x264 [info]: mb P  I16..4:  0.7% 10.0%  2.5%  P16..4: 59.3%  8.3%  3.6%
0.0%  0.0%    skip:15.6%
x264 [info]: mb B  I16..4:  0.0%  1.1%  0.6%  B16..8: 34.2%  1.9%  1.6%
direct: 1.9%  skip:58.6%  L0:33.3% L1:59.0% BI: 7.7%
x264 [info]: 8x8 transform  intra:72.0%  inter:71.0%
x264 [info]: ref P L0  76.6% 13.8%  6.5%  3.2%
x264 [info]: ref B L0  90.1%  7.2%  2.7%
x264 [info]: ref B L1  96.2%  3.8%
x264 [info]: kb/s:2157.6


--- MediaInfo on the Various Files----
Source (MTS file)
Duration                         : 4s 400ms
Frame rate                       : 29.970 fps
Frame Count                    : 133


Intermediate video (.264)
Frame rate                       : 23.976
Frame Count                    : 133    <--- Should be ~106

Final Video after mp4box and audio mux(.mp4)
Duration                         : 5s 463ms
Frame rate                       : 23.976 fps
Frame Count                   : 133   <--- Should be ~106, see above

Is there any other information needed to debug or solve this?

Thanks in advance for any help with this!
Cheers,
mh



More information about the MEncoder-users mailing list