logo

Live Production Software Forums


Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
admin  
#1 Posted : Monday, June 15, 2015 1:56:45 AM(UTC)
admin

Rank: Administration

Groups: Administrators
Joined: 1/13/2010(UTC)
Posts: 5,131
Man
Location: Gold Coast, Australia

Was thanked: 4132 time(s) in 1486 post(s)
Hi,

I am looking at adding scripting / macro features to the Shortcuts in vMix 16.
For example, the following script could be assigned to a key on the keyboard:

Code:
Input("video.mp4").Cut
Input("title.xaml").SetText("Playing video on Input 1")
Overlay(1).In("title.xaml")
Sleep(2000)
Overlay(1).Out()
Input("video.mp4").WaitForCompletion()
API.Function("Fade")


In this example, the following takes place:

1. Cut to the input with name video.mp4
2. Set the text on the first field of the title.xaml input to "Playing video on Input 1"
3. Fade in Overlay 1 with Title.xaml input
4. Wait 2 seconds
5. Fade out Overlay 1
6. Wait for the input with name video.mp4 to finish
7. Fade to preview

This example is a relatively simple line by line script, but many standard programming techniques will be available
as well including loops, math and the ability to run external programs and download data from the web.

So with that in mind I am interesting in hearing some of the ways people would like to use this
feature so I can make sure many of them work on day 1.

Thanks,

Martin
vMix
thanks 2 users thanked admin for this useful post.
Ernest Król on 6/16/2015(UTC), madness on 6/18/2015(UTC)
Speegs  
#2 Posted : Tuesday, June 16, 2015 12:01:40 AM(UTC)
Speegs

Rank: Advanced Member

Groups: Registered
Joined: 8/3/2013(UTC)
Posts: 404
Location: Gold Coast, Australia

Thanks: 27 times
Was thanked: 76 time(s) in 58 post(s)
Hello,

Great idea, Martin. I've recently written a script using power shell to do that kind of thing.

I would suggest adding some basic looping ability (for/while sort of thing) maybe to the script/macro language and maybe the ability to read data from Vmix via the API, plus possible other "basic" sources.

EG: Read a CSV.

So you could ultimately do some of the things possible with a language like powershell or vbscript.

Things off the top of my head you may want to do..

WGET or XML Read a URL - with a well written XPath (to adjust a title) based on the result
Read a File
Run a Powershell or Command Prompt in the background (sleeping) to wait for a returned response

So I would see it common to want to trigger something, fetch data, update title and fade it in, or enable the overlay. I'm sure you don't have time to write your own version of Powershell or VBScript, but maybe being able to execute them in a hidden window expecting a basic result would be useful.

A task I'm about to work on is read a title .. if it's set to xxx eg.. a player number, race number. Grab information from a CSV file and update title information.

Therefore you could use your iPad, update the player number and it populates details like name, image or anything you can think of via the API.

Note: I've already shared some powershell stuff working with your API, it's very powerful as it is, but powershell itself has a bit of a learning curve and something simpler for every day scripting would be very handy.

Regards,

Speegs
Damn2Good4U  
#3 Posted : Tuesday, June 16, 2015 2:00:18 AM(UTC)
Damn2Good4U

Rank: Advanced Member

Groups: Registered
Joined: 2/26/2013(UTC)
Posts: 373
Man
Location: London

Thanks: 41 times
Was thanked: 37 time(s) in 36 post(s)
If i am not mistaken, I think this will or should work well with vMix Scheduler that uses mostly inputs and functionality just as you described...

kgoodyer  
#4 Posted : Wednesday, June 17, 2015 8:07:08 PM(UTC)
kgoodyer

Rank: Advanced Member

Groups: Registered
Joined: 6/16/2015(UTC)
Posts: 193
Man
United Kingdom
Location: Milton Keynes, UK

Thanks: 10 times
Was thanked: 53 time(s) in 27 post(s)
Martin

I went through this process with an early competitor of yours 10 years or so ago. I see you have already considered using a sleep command so that a lower third or some such device can be triggered say 2000ms after another event, in may similar systems there is a 'after' and 'before' method, so that you can trigger events relative to the end of a playing clip. This is especially useful when you have clips who's content changes duration (i.e opening news intro, where the the headline clips duration change every for bulletin, but you need to keep video and CG in sync.

Something Like this.....

Input("video.mp4").Cut

Overlay(1).In("title.xaml") <<shows opening titles
After(2000) <<2000ms delay
Overlay(1).Out() <<hide opening titles

Before (2000) <<2000ms before the end of the video file
Overlay(1).In("credits.xaml") <<shows closing credits 2000ms before the video file stops playing

Input("video.mp4").WaitForCompletion()
Overlay(1).Out() <<hide closing credits

API.Function("Fade")

Keith
thanks 3 users thanked kgoodyer for this useful post.
madness on 6/18/2015(UTC), thomas on 7/4/2015(UTC), studiodelta on 4/26/2021(UTC)
r@wisla  
#5 Posted : Thursday, June 18, 2015 3:57:53 AM(UTC)
r@wisla

Rank: Advanced Member

Groups: Registered
Joined: 8/5/2013(UTC)
Posts: 280
Man
Location: Poland

Thanks: 29 times
Was thanked: 40 time(s) in 37 post(s)
This is going to be awesome feature!

Its very important that the script could read value of fields and use it later.

My simple example.
I have a scoreboard.xml with a build in graphic, that represent number of fouls. I wan't to change it "+1 way". So, if there is foul0.png and I click the shortcut button it changes to foul1.png. So, the script should read this 0 from the filename and change it.

Or, we can have a text field representing fouls (team1_fouls_txt), that is not shown (it could be placed outside our screen). The script:
- SetText scoreboard.xml team1_fouls_txt to +=1
- Read scoreboard.xml team1_fouls_txt value
- SetImage scoreboard.xml team1_fouls_image to image[team1_fouls_txt value].png

richardgatarski  
#6 Posted : Wednesday, June 24, 2015 2:41:57 AM(UTC)
richardgatarski

Rank: Advanced Member

Groups: Registered
Joined: 2/18/2014(UTC)
Posts: 1,808
Location: Stockholm

Thanks: 137 times
Was thanked: 292 time(s) in 246 post(s)
This is really good news!

To the above suggestions concerning inspiration from other languages, I would like to add http://ahkscript.org. It is open source, and perhaps you could implement it inside vMix, and just add the particular vMix functionality.

Also, it would be nice with some trigger/interrupt functionality. For example, for auto turning off an overlay:
On.Overlay(1) Sleep(5000) Overlay(1).Off

I also join those who ask for the possibility to import (and export) data from/to files.

But, I also realise that it is a tricky task to balance between a decent macro functionality and a full fledged language implementation.
thanks 1 user thanked richardgatarski for this useful post.
madness on 6/25/2015(UTC)
Speegs  
#7 Posted : Wednesday, June 24, 2015 8:12:39 PM(UTC)
Speegs

Rank: Advanced Member

Groups: Registered
Joined: 8/3/2013(UTC)
Posts: 404
Location: Gold Coast, Australia

Thanks: 27 times
Was thanked: 76 time(s) in 58 post(s)
Damn2Good4U wrote:
If i am not mistaken, I think this will or should work well with vMix Scheduler that uses mostly inputs and functionality just as you described...


I checked into that, I couldn't figure out how to trigger and event that wasn't time based (most likely because the product is a scheduler). Has some nice features for what it was intended to do, perform actions based on what your computer's clock is doing.

For example do actions x y z after action a, but not while action b is happening. There is certainly a place for a scripting language for vmix.
madness  
#8 Posted : Thursday, June 25, 2015 10:34:23 AM(UTC)
madness

Rank: Advanced Member

Groups: Registered
Joined: 4/16/2013(UTC)
Posts: 406
Man
Location: Iowa

Thanks: 281 times
Was thanked: 32 time(s) in 29 post(s)
I 2nd the AHK script support! Autohotkey is excellent open source scripting software.
admin  
#9 Posted : Thursday, June 25, 2015 11:56:43 AM(UTC)
admin

Rank: Administration

Groups: Administrators
Joined: 1/13/2010(UTC)
Posts: 5,131
Man
Location: Gold Coast, Australia

Was thanked: 4132 time(s) in 1486 post(s)
Hi,

For keyboard macros and automation, continue to use Autohotkey as it is a good product and doesn't really
require integration in vMix to work.

What I am focused on here is scripting capabilities, which is a list of code that can be activated when a keyboard
button is pressed, or a trigger occurs.

The scripting will be based on VB.NET which is extremely powerful.

Regards,

Martin
vMix
thanks 1 user thanked admin for this useful post.
madness on 7/7/2015(UTC)
jip  
#10 Posted : Saturday, July 4, 2015 5:56:15 AM(UTC)
jip

Rank: Advanced Member

Groups: Registered
Joined: 7/23/2013(UTC)
Posts: 122
Estonia
Location: North

Thanks: 12 times
Was thanked: 13 time(s) in 11 post(s)
admin wrote:
Hi,

So with that in mind I am interesting in hearing some of the ways people would like to use this
feature so I can make sure many of them work on day 1.


This would be truly awesome.

For one, I would probably use this to automate Replay compilations, for example: Key press "F1" triggers

* Play all items in Events 3
* Fade sound input volume to 0
* Fade Music playlist volume to 100
* Change replay multiview 1 to input x
* turn off overlays
* wait until last item is finished
* Fade music volume to 0
* Fade in sound input to 100
* Null replay multiview 1
* Enable overlay x
* Move all Replay items from Events 3 to Events 4

I know nearly all this could be chained with current shortcuts into one key press, but it looks really messy.
Braunschweiger  
#11 Posted : Wednesday, July 8, 2015 10:07:18 PM(UTC)
Braunschweiger

Rank: Newbie

Groups: Registered
Joined: 6/29/2015(UTC)
Posts: 5
Location: Leipzig

This is especially useful when you have clips who's content changes duration (i.e opening news intro, where the the headline clips duration change every for bulletin, but you need to keep video and CG in sync.







displayschutzfolie galaxy j5
ProSonas  
#12 Posted : Monday, January 7, 2019 6:18:55 PM(UTC)
ProSonas

Rank: Advanced Member

Groups: Registered
Joined: 12/3/2018(UTC)
Posts: 57
Man
Denmark
Location: Vejle

Thanks: 49 times
Was thanked: 1 time(s) in 1 post(s)
I'd like to dive more into scripting.

It seems I cannot find much information neither here in the help-section or in vMix videos.

Is there somewhere to look for specific syntaxes and examples ?
thanks 1 user thanked ProSonas for this useful post.
jelutalica on 1/7/2019(UTC)
DMack  
#13 Posted : Tuesday, June 30, 2020 8:14:24 AM(UTC)
DMack

Rank: Member

Groups: Registered
Joined: 6/11/2020(UTC)
Posts: 11
United States
Location: San Francisco

I have searched a lot of places but never found much in the way of examples of scripts people use so I am using this post as a starting point.


I use this script to be sure the audio input is turned on and the level set correctly every time a music clip is played. You save this as a script in vMix, assign it to a button. Then on the button you use to play your music clip you add the second button to the original shortcut on the advanced tab. The button plays the music and thescript turns on the input ans sets the level.

Function=AudioOn&Input=MusicClipNameHere.mp3&Value=setvolume&Index=80
Function=SetVolume&Input=MusicClipNameHere.mp3&Value=75


This script does the opposite. It fades the music out, waits for the fade to happen, then turns off the music input and sets the music clip back to the beginning. This script can be saved and directly assigned to a button.
Function=SetVolumeFade&Input=MusicClipNameHere.mp3&Value=0,2000
Sleep 2000
Function=AudioOff&Input=MusicClipNameHere.mp3
Function=Pause&Input=MusicClipNameHere.mp3
Function=SetPosition&Input=MusicClipNameHere.mp3

In neither of these situations does the input transition as an input or as an overlay. So the controls needed to be outside the regular triggers. One key press to play music and one to fade it out, turn it off and reset it for next time. Duplicate for multiple music cuts and they will all work automatically.
doggy  
#14 Posted : Tuesday, June 30, 2020 10:03:40 AM(UTC)
doggy

Rank: Advanced Member

Groups: Registered
Joined: 12/27/2012(UTC)
Posts: 5,042
Belgium
Location: Belgium

Thanks: 283 times
Was thanked: 913 time(s) in 752 post(s)
Originally Posted by: DMack Go to Quoted Post
I have searched a lot of places but never found much in the way of examples of scripts people use so I am using this post as a starting point.



hm....

https://forums.vmix.com/...86-Scripting-for-Dummies

Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.