[MPlayer-cygwin] -ss and -endpos not exact

TAJTHY Tamás tajthy at mailbox.hu
Thu Dec 27 00:13:05 CET 2007


Hi,

I made some tests and I don't understand what I got... :-)

1. I have a 12 GB long ffmjpeg encoded file. I want to cut parts from it and
encode them to one mpeg4 file.

2.I made a test on a small chunk. It is one shot: 0:00:02.480 - 0:00:06.760
(determined by VirtualDub). I just added one frame from the previous shot and one
frame from the next one. So the part goes from 0:00:02.440 - 0:00:06.800. This is
04.360 sec/109 frame long. So the 1st frame is the last frame from the previous
shot, then comes the shot itself and the last frame is the 1st frame of the next
shot.

3. I used the following command: 

mencoder.exe -oac copy -ovc copy -ss 2.440 -endpos 4.360 -o xxTest.avi patch.avi

The result seems to be okay. It is 110 frame long. The last frame is empty. If I
convert it to mpeg4 it is perfect.

4. Then I tried to convert to mpeg4 in two passes cutting the small chunk from
the big file like so:

mencoder.exe -oac copy -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=1000:mbd=2:\
mv0:trell:v4mv:cbp:last_pred=3:predia=2:dia=2:vmax_b_frames=2:\
precmp=2:cmp=2:subcmp=2:preme=2:autoaspect=1:aglobal=3:vb_strategy=1:turbo:vpass=1\
 -vf pp=lb,pp7,pullup,softskip,crop=704:560:8:8,hqdn3d=2:1:2,harddup\
 -passlogfile patch.pass -aspect 4/3 -ss 0:00:02.440 -endpos 0:00:04.360\
 -o nul patch.avi

mencoder.exe -oac mp3lame -lameopts vbr=3:mode=1 -ovc lavc\
 -lavcopts vcodec=mpeg4:vbitrate=1000:mbd=2:mv0:trell:v4mv:cbp:last_pred=3:\
predia=2:dia=2:vmax_b_frames=2:precmp=2:cmp=2:subcmp=2:preme=2:autoaspect=1:\
aglobal=3:vpass=2\
 -vf pp=lb,pp7,pullup,softskip,crop=704:560:8:8,hqdn3d=2:1:2,harddup\
 -passlogfile patch.pass -aspect 4/3 -ss 0:00:02.440 -endpos 0:00:04.360\
 -o xTest.avi patch.avi

The result is 113 frame long. The first frame (keyframe) is the second frame (the
1st frame of "the" shot), the second is then last frame of previous frame. Then
cames the shot. And ends with two (why?) frames from the next shot.

5. If I use "-frames 109" instead of -endpos than the result file is really 109
frames long. I have to increase to 113 to have the first frame of the next shot.

So if I use -endpos I have an extra frame (in other case I had 3 extra frames) ,
if I use the exact frame count I loose 4 frames.

Is there a way to cut the film exatly the place I wanted to???

I have only one idea:

(mencoder -oac copy -ovc copy -ss $time1 -endpos $len1 -o - patch.avi;
mencoder -oac copy -ovc copy -ss $time2 -endpos $len2 -o - patch.avi)|
mencoder ... vpass=1 ... -o xTest.avi -

and the same for pass2.

Thanks for Your help!

TT
_____________________________________________________________2 személyes INGYENES korfui útat is nyerhetsz!


More information about the MPlayer-cygwin mailing list