PDA

View Full Version : Taking a small sample of an AVI video


Dean C
3rd August 2008, 18:59
I am running a video hosting website and at the moment I'm coding a few scripts that'll make the process of manually adding videos to my site a little easier. All submissions are by myself, so rather than mess around with ffmpeg on my server I want to process the videos on my PC and then just upload them via FTP and my scripts will pick up the new video.

What I am trying to do at the moment is take a 30second clip of the main AVI clip I will be uploading. I have been playing around VirtualDub.video.SetRange but I can't get my head around the offsets in the documentation here:

http://www.virtualdub.org/docs/vdscript.txt

Can anyone provide me with some help :)?

setarip_old
3rd August 2008, 20:20
Hi!

1)Load your original (DivX-compressed or otherwise) .AVI into VirtualDub
2) Set BOTH "Video" and "Audio" to "Direct Stream Copying"
3) Move slider to the starting point of the scene you wish to save as a clip
4) From the "Edit" dropdown menu, select "Go to next keyframe"
5) From the "Edit" dropdown menu, select "Set Selection Start"
6) Move slider to the ending point of the scene you wish to save as a clip
7) From the "Edit" dropdown menu, select "Go to next keyframe"
8) From the "Edit" dropdown menu, select "Set Selection End"
9) Save with a new filename

Dean C
3rd August 2008, 20:22
Thanks for the reply setarip :)! I know how to do it the old fashioned way, but I want to automate the process via a VCF script file.

setarip_old
3rd August 2008, 21:16
What I am trying to do at the moment is take a 30second clip of the main AVI clip I will be uploading.Sorry, I took this statement to be referring to only one clip.

Dean C
3rd August 2008, 21:23
It is one clip at a time :) But I am messing around with audio and filter in the vcf script as well, so I need to take a sample whilst I'm there :)

Dean C
4th August 2008, 22:01
I'm absolutely stumped on this one. I thought I had got it working, but soon as I tried it on another video source it gave me a different length. Any ideas folks?

setarip_old
5th August 2008, 00:26
Do the two video sources have the same (as they likely would have to) framerate?

Dean C
5th August 2008, 03:12
Not necessarily. I've thought of one way of doing it which would involve getting the duration in milliseconds of the avi using some external tool. Then doing SetRange(0, (totalms - GetRange(0) + 60000)) to take a 1min sample from the beginning. Bit of a pain but I plan on testing that tomorrow. An easier way would be nice though :D