[MEncoder-users] Trying to cut at exact frames (-hr-edl-seek etc.)
Oded Shimon
ods15 at ods15.dyndns.org
Sun May 22 21:37:19 CEST 2005
On Sun, May 22, 2005 at 02:15:33PM +0200, Thorsten Pferdek?mper wrote:
> On Friday 20 May 2005 07:09, Oded Shimon wrote:
> > On Thu, May 19, 2005 at 08:55:02PM +0200, Thorsten Pferdek?mper wrote:
> > > Hi,
> > > [...]
> > > Let d be the duration of one frame (i.e. 1/framerate).
> > > Let [a,b] be the frame interval you want to keep. (Starting to count with
> > > 0) Let l be something bigger than the length of the video in seconds Then
> > > you need two entries in the EDL file:
> > > 0.00 a*d 0
> > > b*d l 0
> > >
> > > At least, this works if b is really bigger than a. with a=b, it does not
> > > work. I would have expected, that I will get exactly one frame in this
> > > case, but I get zero frames. With b = a+1, I get two frames (a and b).
> > > So, what does this mean? It simply means that it is impossible to cut out
> > > exactly one frame (or every second frame or something like that). Perhaps
> > > this is not very important and rather academic, but I thought it was
> > > worth to be mentioned.
> >
> > Just a hunch, try 'b = a+0.5'. With 'a = b' You get an error before the
> > encode even starts i assume?
> >
> Hi,
> ok, I did some further tests. I believe that you get 2 frames whenever
> a < b <= a+1
> Here are my test examples:
>
> 1. Without any edl: 1933 frames
>
> 2. Using the following edl
> 0 4 0
> 4 9999 0
> produces a message because of overlapping intervals. It seems that mencoder
> ignores the second line. It skips the first 4 seconds. The output has 1833
> frames. (Btw: frame rate is 25, a=100. This makes the "4".)
>
> 3. Using the edl you suggested:
> 0 4 0
> 4.02 9999 0
> There is no error message, but it creates 2 frames.
>
> 4. The same as 3. with
> 0 4 0
> 4.04 9999 0
>
Oops.
try THIS.
- ods15
-------------- next part --------------
Index: mencoder.c
===================================================================
RCS file: /cvsroot/mplayer/main/mencoder.c,v
retrieving revision 1.282
diff -u -r1.282 mencoder.c
--- mencoder.c 7 May 2005 14:50:14 -0000 1.282
+++ mencoder.c 22 May 2005 19:35:37 -0000
@@ -1568,6 +1568,7 @@
sh_audio_t * sh_audio = d_audio->sh;
sh_video_t * sh_video = demuxer->video ? demuxer->video->sh : NULL;
vf_instance_t * vfilter = sh_video ? sh_video->vfilter : NULL;
+ int done = 0;
if (!sh_video) return 0;
if (sh_video->pts >= next_edl_record->stop_sec) return 1; // nothing to do...
@@ -1610,10 +1611,11 @@
}
}
- if (sh_video->pts >= next_edl_record->stop_sec) {
+ if (done) {
edl_skip = in_size;
if (!framecopy || (sh_video->ds->flags & 1)) return 1;
}
+ if (sh_video->pts >= next_edl_record->stop_sec) done = 1;
if (vfilter) {
int softskip = (vfilter->control(vfilter, VFCTRL_SKIP_NEXT_FRAME, 0) == CONTROL_TRUE);
More information about the MEncoder-users
mailing list