VideoHelp Forum




+ Reply to Thread
Results 1 to 15 of 15
  1. Member
    Join Date
    Jul 2005
    Location
    UK
    Search Comp PM
    I've looked at AVISynth after being recommended in another post I made.
    It looks really good.

    I want to use AVISynth to take a video and cut it into 5 minute chuncks.
    Not sure where to start with what I want to do.
    I've looked at a few scripts: they look scary!
    I was hopoing someone could start me off?
    (Not sure how you handle a video that is 11 minutes long. i.e. you have 2 5 minute chuncks... but how do you then deal with the remaining 1 minute?)

    ALSO: it would be brilliant if i could get a screen snapshot of the begining of every 5 minute chunk.
    (Or is that asking for too much!? Or can I use any other application to give me this?)

    I've also like to do chroma keying: cut out the background.
    The video will be shot on a green screen with good lighting.
    Is AVISynth a good application to use for this?
    (And erm... I'd appreciate any help with starting off a script.)

    ANY help with any of the above would be really appreciated.

    Thanks.


    OM
    Quote Quote  
  2. Member
    Join Date
    May 2001
    Location
    United States
    Search Comp PM
    Use the TRIM command.

    For you, there are 25 frames per second. There are 60 seconds in a minute. You want 5 minutes of video. So this results in a video that is 7500 frames long.

    So,

    VID1=TRIM(0,7499)

    gives you your first 5 minute clip named VID1. Repeat as needed.

    For your screenshot of each video, load the .AVS script into VirtualDub and set the "framing bars" around your first image. Then FILE > IMAGE SEQUENCE will give you the first image.

    As for chroma keying, you could use the LAYER/MASK/OVERLAY command. But here, the trick would be creating the mask. You would need a "Change Color" filter (don't know of one) that would give you black everywhere EXCEPT where there is green, where it would give you white. This filter doesn't seem like it would be too difficult to write. You might want to propose this filter over in the DOOM9 AVISynth Usage forum.
    ICBM target coordinates:
    26° 14' 10.16"N -- 80° 16' 0.91"W
    Quote Quote  
  3. Member gadgetguy's Avatar
    Join Date
    Feb 2002
    Location
    West Mitten, USA
    Search Comp PM
    Here's a doom9 thread on Chroma Key with script sample http://forum.doom9.org/showthread.php?p=991202
    "Shut up Wesley!" -- Captain Jean-Luc Picard
    Buy My Books
    Quote Quote  
  4. Member
    Join Date
    Jul 2005
    Location
    UK
    Search Comp PM
    thanks for the reply.
    can i write a script that has a loop?
    so that i can use it on any video?

    AND: i'm still usure how to deal with the end, as i mentioned in my post.

    if i had a video that was 6 minutes, then i assume i would need to have:

    VID1=TRIM(0,7499)
    VID2=TRIM(7500,8999)

    but this is assuming i know exactly how long my video is??
    what if don't know how long the video is exactly?

    virtualdubmod??
    ok... i'll give that a try.

    i'll definitely try a post on doom9.
    thanks.
    Quote Quote  
  5. Encode the first 5 minutes of video:

    Trim(0,7499)#25x60x5=7500

    http://avisynth.org/index.php?page=Trim

    To save every 5 minutes as a pic:

    SelectEvery(7500,0)
    ImageWriter(file="C:\Path\To\Saved\Images",type="j pg")#Save Folder and image type

    http://avisynth.org/SelectEvery
    http://avisynth.org/ImageWriter

    I don't known how to cut out the background.

    Edit: But gadgetguy does.
    Quote Quote  
  6. Member
    Join Date
    Jul 2005
    Location
    UK
    Search Comp PM
    hey... that is sooo kewl.

    but... can you confirm that the script you gave would give me 2 avi files if i ran it on a film clip that was 6 minutes long (one 5 minute and one 1 minute)?

    similarly for the screen snapshots: would i get 2 screen snapshots?

    gadgetguy?
    is he related to Inspector Gadget (cartoon).
    i'll try sending him a PM.
    thanks.
    Quote Quote  
  7. can i write a script that has a loop?
    so that i can use it on any video?


    Not sure what you have in mind, but the Loop command sounds appropriate:

    http://avisynth.org/index.php?page=Loop

    Start reading:

    http://avisynth.org/
    Quote Quote  
  8. but... can you confirm that the script you gave would give me 2 avi files if i ran it on a film clip that was 6 minutes long (one 5 minute and one 1 minute)?

    I can confirm it won't. It'll give you the first 5 minutes. I think you'll have to set up different scripts for different 5 minute segments. Unless my peers come up with a way to do one save in VDub, but to create multiple videos.

    similarly for the screen snapshots: would i get 2 screen snapshots?

    Yes.
    Quote Quote  
  9. Member
    Join Date
    Jul 2005
    Location
    UK
    Search Comp PM
    guys... thanks for the help.

    gadgetguy: i was trying to find ur username to send a pm... u got ur reply in too fast.
    thanks.

    ok... so from u guys say... i can't have a loop that will then allow me to use the script on any avi file?
    and i would have to make sure i know the exact length to get the last section if the avi was an exact multiple of 7500 frames?
    all of that is still ok.
    but... surely there has to be something out there that will allow for the atuomation of what i want to do?
    Quote Quote  
  10. Member
    Join Date
    Jul 2005
    Location
    UK
    Search Comp PM
    erm actually... one more thing...
    what i need to do after getting the 5 minute chunks is to turn the video into flv files.
    is there anyway i can automate the whole thing and just have one script to do the lot?

    thanks.
    Quote Quote  
  11. Member
    Join Date
    May 2001
    Location
    United States
    Search Comp PM
    You can use the TRIM command to cut your video anyway you want it. Each TRIM segment is basically another video. So (assuming a 20 minute video),

    Code:
    AVISOURCE("YOURVIDEOPATH\YOURVIDEO.AVI")
    
    VID1=TRIM(0,7499)
    VID2=TRIM(7450,14999)
    VID3=TRIM(15000,22499)
    VID4=TRIM(22500,0)      #A "0" at the end means go to the end.
    
    VID1+VID2+VID3+VID4
    will give you your original video. Understanding this, you should be able to create the video sequence that you want. You can also use multiple sources, so a slight modification of the above script:
    Code:
    V1=AVISOURCE("YOURVIDEOPATH\YOURVIDEO1.AVI")
    V2=AVISOURCE("YOURVIDEOPATH\YOURVIDEO2.AVI")
    
    VID1=TRIM(V1,0,7499)
    VID2=TRIM(V1,7450,14999)
    VID3=TRIM(V1,15000,22499)
    VID4=TRIM(V1,22500,0)      
    VID5=TRIM(V2,200,7699)
    VID6=TRIM(V2,10000,17499)
    
    VID1+VID5+VID2+VID3+VID6+VID4
    You can also experiment with simple transititions, such as FADEIN, FADEOUT, FADEIO and DISSOLVE. These are all AVISynth functions.
    ICBM target coordinates:
    26° 14' 10.16"N -- 80° 16' 0.91"W
    Quote Quote  
  12. ok... so from u guys say... i can't have a loop that will then allow me to use the script on any avi file?

    Not the same script, no. The above are just lines from larger scripts which, among other things, open individual videos by name:

    AVISource("C:\Path\To\Video1.avi")#for example

    Each video needs its own script as far as I know.

    and i would have to make sure i know the exact length to get the last section if the avi was an exact multiple of 7500 frames?

    No, if you have a Trim command of:

    Trim(7500,14999)

    but the video is only 10000 frames long, it'll stop at the last frame without expecting the remainder of the 7500 frames. It won't error out or refuse to encode.

    but... surely there has to be something out there that will allow for the atuomation of what i want to do?

    Maybe there is, but I don't know how to do it.

    what i need to do after getting the 5 minute chunks is to turn the video into flv files.
    is there anyway i can automate the whole thing and just have one script to do the lot?


    Someone else can help with FLVs. Maybe there's an FLV encoder that accepts AviSynth script files. I don't know anything about FLVs or how to create them. Sorry.
    Quote Quote  
  13. Member gadgetguy's Avatar
    Join Date
    Feb 2002
    Location
    West Mitten, USA
    Search Comp PM
    I don't understand your goal in splitting a video into 5 minute chunks, but a single script will not out put more than one 5 minute chunk. You could set up a script with variables for the start and end frames that can be called from a batch file that defines the source and start/end frames and output. I've never actually done it, but I've read that variables can be passed to called scripts. Since Avisynth is a frames server you just need to feed the script to a flv encoder to end up with flv files. (Again, something I don't work with).
    "Shut up Wesley!" -- Captain Jean-Luc Picard
    Buy My Books
    Quote Quote  
  14. Member
    Join Date
    May 2001
    Location
    United States
    Search Comp PM
    Originally Posted by gadgetguy
    Since Avisynth is a frame server you just need to feed the script to a flv encoder to end up with flv files. (Again, something I don't work with).
    You could export an AVI file using VirtualDub if you can't find a script-enabled FLV encoder. But you're not being all that clear on what you want to do.
    ICBM target coordinates:
    26° 14' 10.16"N -- 80° 16' 0.91"W
    Quote Quote  
  15. Member
    Join Date
    Jul 2005
    Location
    UK
    Search Comp PM
    guys thanks for all the rep;ies: i've got a few golden nuggets of advice.

    my need: i have a website for a client where they have lots and lots and lots of video of about 60 minutes in length for each video.

    what i normally do is spli up the video into chunck of 5 minutes and play them in a video player i have programmed that allows you to choose which 5 minute chunk you want to see. (each 5 minute chunk has the image of the first fram on it - hence why i needed the images.)

    i assumed that going for a proper streaming service would be too costly.

    so... i'm just using flv files.

    any advice on how i could run my operation better would be appreciated!
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!