RSVTFYC: How to use vMix Web Scripting.

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
scripting is a powerful feature that allows you to write code that you can execute to perform functions in vmix in this video we'll take a look at why you might use scripts the basics of how to build a script and as always we'll demonstrate a few examples that show some of the advantages firsthand hi i'm heath from vmix welcome to another video from our really specific vmix tutorials from youtube comments series a while back we put a call out to you to provide great ideas for really specific training videos and this particular request has received a lot of support so thanks for putting it forward if you have a vmix topic that you would like us to create a really specific tutorial video on feel free to head on over to that original call out video and add your idea to the comments i'll be sure to put a link to that video in the description now one more thing before we begin the following presentation is a really specific training video and contains content that may be considered advanced for some users and not advanced for other users the feature described in this video is only available in vmix pro 4k and max viewer discretion is advised this video is meant for those that have not jumped into the world of vmix scripting yet but are very familiar with the way that vmix works and more specifically how shortcuts work i'll link a few of our other videos that cover off how vmix and shortcuts work in the description so if you're new to vmix feel free to check those out first and now for those ready to dive into the world of scripting in vmix this video should give you a good foundational understanding of how to write scripts and when they might be worthwhile in your production so as newcomers to scripting let's take a look at some of the first reasons why we might want to add scripts to our vmix production one you can create multiple functions that can be run together from one button press and two you can create a sequence of functions that occur one after the other and you can add pauses along the way so let's look at that first scenario now some of you may be asking well can't you just add multiple shortcuts and use them all with the same button rather than writing code yes you can do that but scripting can be a tidier way to manage your shortcut functions look at this example rather than having five shortcuts tied to the same button and lost within a heap of other shortcuts you can write one script that completes these five shortcut functions and set up just one shortcut to start the script and for scenario number two if i were to set up a handful of shortcuts that all use a single button but i wanted them to happen in sequence with a few pauses at different points i could do this with the help of triggers but only if it's something i want to happen every single time so if i want more flexibility it may be worth creating a single script that runs the sequence only when i want it to run ok there's a few good reasons to use scripts know that vmix supports two scripting languages web scripting and vb.net scripting we'll touch on both but as newcomers we'll be focusing on web scripting in this video so here we are in the vmix interface and you can see that i've already created a basic production that includes my camera with embedded audio a lower third title and a video file i've also set up two overlays the first is a full screen overlay and the second is a picture in picture overlay for the first demonstration let's look at an example of multiple shortcuts that you might have tied to a single button and let's replace them all with just one script we'll head up to settings and from here we go to shortcuts and here you can see that i've got three shortcuts already all using the same key the z key we've got set text which allows me to set specific text for my title we've got overlay input 1 in which will turn on overlay 1 using my title and we've got overlay input 2 in which will turn on overlay 2 using the waterfall video now let's fire off those three shortcuts using the z key here we go well that was a little bit louder than i'd planned but anyway you can see that my title came up and so did the picture-in-picture video all right let's turn off those two overlays return to settings go back to the shortcuts and i'm going to delete these three shortcuts so i'll click on the first one then while holding shift i'll click on the third and i'll click remove there we go they're gone now now let's go over to scripting so that we can replace those three shortcuts with a script so i'll click on add i'll name my script let's call it title waterfall and i'll select to make it a local script by that i mean the script will only operate in this particular preset and if i open a different preset the script won't be there a web script is typically laid out like this where each line is a different operation or task and each task is made up of a series of parameters that we set by stating the parameter type then an equal sign and then the answer to what we want to set the parameter to then we add the end symbol and repeat this same process until all of the parameters for that task are listed different tasks require different parameters there are eight different parameters in vmix well there's kind of nine but i'll explain that a bit later the eight parameters are function duration input selected name selected index value mix and channel we'll cover a good number of these but some of them i'll leave for you to explore on your own as i just mentioned different tasks will require different parameters to be set for example if we're only wanting to turn on overlay 1 with the contents of my title input then we'll need to use the function parameter and the input parameter our first parameter is function and then we type equals and our function is overlay input 1 in then we provide the end symbol to apply our next parameter which is setting out input so i'll type input and then equals and finally the input that we want which is title heath right we can save that and close it and now if we select that new script that we've typed we can test it by pressing the start button so i'll press it now and my title appears there in the background now let's build on this script so we'll click on it we'll go to edit and if you remember the first shortcut that we had in our list of three shortcuts was the function equals set text and the input for that was our title and here are some interesting parameters that we need to set for this particular one so i'll hit end and the first one is called selected name and that in this instance is headline dot text and finally we set the value and in this case it's the text that we want typed in our title which is majestic waterfall and i'll add the number two so that we can see the difference okay the next one was very similar to this previous one function equals overlay input 2 this time in and input equals waterfall which is the name of our waterfall video input now some of you might be wondering how it is that i know what parameters to set for each task and the answer to that is on the vmix website in our help documentation we have a table that shows all of the shortcut functions and all of the parameters that need to be set for each function so for example with this settext function we need to provide the input we need to provide the selected name and the value that we want to write as the text so back here in our script you then might be wondering how is it that i know to set the selected name to headline dot text let me show you that quickly so we'll save this we'll close it down we'll click ok and i'm just going to click here right click and show you the title editor and here you can see that my title text is under the headline.txt section now some titles have even more content than this and they'll have different names so that's why you need that selected name so that you can specify where you're writing the words in your title so we'll close this down we might actually turn that title back off and head back to settings and over to our scripting and let's click on it and let's start it i'll move this out of the way so that we can watch it play let's hit start and there we go we've replicated all of the functions that we had in those three shortcuts previously so we're going to go to the shortcuts and here now's the time to add one shortcut that will trigger that script so i'll click on add i'll go to find and i'll set up a key i'll use the z key again click ok and from here we select the function we can go down to scripting to find the scripting functions and the function is called script start and the value is the name of the script so we called that title waterfall i'll click on ok and now we have a z key linked to start that script so i'll click ok to save it i'll close these both down and now let's give it a shot i'll hit the z key there we go okay we've completed our first multi-function script so now let's take it up a notch and create a sequence of events that do something like this one set my title input content two turn on overlay one with the contents of my title three wait three seconds four turn on overlay two with the contents of my video five also mute my microphone so that i don't accidentally talk over the video six wait two more seconds seven turn off my title on overlay one eight wait for the video to end nine turn off the video on overlay two and ten also unmute my audio so that i can talk again sounds pretty complex but it's 10 lines of code so we'll go up to settings back into scripting click on our script and hit edit now the first two tasks are fine the third task that we wanted was a three second pause now vmix has a very special function for this and it's called sleep now remember a while back i was telling you that there were well there's kind of nine parameters this is that special ninth one it's called sleep and it operates a little bit differently to the other parameters because you don't need the equal sign and it is its own function so you type sleep and then a space and then the amount of time that you want to sleep for or wait for before going to the next function and all we need to do is type sleep and then the length for the sleep and in this case it's 3000 milliseconds which is equivalent to 3 seconds so now we have our first two tasks that will be applied and then we'll wait for three seconds and then the next task will happen after that the next thing that we want to add is to mute my audio now to do that we can click function equals audio off and we need to apply that to input equals my input which is cam heath the next thing that we wanted to do was wait a further two seconds so we'll type sleep and type 2000 this time next we wanted to overlay input 1 out or turn off overlay input 1. so to do that we type function equals overlay input one out and we don't need to apply an input for this because all we're doing is turning it off next is a very special function called function equals wait for completion now the wait for completion command is quite unique because it only really works in scripting it doesn't really have many other functions and yet it's listed in your shortcuts so we're using wait for completion and we're applying that to the video input which is called waterfall so i think you can guess what it does it waits until the video ends and as our second last function we are typing function equals overlay input 2 out to turn off overlay 2 and then finally function equals on and we apply that to my input equals cam p okay so with all of that typed out now we can click save close click ok and now we're ready to fire off our full sequence of 10 events now it's going to mute my audio so i won't be able to talk to you while it happens but here we go i'm going to click the z key right now [Music] and there we go now we have a handful of functions that can run in sequence from the press of a button and they're all easily accessible from a single web script as a special note try to avoid writing scripts that run for long periods of time because once they start it can be messy to stop them if things don't go quite to plan for example if in the script sequence we just created i suddenly needed to share something important and was to manually pause the video then i would have remained on mute because the unmute task hadn't run yet and i would have looked like a bit of a goose okay so that's web scripting now briefly touch on vb.net scripting the key things that you'll need to grasp before getting started here are how to code in the visual basic language vb.net and how to read and understand xml files you'll need to understand xml because that is how vmix outputs its current state when you query it you can take a look at our help file linked below to learn more about the vmix xml file you'll need to know how to code in vb.net because it is far more advanced than just using the parameters that we covered in web scripting vb.net scripting does offer some advantages such as the ability to query the state of something in vmix and then respond accordingly using conditional statements like and or if then else in case however for most productions this level of scripting is simply not needed in fact it can be a real barrier for onboarding other producers because if things go wrong debugging and troubleshooting can be quite difficult on top of that our support team at vmix don't provide technical support for vb.net scripting due to its complex nature but if after hearing all this you're still keen you can always check out our documentation on the vmix.com website and have a good look on our forums for answers and ideas from our active users right oh that's scripting 101 for vmix if you want to know more about vmix scripting or any other vmix related topic you can visit our website at vmix.com to check out our training videos help files and knowledge base articles you can also send us a support request from there and for more complex scripting questions head on over to our forums one thing that i would ask is that you don't seek support in the comments below because it's very hard for us to provide you with good help there and that's it hopefully this video was an insightful springboard into the world of scripting in vmix i'll see you next time [Music] [Music] you
Info
Channel: vMix
Views: 5,618
Rating: undefined out of 5
Keywords: vMix, live streaming software, webcasting, live video production, video switcher, live production software, live streaming
Id: no_WghBVzDE
Channel Id: undefined
Length: 18min 8sec (1088 seconds)
Published: Mon Nov 22 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.