Log in

View Full Version : Frames Not Accurate to .avs File


Antoids
13th February 2013, 04:00
Hi there. I'm trying to edit a video in VirtualDub, and I'm using the Layer command to do picture-in-picture in a few places.

However, the frames I specify to do the picture-in-picture are sometimes off by quite a bit. For example, the Trim at 125402 shows up at 124471. Additionally,
the loss picture in picture shows up at 32069 frames instead of 33000. Some of the other ones show up at exactly the right spots, by contrast. Is there a simple
explanation for what's going wrong that I'm unaware of?

video=AviSource("1.avi") ++ AviSource("2.avi") ++ AviSource("3.avi") ++ AviSource("4.avi") ++ AviSource("5.avi") ++
AviSource("6.avi") ++ AviSource("7.avi") ++ AviSource("8.avi") ++ AviSource("9.avi") ++ AviSource("10.avi") ++
AviSource("11.avi") ++ AviSource("12.avi") ++ AviSource("13.avi") ++ AviSource("14.avi") ++ AviSource("15.avi") ++
AviSource("16.avi")
butts=AviSource("butts.avi").ConvertToRGB32()
loss=AviSource("loss2.avi").ConvertToRGB32()
video.ConverttoRGB32()
video
Trim(931,32999) ++ Trim(33000,34569).Layer(loss,"add",256,0,0) ++ Trim(34570, 105827) ++ Trim(105828,106008).
Layer(butts,"add",256,480,96) ++ Trim(106009,125401) ++ Trim(125402,125546).Layer(butts,"add",256,480,96).
FadeOut(2) ++ Trim(125547,129827) ++ Trim(129828,129930).Layer(butts,"add",256,480,96).
FadeOut(2) ++ Trim(129931,139757) ++ Trim(139758,139860).Layer(butts,"add",256,480,96).
FadeOut(2) ++ Trim(139861,197510) ++ Trim(197511,197834).Layer(butts,"add",256,480,96).
FadeOut(2) ++ Trim(197835,0)
TextSub("butt.ass")

My apologies for the long horizontal code. I pasted it as-is so that any errors on my part would be as-is. If there's some etiquette to prevent all that scrolling I would be happy to edit my code segment.

cretindesalpes
13th February 2013, 07:48
AviSource is not guaranteed to be frame-accurate. Try FFVideoSource("file.avi") instead, or FFmpegSource2("file.avi", atrack=-1) if you need the audio track too. Because you have a lot of sources, you may need to add the threads=1 argument to reduce the resource usage in the FFthings.

Gavino
13th February 2013, 11:52
the frames I specify to do the picture-in-picture are sometimes off by quite a bit. For example, the Trim at 125402 shows up at 124471. Additionally, the loss picture in picture shows up at 32069 frames instead of 33000. Some of the other ones show up at exactly the right spots, by contrast. Is there a simple explanation for what's going wrong that I'm unaware of?
...
Trim(931,32999) ++ Trim(33000,34569).Layer(loss,"add",256,0,0) ...
Since you start with Trim(931,32999), the first 931 input frames are deleted, so input frame 33000 will correspond to output frame 32069 (=33000-931). Similarly, input frame 125402 will correspond to output frame 124471 (=125402-931).

Note also that each FadeOut() adds an extra blank frame. If you don't want that, use FadeOut0() instead.

As far as I am aware, AviSource should be frame-accurate - it is DirectShowSource that is not always accurate.