Dear forumers!
Nowadays, due to my job I've got to transcode video a lot, mostly from PAL MPEG-2 to XviD. I use mencoder, because this is the fastest and most efficient solution, but there's a little problem which always gives me hard time when transcoding. Basically PAL DVD compliant MPEG-2 streams are encoded with audio codec mp2 (MPEG 1 - Layer 2), this is the standard, but mencoder cannot handle it without glitches, it skips 5-6 frames at the beginning and this causes the whole audio stream of the conversion will have positive or negative latency and this causes a/v desync. It can be fixed guessing the delay caused by the frameskips and using the -audio-delay option, but it takes a lot of time, especially when it comes to transcode a 2-3 hour footage.
Basically I convert interlaced PAL MPEG-2 streams (25fps) into progressive xvid (50fps) avi using the tfields filter.
Like this.
Code:
mencoder -oac mp3lame -lameopts mode=1:cbr:aq=1:br=192 -ovc xvid -xvidencopts \
bitrate=740:par=pal43:qpel -vop scale=480:360,tfields -fps 50 some.mpg -o some.avi
And the console log:
Code:
1 duplicate frame(s)!
Pos: 0.8s 22f ( 0%) 12.92fps Trem: 3min 16mb A-V:0.042 [0:192]
Skipping frame!
Pos: 1.1s 32f ( 1%) 13.47fps Trem: 3min 15mb A-V:0.042 [875:191]
Skipping frame!
Pos: 1.5s 43f ( 1%) 13.17fps Trem: 4min 17mb A-V:0.041 [905:191]
Skipping frame!
Pos: 2.1s 58f ( 1%) 13.16fps Trem: 4min 17mb A-V:0.041 [837:191]
Skipping frame!
Pos: 3.1s 85f ( 2%) 12.86fps Trem: 5min 18mb A-V:0.040 [828:191]
Skipping frame!
Pos: 4.2s 112f ( 2%) 12.96fps Trem: 5min 19mb A-V:0.016 [781:192]
This point it stops skipping frames and continues encoding without any problem, but these skipped frames curse the whole video.
Funny if I do the transcoding with the -nosound option, it won't skip any frames, so the video part is handled correctly.
Moreover, if I encode only the audio stream using the
-ovc frameno method it does skip frames, so the problem is with reading the first few audio frames. The skip problem is there even if I simply copy the audio stream (
-oac copy)!
I tried not converting to 50fps, only applying a deinterlace filter (pp=lb) and keeping it at 25fps. Then it skips half as much frames (2-3), implicitly. This can't be felt so much in the audio-delay, so I don't really have to waste my time with mencoder
-oac copy -ovc copy -audio-delay <something>, but 50fps is very important for some footages of mine.
I tried those alternative audio decoders which mplayer includes and can decode mp2 (-ac ffmp2, -ac mp3), none of them worked correctly.
Under no circumstances want I leave mencoder and use another program to transcode,
and this problem ought to be solved, but I've run out of ideas, this is why I'm asking for your help.
Any ideas?
Thanks a lot, I appreciate it