im using sony vegas 11 and i wonder if its possible to have sony vegas perform a couple tasks automatically by running a script or something.
The premise is like this: my media is a video with 4 squares. Each one is outlined by a blue line at a certain moment. The idea is to make an image appear over that square every time that happens. The image lasts exactly the same amount of time the outline does. There is a different image for each square so i place every one of them on different layers.
I guess it must be a script that says something like:
when this portion of the screen is [THIS COLOR] (blue) then add [NAME OF THE MEDIA] onto [LAYER NUMBER] while [IS COLOR]
but ive never made it before. How can i accomplish this?
+ Reply to Thread
Results 1 to 30 of 42
I regularly use custom scripts in Vegas. I never made any from scratch, but have modified some to my liking. Google is your friend:
https://www.google.com/search?q=vegas+scripts&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:e...ient=firefox-aOne man's opinion is another man's toilet paper.......
Google is not useful when you dont know what terms to search like my case. If i knew what script does that i wouldnt have even asked. Also i think my problem is too specific so i really doubt there is a script that does that exactly. Or there is?
Did you try asking in the sony vegas forum ?
Not sure how to do it in vegas with scripting, but it's possible to do in avisynth applying ConditionalFilter(), on each square using a test region comprised of the border (cropped). The conditional could be AverageChromaU() , say greater than 200 if "blue" is the detection color. You can recombine the "squares" back into a 2x2 grid using StackHorizontal/StackVertical
Based on my understanding of what the OP wants, he can do it in Vegas easily enough using animated track masks..
I'm assuming however that he plans to do a lot of them hence the desire for a script. Scripts are created on as needed basis. I learned to edit them years ago by opening them up in notepad and figuring out the general commands. I don't remember them anymore and have no need nor desire to learn them again......One man's opinion is another man's toilet paper.......
Yes, it's easy to do the overlay or using a mask - but the point is an automated detection script, where a certain pixel value is say 0,0,255, or some range where B=200-255 or something if working in RGB. And that pixel value governs say the mask opacity, or luma value white/black to show transparency so the layer above will be shown when the control layer/mask layer is "white" . So if B<200 then return or do something else. Not so easy to do in vegas IMO .
The scripts I use in vegas are more for batching , ease of workflow shortcuts - Not conditional If/Then/Else statements . But I would like to know if it's possible in vegas (I don't think it is)
Maybe this is similar to what the OP want's, I don't know..........
I actually did this in AviUtl, but it would be similar in vegas.One man's opinion is another man's toilet paper.......
But did you use any detection logic, or did you manually keyframe the changes?
From his description , I think this is more like what he had in mind:
Here is an example for 1 quadrant: (It's trivial to extend it for 4 quandrants (just stackhorizontal(), stackvertical() ).
I made a test video "1.avi" which has a blue border on certain frames (xvid/avi) . This is the "input" video
The script detects whenver the detection area (in this case cropped to show the left border) is "blue" or U>200 in YUV , that quadrant is automatically replaced by the specified still image or replacement video
src1=AVISource("1.avi") test1=src1.crop(0,0,-336,0,true) #crop to region of interest for detection area; in this case the left border img1=imagesource("jessica alba.jpg").crop(0,0,0,-15,true).spline36resize(352,352).converttoyv12().assumefps(30000,1001).trim(0,framecount(src1)) conditionalfilter(test1, img1, src1, "AverageChromaU()", "greaterthan", "200")#, show=true)
1.avi is the input video
2.avi is the output video
jessica alba.jpg is the "replacement" image (but you could have used a video instead, or any image)
No...... I used manual key-frames and duplicated them for the red border.
Thanks for that conditional script, I can see where it might be useful for future projects.......One man's opinion is another man's toilet paper.......
If you wanted to detect "red" area of interest you would need to change the conditional (probably "AverageChromaV" greater than some value) would be better . It possible to be more precise as well (e.g greater than, but less than...) or add other conditions
It's possible to do in after effects as well (to have a certain returned pixel value drive other parameters); but NLE's like premiere, vegas , fcp, don't have as an extensive scripting language....so I don't think it' s possible with those.
If you figure it out how to do in vegas, please post.
Why can't you just lay it out as a project, or group of nested projects? Why does it have to be a script?
Whether a border is a certain color, and that should trigger something, is a strange way to approach it. It's like you're trying to train a monkey to grab a banana when a lamp lights, so you test for lamp light and then shock the monkey into taking the banana, but hiding the shock so it looks natural.
Just put the monkey, banana, and light on different tracks and parent/composite whatever result you want. Doesn't that make more sense?
Then "loop" that and substitute other media, and you got yourself a self-running script.
Last edited by budwzr; 20th Jan 2014 at 17:35.
Sadly this topical of the questions posted these days. They make little sense to anyone but the OP. The $64,000 question is, does the OP have what it takes to find the solution....One man's opinion is another man's toilet paper.......
I would prefer to do it all on vegas. I want the script because i must take care of the same task on a weekly basis, so far i have done it manually but im getting fed of it because videos are sometimes like 3 hours long and it takes me almost a week to complete them. The automatized process will save me a lot of time.
To be more specific, i record a skype conversation. As you know, every time someone speaks on skype, their frame is blue outlined. I plan to use that to my advantage. Every time a guy talks a custom frame should appear around him/her. The custom frame is the image i already mentioned.
I tried by asking on the sony vegas forum but i dont even understand how to post there. You have to complete some shitty form i dont care for. I hope one of you guys can help me.
Come on guys, that's a legit question and scenario.. it's not too far fetched
Try to think outside of the box . You might be able to get past these limitations with other methods
e.g you might apply a blue chroma key on a masked duplicate layer (mask outlining the blue border) on a track above. Whenever that border is blue, it will become "transparent" and the replacement border top track will show through to cover up the bottom original track . This might not work if your replacement border is "thicker" than the original.
I don't use skype and I have no clear idea of what you want to do exactly, can you post a before / after example done with your manual method it might help to generate or refine some ideas . From the first description I had in my mind Hollywood Squares type of thing LOL
EDIT: vegas does it a bit differently than other programs:
track 1 : duplicate of clip, with center masked (ie. draw a box in the center with the pen tool - so center where people talk always "shows" and "covers" on top of all other layers)
track 2 : duplicate of clip, use mask generator effect, set to blue. Set compositing mode to multiply (mask).
track 3 : replacement layer
track 4 : original clip [optional]
Note Track 4 really isn't necessary , unless you have other parts not covered by the mask or replacement layer (if there is overlay) - it really depends on how this video or quandrants are arranged
Last edited by poisondeathray; 21st Jan 2014 at 13:42.
Last edited by budwzr; 21st Jan 2014 at 18:52.
Thanks for the video, very interesting but im afraid thats not what i meant. I have a single flat video track. So basically the first problem comes down to whether or not can Vegas detect the presence of a defined color on a given portion of the screen. In case it can, then we can go over to the next step. In case it cant then its pointless to go any further.
I thought you were done with this.............
poisondeathray posted your best option, but you'll need to learn Avisynth. I never used Skype so I don't know how it looks. I made a dumb 4 screen shot to see if it would work and it does. Here is the end result:
.....Now go and learn Avisynth.One man's opinion is another man's toilet paper.......
You can open avs scripts in vegas with avfs, but it's probably easier to do the workaround posted above directly in vegas - did you give it a try ?
It should reduce the time required substantially required since it's "automatic" once it's set up. And once you get the project set up , then you can just swap the video with each time you have a new video (assuming each time you record skype videos, it's the same dimensions, orientation, spacing , color borders, between windows - I'm still flying "blind" here because you haven't posted a before/after example )
Just forget its skype please. Imagine it as something like this
I have a flat avi that looks like this
This media goes to bottom layer. As you see, guy 3 is talking so his frame is outlined in blue as he talks.
I want to put this image on top of that
This image goes on top layer so it looks like this
just keep in mind the other guys talk too constantly and intermittently during half an hour or more. Thats why i need the script so Vegas automatically places the image only when the guy talks.
You would need Rube Goldberg's expertise to make it work
I've seen scripts for things far more complex than this. Come on, there must be something out there.
Forget scripting in vegas, it's not possible to do what you want through vegas' scripting functionality .
The avisynth approach will work
The vegas workaround posted above won't work as is, because the replacement border isn't the same size as the blue border. But there might be other ways to do it in vegas.
If you want help, you should upload a real video, and your real intended replacement border - because there are other intricacies here - for example is there a thin black line border? Does the blue border completely replace the black border when the person is talking ? Is the background "white" ? Is the area around each person "white" ? These things affect how you might do it in vegas alone (and if it can even be done in vegas alone)
The OP is asking a very basic question to start -- can scripting in vegas detect a certain color at a certain point on the screen?
If someone knows it can, please say so. If someone knows that it can't, say so.
If nobody knows whether Vegas scripting can do all this, then the OP's question is not getting answered and people are essentially saying "I really have no idea whether what you're asking about is possible, but I think I know a way to do that's completely different from what you're talking about."
Simply -- does Vegas scripting have the ability to detect what's in the video, or is it, as I've always understood it, a way of saying "do these repetitive, simple actions in an algorithmic way"?
I don't know how to make that particular script for Vegas, but I won't say it can't be done. I've made a few scripts that would only process 60p clips on the timeline and leave others untouched for example.
I too would like to know if Vegas can detect a certain color for processing. I would guess it can, but don't know the correct commands. Anyway Avisynth can do it if you want to go that route.One man's opinion is another man's toilet paper.......
I would assume the scripting could identify clip a clip's external attributes -- framerate, resolution, interlace vs progressive -- but I wouldn't expect it to be deep enough to look at the on-screen content of the video.
For someone with some programming knowhow, perhaps a peek at the Vegas scripting dev kit might get further than all the I-don't-know answers: http://www.sonycreativesoftware.com/download/devkits