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.
And the console log: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
This point it stops skipping frames and continues encoding without any problem, but these skipped frames curse the whole video.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]
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.
Also tried to variate -skiplimit 0 and -noskip options with no success.
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![]()
+ Reply to Thread
Results 1 to 3 of 3
-
-
First thing to try is using a newer version of mencoder.
http://oss.netfarm.it/mplayer-win32.php
-vop is obsolete, it's -vf now.
not sure about filter order but it's not reverse anymore -
Try -mc 0 -vf harddup, even if it works you will sill get the skip/dupe frame output, so check the actual file.
Similar Threads
-
decoding mpeg video into frames say I,P,B frames
By abeer in forum ProgrammingReplies: 44Last Post: 6th Oct 2012, 08:24 -
mencoder: seeking to frames (or cropping start frames)
By manchurian_candidate in forum LinuxReplies: 3Last Post: 13th Dec 2010, 08:53 -
FLV skips few frames back and forth while playing
By Mylo in forum Video Streaming DownloadingReplies: 3Last Post: 2nd Apr 2009, 21:56 -
Mpeg 2 for Blu-ray audio exports with missing frames at beginning and end.
By jbandy1 in forum EditingReplies: 0Last Post: 21st Jan 2009, 16:34 -
mencoder frames from a folder
By tais in forum Video ConversionReplies: 1Last Post: 23rd Oct 2008, 03:26