Log in

View Full Version : Mpegsource vs. framecount


Guest
19th October 2004, 16:05
Hi,

I'm trying to trim a mpeg videofile, so I only have the last frame left.
video = mpegsource("G:\test.m2v")
fc=framecount(video)
vtrim = Trim(video,fc-1,fc)
vtrim
This gives me an access violation error. Is it because framecount isn't precise enough when it comes to mpeg files(I have no problem doing the same with avi's)- and the trim start value is later than than actual last frame?

Tin2tin

Mug Funky
19th October 2004, 16:49
here's the same script cleaned up a little:

mpegsource("G:\test.m2v")
fc=last.framecount()
Trim(fc-1,fc)

which version of avisynth are you using? which mpegDecoder?

if you want a more precise frame count, use DGdecode and generate your d2v files with DGindex (which is basically the same as mpeg2source and DVD2AVI but with a couple of fixes that makes it return the correct number of frames).

Guest
20th October 2004, 09:41
Hi Mug Funky,

I got it to work with this:

MPEGDecoder (http://forum.doom9.org/showthread.php?threadid=80641)

The older one throws the error at me with your code too, but with the new one it works fine.

Thanks.
Tin2tin

Mug Funky
21st October 2004, 05:31
yeah - it would throw an error... it's the exact same script in fewer words :)

however, i'd recommend DGdecode anyway, as there's a few flaws in the d2v format and DVD2AVI (from which MPEGdecoder is based, amoung other things) that lead to losing a couple of frames at the start and end.

Nic is working on incorporating these changes into MPEGdecoder as well, but they're not in there yet (and there's weird behaviour with random seeking and field-order, at least with NTSC Lain)

Guest
21st October 2004, 10:21
there's a few flaws in the d2v format and DVD2AVI (from which MPEGdecoder is based, amoung other things) that lead to losing a couple of frames at the start and end.Arh, that explains why I can't load a file with a length of one frame.

Thanks.
Tin2tin