[MEncoder-users] Can encode from mkv with -oac lavc but not with -oac copy

Dominique Dumont domi.dumont at free.fr
Sat Jun 9 11:33:06 CEST 2007


Hello

I've tried to encode a mkv file with -oac copy. 

The command is :

$ mencoder 'Test.mkv' -oac copy -vf scale=1280:534,crop=1280:528:0:3 -ofps 24000/1001 -ovc x264 -x264encopts subq=1:frameref=1:bframes=3:b_pyramid:weight_b:bitrate=4000:threads=2:pass=1 -o /dev/null

[snip]
[mkv] Track ID 1: video (V_MPEG4/ISO/AVC), -vid 0
[mkv] Track ID 2: audio (A_AC3), -aid 0, -alang eng

[snip]

audiocodec: framecopy (format=2000 chans=6 rate=48000 bits=16 B/s=16000 sample-1536)

After a while I see that the audio bit rate is wrong and I get 1
duplicate frame every 10 frames:

Pos:  61.3s   1341f ( 0%) 15.61fps Trem: 204min 3253mb  A-V:-0.083 [2971:128]
1 duplicate frame(s)!
Pos:  61.7s   1351f ( 0%) 15.59fps Trem: 204min 3273mb  A-V:-0.083 [2992:128]
1 duplicate frame(s)!


The actual problem is that mencoder will stop after a while:

Pos: 147.1s   3211f ( 1%) 14.02fps Trem: 196min 3684mb  A-V:-0.083 [3879:128]
1 duplicate frame(s)!
Pos: 147.5s   3221f ( 1%) 14.02fps Trem: 195min 3680mb  A-V:-0.083 [3879:128]
Too many audio packets in the buffer: (3277 in 8389120 bytes).
Maybe you are playing a non-interleaved stream/file or the codec failed?
For AVI files, try to force non-interleaved mode with the -ni option.



My best guess is that mencoder is confused by something in the mkv
audio and video tracks, maybe the different duration:

$ mkvinfo Test.mkv 
[snip]
|+ Segment tracks
| + A track
|  + Track number: 1
|  + Track UID: 1
|  + Track type: video
|  + Enabled: 1
|  + Default flag: 1
|  + Forced flag: 0
|  + Lacing flag: 0
|  + MinCache: 1
|  + Timecode scale: 1.000000
|  + Max BlockAddition ID: 0
|  + Codec ID: V_MPEG4/ISO/AVC
|  + Codec decode all: 1
|  + CodecPrivate, length 130
|  + Default duration: 41.708ms (23.976 fps for a video track)
|  + Language: eng
|  + Video track
|   + Pixel width: 1920
|   + Pixel height: 800
|   + Interlaced: 0
|   + Display width: 12
|   + Display height: 5
| + A track
|  + Track number: 2
|  + Track UID: 2383791286
|  + Track type: audio
|  + Enabled: 1
|  + Default flag: 1
|  + Forced flag: 0
|  + Lacing flag: 1
|  + MinCache: 0
|  + Timecode scale: 1.000000
|  + Max BlockAddition ID: 0
|  + Codec ID: A_AC3
|  + Codec decode all: 1
|  + Default duration: 32.000ms (31.250 fps for a video track)
|  + Language: eng
|  + Audio track
|   + Sampling frequency: 48000.000000
|   + Channels: 6


As a workaround, I've encoded the file with -oac lavc .

The encoding went fine and I've use mkvmerge to get back the original
audio track.

HTH



More information about the MEncoder-users mailing list