[MEncoder-users] Transcode from .MTS to wmv with MEncoder fails

Jan Ehrhardt phpdev at ehrhardt.nl
Thu Feb 14 19:02:13 CET 2013


I once again tried MEncoder to transcode a .MTS file from a Canon
camcorder to WMV-format. As a starter: I prefer MEncoder over FFmpeg
because of the volnorm filter.

Source file: http://x32.elijst.nl/00005.MTS
The characterics of the file as reported by FFmpeg are as follows.
Notable is that it is a 50i PAFF interlaced file.

commandline:
ffmpeg -i 00005.mts -s 448x256 -aspect 16:9 -sws_flags bicubic \
	-vcodec wmv2 -b:v 336k -r 25 -g 25 \
	-acodec wmav2 -ab 96k -ar 44100 -ac 2 -y wmvwmaf.wmv  

output:
ffmpeg version git-2013-02-13-845fa2f Copyright (c) 2000-2013 the FFmpeg
developers, built on Feb 13 2013 17:01:45 with gcc 4.7.2 (GCC)
<snip>
[mpegts @ 01a35ca0] max_analyze_duration 5000000 reached at 5000000 ms
Input #0, mpegts, from '00005.mts':
  Duration: 00:04:04.33, start: 0.820033, bitrate: 5333 kb/s
  Program 1 
    Stream #0:0[0x1011]: Video: h264 (High) (HDMV / 0x564D4448),
	yuv420p, 1440x1080 [SAR 4:3 DAR 16:9], 25 fps, 50 tbr, 90k tbn,
	50 tbc
    Stream #0:1[0x1100]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz,
	stereo, fltp, 256 kb/s
Output #0, asf, to 'wmvwmaf.wmv':
  Metadata:
    WM/EncodingSettings: Lavf54.63.100
    Stream #0:0: Video: wmv2 (WMV2 / 0x32564D57), yuv420p, 448x256
	[SAR 64:63 DAR 16:9], q=2-31, 336 kb/s, 1k tbn, 25 tbc
    Stream #0:1: Audio: wmav2 (a[1][0][0] / 0x0161), 44100 Hz, stereo,
	fltp, 96 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (h264 -> wmv2)
  Stream #0:1 -> #0:1 (ac3 -> wmav2)
Press [q] to stop, [?] for help
frame= 41 fps=0.0 q=7.3 size= 176kB time=00:00:01.71 bitrate=
841.1kbits/s dup=1 drop=0    

This one transcodes as expected. Mediainfo gives a little more
information about the file. See the end of this post. 

Then for MEncoder-r35910 with exactly the same FFmpeg (I used the same
sources).

mencoder.exe -ofps 25 -demuxer lavf -vf scale=448:256 -aspect 16:9 \
	-sws 2 -lavdopts fast:threads=8 -of lavf -lavfopts format=asf \
	-ovc lavc -lavcopts vcodec=wmv2:vbitrate=336:keyint=25 \
	-oac lavc -lavcopts acodec=wmav2:abitrate=96 -srate 44100 \
	-af volnorm -o wmvwmam.wmv 00005.MTS 
MEncoder SVN-r35910-4.7.2-ffmpeg-git-2013-02-13-845fa2f (C) 2000-2013
	MPlayer Team
success: format: 0  data: 0x0 - 0x9b59800
libavformat version 54.63.100 (internal)
libavformat file format detected.
[lavf] stream 0: video (h264), -vid 0
[lavf] stream 1: audio (ac3), -aid 0
LAVF: Program 1 
VIDEO:  [H264]  1440x1080  0bpp  50.000 fps    0.0 kbps ( 0.0 kbyte/s)
[V] filefmt:35  fourcc:0x34363248  size:1440x1080  fps:50.000
ftime:=0.0200
=======================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
libavcodec version 54.91.103 (internal)
AUDIO: 48000 Hz, 2 ch, floatle, 256.0 kbit/8.33% (ratio: 32000->384000)
Selected audio codec: [ffac3] afm: ffmpeg (FFmpeg AC-3)
=======================================================================
OK, exit.
Opening video filter: [expand osd=1]
Expand: -1 x -1, -1 ; -1, osd: 1, aspect: 0.000000, round: 1
Opening video filter: [scale w=448 h=256]
=======================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264)
=======================================================================
[mpegts @ 010BE9A0]max_analyze_duration 5000000 reached at 5000000 ms
** MUXER_LAVF *********************************************************
REMEMBER: MEncoder's libavformat muxing is presently broken and can
generate INCORRECT files in the presence of B-frames. Moreover, due to
bugs MPlayer will play these INCORRECT files as if nothing were wrong!
***********************************************************************
Unsupported AVSampleFormat 8
Unsupported AVSampleFormat 8
<end of outpur, MEncoder quits>

The second time (!?) I run this transcode it reports an extra error
after the both AVSampleFormat errors:

Assertion i>=0 failed at libavcodec/wmaenc.c:384

Simple question: MEncoder uses FFmpeg for the trancoding. Why does it
fail when exactly the same FFmpeg as separate program transcodes it
fine? What do I have to change to make the call from MEncoder to the
internal FFmpeg correct?

As additional info:
Sherpya's MEncoder-r33883 transcodes fine.
Subjunk's SB10/11 transcodes fine (see commandline and output below)
Subjunk's SB38 gives all kinds of A/V sync errors, like
>Pos: 4.4s  408f ( 3%) 124.92fps Trem:   1min  11mb  A-V:-0.049 [722:95]
>[wmv2 @ 0119f580]Error, Invalid timestamp=133, last=133

Subjunk's SB45 fails with the same:
>Unsupported AVSampleFormat 8
>Unsupported AVSampleFormat 8
>Assertion i>=0 failed at libavcodec/wmaenc.c:384

Sherpya's MEncoder-r35910 and MEncoder-r35910, compiled for Ubuntu, quit
with the same errors.

Jan

mencoder-SB11 -ofps 25 -demuxer lavf -vf scale=448:256 -aspect 16:9 \
	-sws 2 -lavdopts fast:threads=8 -of lavf -lavfopts format=asf \
	-ovc lavc -lavcopts vcodec=wmv2:vbitrate=336:keyint=25 \
	-oac lavc -lavcopts acodec=wmav2:abitrate=96 -srate 44100 \
	-af volnorm -o wmvwmam.wmv 00005.MTS
MEncoder SB10 (C) 2000-2011 MPlayer Team
Custom build by SubJunk, http://www.spirton.com

success: format: 0  data: 0x0 - 0x9b59800
libavformat file format detected.
[mpegts @ 00efd318]Continuity Check Failed
[mpegts @ 00efd318]max_analyze_duration 5000000 reached at 5000000
[mpegts @ 00efd318]Continuity Check Failed
[lavf] stream 0: video (h264), -vid 0
[lavf] stream 1: audio (ac3), -aid 0
LAVF: Program 1
VIDEO:  [H264]  1440x1080  0bpp  50.000 fps    0.0 kbps ( 0.0 kbyte/s)
[V] filefmt:35  fourcc:0x34363248  size:1440x1080  fps:50.000
ftime:=0.0200
=======================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 48000 Hz, 2 ch, s16le, 256.0 kbit/16.67% (ratio: 32000->192000)
Selected audio codec: [ffac3] afm: ffmpeg (FFmpeg AC-3)
=======================================================================
** MUXER_LAVF *********************************************************
REMEMBER: MEncoder's libavformat muxing is presently broken and can
generate INCORRECT files in the presence of B-frames. Moreover, due to
bugs MPlayer will play these INCORRECT files as if nothing were wrong!
***********************************************************************
OK, exit.
Opening video filter: [expand osd=1]
Expand: -1 x -1, -1 ; -1, osd: 1, aspect: 0.000000, round: 1
Opening video filter: [scale w=448 h=256]
=======================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264)
=======================================================================
Pos:   0.0s      1f ( 0%)  0.00fps Trem:   0min   0mb  A-V:0.000 [0:0]
Unsupported PixelFormat 61
Unsupported PixelFormat 53
Pos:   0.0s      4f ( 0%)  0.00fps Trem:   0min   0mb  A-V:0.002 [0:0]]

1 duplicate frame(s)!
Muxer frame buffer cannot allocate memory!
Pos:   0.0s      6f ( 0%)  0.00fps Trem:   0min   0mb  A-V:0.006 [0:0]

1 duplicate frame(s)!
Muxer frame buffer cannot allocate memory!
Pos:   0.0s      8f ( 0%)  0.00fps Trem:   0min   0mb  A-V:0.002 [0:0]
Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
[swscaler @ 00efa9f4]BICUBIC scaler, from yuv420p to yuv420p using MMX2
videocodec: libavcodec (448x256 fourcc=32564d57 [WMV2])
VIDEO CODEC ID: 19
AUDIO CODEC ID: 15008, TAG: 0
Writing header...
[asf @ 00efd318]Codec for stream 0 does not use global headers but
	container format requires global headers
[asf @ 00efd318]Codec for stream 1 does not use global headers but
	container format requires global headers

1 duplicate frame(s)!
Pos:   0.1s     12f ( 0%)  0.00fps Trem:   0min   8mb  A-V:0.004 [0:0]

1 duplicate frame(s)!
Pos:   0.1s     14f ( 0%)  0.00fps Trem:   0min   8mb  A-V:0.000 [0:0]

1 duplicate frame(s)!
Pos:   0.2s     16f ( 0%)  0.00fps Trem:   0min   7mb  A-V:0.000 [0:0]]

1 duplicate frame(s)!
Pos: 158.8s   7944f (65%) 223.29fps Trem:   0min  13mb  A-V:0.080
	[361:96]]

Skipping frame!
Pos: 236.4s  11826f (97%) 222.57fps Trem:   0min  13mb  A-V:0.081
	[352:96]

Skipping frame!
Pos: 244.1s  12216f (100%) 222.32fps Trem:   0min  13mb  A-V:-0.008
	[352:96]

Flushing video frames.
Writing index...

Video stream:  352.495 kbit/s  (44061 B/s)  size: 10756383 bytes 244.120
	secs  12216 frames

Audio stream:   96.000 kbit/s  (11999 B/s)  size: 2935947 bytes 244.662s


mediainfo 00005.MTS 
General
ID                                       : 0 (0x0)
Complete name                            : 00005.MTS
Format                                   : BDAV
Format/Info                              : Blu-ray Video
File size                                : 155 MiB
Duration                                 : 4mn 4s
Overall bit rate mode                    : Variable
Overall bit rate                         : 5 329 Kbps
Maximum Overall bit rate                 : 13.7 Mbps

Video
ID                                       : 4113 (0x1011)
Menu ID                                  : 1 (0x1)
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High at L4.0
Format settings, CABAC                   : Yes
Format settings, ReFrames                : 2 frames
Format settings, GOP                     : M=3, N=12
Codec ID                                 : 27
Duration                                 : 4mn 4s
Bit rate mode                            : Variable
Bit rate                                 : 4 853 Kbps
Maximum bit rate                         : 12.0 Mbps
Width                                    : 1 440 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Frame rate                               : 25.000 fps
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Interlaced
Scan order                               : Top Field First
Bits/(Pixel*Frame)                       : 0.125
Stream size                              : 141 MiB (91%)

Audio
ID                                       : 4352 (0x1100)
Menu ID                                  : 1 (0x1)
Format                                   : AC-3
Format/Info                              : Audio Coding 3
Mode extension                           : CM (complete main)
Format settings, Endianness              : Big
Codec ID                                 : 129
Duration                                 : 4mn 4s
Bit rate mode                            : Constant
Bit rate                                 : 256 Kbps
Channel(s)                               : 2 channels
Channel positions                        : Front: L R
Sampling rate                            : 48.0 KHz
Bit depth                                : 16 bits
Compression mode                         : Lossy
Delay relative to video                  : -80ms
Stream size                              : 7.46 MiB (5%)



More information about the MEncoder-users mailing list