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
jeregan  
#1 Posted : Wednesday, November 2, 2016 3:35:43 PM(UTC)
jeregan

Rank: Member

Groups: Registered
Joined: 7/14/2016(UTC)
Posts: 23
Location: Canada

Was thanked: 8 time(s) in 2 post(s)
Hi everyone.

While learning vMix, it became clear that users were at risk of making a few mistakes that would cause undesired PTZ camera movement while the camera was Actively going to the Output: here are a few examples:

List of sample inputs:
Input1 = Camera 1 = PTZ camera with no PTZ movement programmed
Input2 = Camera 2 = 2nd PTZ camera with no PTZ movement programmed.
Input3-10 are saved PTZ positions for Camera 1.
Input11-20 are saved PTZ positions for Camera 2.

1. Preprogrammed PTZ setting overwrites adjustments made in preview window.
Camera 2 is up on the active output.
Operator calls up Input 3 in preview, and using the game pad adjusts the PTZ position because the talent is taller than most of the talent and the shot needs ore headroom... so the shot needs adjusting.
Operator then cuts Camera 2 to output, but the PTZ is 'corrected' back to the saved position live... OOOps... looks bad seeing the PTZ movement live, and the guy's head is partially cut off.

2. Accidentally moving active Camera.
The operator/director, etc. has Camera 1 up on the active output.
The operator, forgetting that inputs 3-10 are variations on Camera 1, proceeds to put Input 3 up on preview. Input 3 then shows up on the preview screen and moves the camera. Except since the camera is active, viewers see this camera move to this new saved position live. OOps...


The fix:
With the script in place on shortcuts for each PTZ input, now when the user presses one of the saved PTZ shortcut buttons, instead of just calling up that input, a vbs script is called that does the following:

1. If the camera for the PTZ shot being called is NOT up on the active screen: Put the called input/PTZ shot up on preview and moves the camera to this position, then sleeps for half a second and then changes the input to the default camera shot on input 1 or input 2 (depending in which saved PTZ is called). Now when the operator cuts to the shot after making minor PTZ adjustments in preview, the camera does not move when it is put on the active output

2. If the camera for the PTZ shot being called IS up on the active screen: A big 'X' graphic with a message saying 'Can't auto PTZ - camera active' shows up for 1 second on the preview windows. After one second, the camera that was being asked to move will be put up in preview with no auto PTZ movement while it is still up and active. The user can make adjustments manually using the game pad.

This helped us quite a bit. I have attached of my code with comments in it. You can paste that into a script in the scripting section of vMix and then assign a short cut to call it. Note that because vMix does not currently support command line arguments being fed to the script via shortcuts, you will have to edit the start of the script showing the PTZ movement saved input, the default camera name (the one with no movement programmed), and the input where the user will find the error graphic that goes up on preview... and do this for each saved PTZ shot. If you do wish to call the actual PTZ shot movement and all live, you just select it via the program bus shortcut for that PTZ.

Hope you find this useful. You can probably shrink the code somewhat, but since I don't do a lot of visual basic programming, it was a bit of trial and error.

Jeff

File Attachment(s):
InputXGo-vbs.txt (4kb) downloaded 86 time(s).
jeregan attached the following image(s):
xerr.png (8kb) downloaded 41 time(s).

You cannot view/download attachments. Try to login or register.
thanks 5 users thanked jeregan for this useful post.
JonHall.conp on 2/12/2020(UTC), mtone on 9/9/2020(UTC), avsoundguy on 9/25/2020(UTC), smartinec on 2/9/2021(UTC), PEM on 3/27/2021(UTC)
JonHall.conp  
#2 Posted : Wednesday, February 12, 2020 3:36:59 AM(UTC)
JonHall.conp

Rank: Newbie

Groups: Registered
Joined: 2/12/2020(UTC)
Posts: 6
United States
Location: Florida

Thanks: 2 times
Was thanked: 1 time(s) in 1 post(s)
Brilliant! I've been testing vMix to replace our current system and this type of the solution is the only thing that had us leaning towards another product. Now vMix can be back in the running!

Have you updated your code any in the last few years?
thanks 1 user thanked JonHall.conp for this useful post.
avsoundguy on 9/25/2020(UTC)
mu71rd  
#3 Posted : Saturday, November 21, 2020 4:06:44 AM(UTC)
mu71rd

Rank: Newbie

Groups: Registered
Joined: 11/21/2020(UTC)
Posts: 4
United Kingdom
Location: Guildford

I, too, am evaluating vMix for streaming solutions at a UK Cathedral. With a varied team of operators, I can see situation #2 above being a common problem. With OBS I have worked around it by using visual feedback on Streamdeck buttons (to colour ALL preset buttons for a given camera the preview/program colours - so don't press a RED button).

I like the idea of virtual inputs, all showing their last position as images, but i'm certain that there will be mis-clicks galore. This script sounds great. A couple of questions:

  • does it work? I haven't been able to test it with PTZ cameras yet, so would love to know whether to get to that point.

  • is this something that might be build into vMix in the future? I see the original post is from 2017, so I'm not hopeful, but it strikes me that it would be a very useful function to have


Any input on this would be really valued,

thanks
smartinec  
#4 Posted : Wednesday, February 10, 2021 4:31:23 AM(UTC)
smartinec

Rank: Newbie

Groups: Registered
Joined: 6/5/2020(UTC)
Posts: 8
United States
Location: Pittsburgh

Thanks: 1 times
Was thanked: 4 time(s) in 2 post(s)
I wanted to contribute this back to the community as I made some modifications to make this work with live thumbnail on Elegato Stream Deck (it will still work as normal vMix shortcut also, but without preview). I also modernized the code a little bit and attempted to simplify config.

vMix Setup
  • 1 or more camera inputs with associated PTZ inputs
  • PTZ inputs named like "PTZ - {Camera} {Shot}"
  • Title (or image) input to display for error named "PTZ Error"

Notes
  • I created 2 shortcuts tied to the same stream deck button so that I got the thumbnail preview of the input, but it calls the script when pressed. The "SharpenOff" action is just there as a dummy
  • If not using a stream deck, you will won't need the "SharpenOff" shortcuts.
  • You must manually edit the "camInputName" and "shotName" for each "ScriptStartDynamic" shortcut


Code:
Dim camInputName As String = "Camera Name"
Dim shotName As String = "Shot Name"
Dim ptzInputName As String = "PTZ - " & camInputName & " " & shotName
Dim errInputName As String = "PTZ Error"

Dim doc As New XmlDocument()
doc.LoadXml(API.XML())
Dim activeInputName As String = doc.SelectSingleNode("/vmix/inputs/input[@number='" & doc.SelectSingleNode("/vmix/active").InnerText & "']").InnerText
If activeInputName = camInputName Then
  Input.Find(errInputName).Function("PreviewInput")
  Sleep(1000)
Else
  Input.Find(ptzInputName).Function("PTZMoveToVirtualInputPosition")
End If
Input.Find(camInputName).Function("PreviewInput")


PTZ Error Input.png (19kb) downloaded 2 time(s).

Shortcut Streamdeck Thumbnail.png (66kb) downloaded 3 time(s).

Shortcut ScriptStartDynamic.png (97kb) downloaded 2 time(s).

Shortcut Settings.png (188kb) downloaded 2 time(s).
thanks 3 users thanked smartinec for this useful post.
JonHall.conp on 2/10/2021(UTC), JessShake on 3/12/2021(UTC), PEM on 3/27/2021(UTC)
JonHall.conp  
#5 Posted : Wednesday, February 10, 2021 7:23:26 AM(UTC)
JonHall.conp

Rank: Newbie

Groups: Registered
Joined: 2/12/2020(UTC)
Posts: 6
United States
Location: Florida

Thanks: 2 times
Was thanked: 1 time(s) in 1 post(s)
@smartinec - That looks great! I went a slightly different route with mine, electing to make it a tad more complicated than the original with the addition of a backup camera. However, I've been thinking lately that I'd like to use .Find instead of looping through the xml. I may follow your example to use .Find to make the changes.

Have you worked out how to deal with the active camera in a multiview?
smartinec  
#6 Posted : Wednesday, February 10, 2021 7:48:36 AM(UTC)
smartinec

Rank: Newbie

Groups: Registered
Joined: 6/5/2020(UTC)
Posts: 8
United States
Location: Pittsburgh

Thanks: 1 times
Was thanked: 4 time(s) in 2 post(s)
Originally Posted by: JonHall.conp Go to Quoted Post
Have you worked out how to deal with the active camera in a multiview?

We don't do any multiview, so it wasn't on my radar. Sorry.
mikenor  
#7 Posted : Thursday, February 11, 2021 3:11:20 PM(UTC)
mikenor

Rank: Member

Groups: Registered
Joined: 1/19/2021(UTC)
Posts: 10
Canada

Was thanked: 1 time(s) in 1 post(s)
Originally Posted by: smartinec Go to Quoted Post
Code:
Input.Find(firstInputName).Function("PreviewInput")
Sleep(sleepMs)
Input.Find(camInputName).Function("PreviewInput")
What is the point of putting the Virtual Input into Preview and then replacing it with the real camera input 500 ms later? I don't like arbitrary sleeping. Why not just use the PTZMoveToVirtualInputPosition function? ("Moves to the Position of the PTZ Virtual Input without selecting it into Preview.") Is there some additional behaviour that vMix does when putting the Virtual Input into Preview?
thanks 1 user thanked mikenor for this useful post.
PEM on 3/27/2021(UTC)
smartinec  
#8 Posted : Friday, February 12, 2021 1:29:56 AM(UTC)
smartinec

Rank: Newbie

Groups: Registered
Joined: 6/5/2020(UTC)
Posts: 8
United States
Location: Pittsburgh

Thanks: 1 times
Was thanked: 4 time(s) in 2 post(s)
Originally Posted by: mikenor Go to Quoted Post
Code:
Input.Find(firstInputName).Function("PreviewInput")
Sleep(sleepMs)
Input.Find(camInputName).Function("PreviewInput")
What is the point of putting the Virtual Input into Preview and then replacing it with the real camera input 500 ms later? I don't like arbitrary sleeping. Why not just use the PTZMoveToVirtualInputPosition function? ("Moves to the Position of the PTZ Virtual Input without selecting it into Preview.") Is there some additional behaviour that vMix does when putting the Virtual Input into Preview?


That is a nice optimization. I updated my code above. (Maybe you could present your idea a little more nicely next time.)

thanks 1 user thanked smartinec for this useful post.
PEM on 3/27/2021(UTC)
mikenor  
#9 Posted : Friday, February 12, 2021 11:28:23 AM(UTC)
mikenor

Rank: Member

Groups: Registered
Joined: 1/19/2021(UTC)
Posts: 10
Canada

Was thanked: 1 time(s) in 1 post(s)
Originally Posted by: smartinec Go to Quoted Post
Maybe you could present your idea a little more nicely next time.

Sorry if your feelings got hurt but I wasn't trying to "present an idea" - it was an honest question (hint: abundance of question marks). This is the sub-forum for discussing API usage.

I noticed you were loading the Virtual Input into Preview, so that caused me to wonder if perhaps you were doing so out of necessity in order to achieve some desired vMix behaviour. I'll be working on something similar but hadn't tried yet, so I asked your reason for doing it that way.

Since you interpreted my question as a critique and changed your code, I take it the answer to my question is that it's not necessary to do it that way. ;-)

I'm leaning towards a slightly different approach to the original problem... thinking about multiview-overlaying a tally indicator (e.g. big red X) onto all of the Virtual Inputs whenever the real camera input is active.
DaleH  
#10 Posted : Tuesday, February 23, 2021 2:10:01 AM(UTC)
DaleH

Rank: Newbie

Groups: Registered
Joined: 10/23/2020(UTC)
Posts: 5
Man
United States
Location: PA

Thanks: 1 times
I am finding this quite interesting, but don't have the current skills to do much scripting. We currently use a stinger approach, but don't like the 'cut' transition for the preview to live view. We have two to three PTZ cameras with about 9 views each. Currently using an XKeys keyboard to select the PTZ presets and a trigger to light the active camera position, and would guess the triggers would not need to be adjusted as they are based on output. Is it possible to share the setups in a way that I cam easily adjust?
Thanks.
smartinec  
#11 Posted : Tuesday, February 23, 2021 4:40:32 AM(UTC)
smartinec

Rank: Newbie

Groups: Registered
Joined: 6/5/2020(UTC)
Posts: 8
United States
Location: Pittsburgh

Thanks: 1 times
Was thanked: 4 time(s) in 2 post(s)
Originally Posted by: DaleH Go to Quoted Post
I am finding this quite interesting, but don't have the current skills to do much scripting. We currently use a stinger approach, but don't like the 'cut' transition for the preview to live view. We have two to three PTZ cameras with about 9 views each. Currently using an XKeys keyboard to select the PTZ presets and a trigger to light the active camera position, and would guess the triggers would not need to be adjusted as they are based on output. Is it possible to share the setups in a way that I cam easily adjust?
Thanks.


I tried to lay it out in my post above: #post88678

Let me know if you have specific implementation questions that I can answer.
JessShake  
#12 Posted : Friday, March 12, 2021 2:22:45 AM(UTC)
JessShake

Rank: Newbie

Groups: Registered
Joined: 2/9/2021(UTC)
Posts: 7
United States
Location: Oklahoma

Thanks: 1 times
@smartinec THANK YOU. Super helpful! This has solved a HUGE headache for me.
PEM  
#13 Posted : Saturday, March 27, 2021 12:42:11 AM(UTC)
PEM

Rank: Newbie

Groups: Registered
Joined: 3/26/2021(UTC)
Posts: 1
France
Location: Paris

Thanks: 4 times
Hello,

Your scripts are great.
I don't have your scripting skills but wouldn't it be possible to have it all in one script (instead of a script in each shortcut) ?
And to refer at the first post of this thread : When you call back your PTZ shot in Preview, that you do some adjustement, would't it be possible to update the PTZ input ?

Thanks
smartinec  
#14 Posted : Saturday, March 27, 2021 12:51:34 AM(UTC)
smartinec

Rank: Newbie

Groups: Registered
Joined: 6/5/2020(UTC)
Posts: 8
United States
Location: Pittsburgh

Thanks: 1 times
Was thanked: 4 time(s) in 2 post(s)
Originally Posted by: PEM Go to Quoted Post
wouldn't it be possible to have it all in one script (instead of a script in each shortcut) ?

I couldn't figure out a way to make it a single script since vMix doesn't pass in any variables. You only need 1 script per shot if you aren't using a Stream Deck.

Originally Posted by: PEM Go to Quoted Post
When you call back your PTZ shot in Preview, that you do some adjustement, would't it be possible to update the PTZ input ?

I ended up adding separate buttons to update each shot. I also made it so cam adjustments to preview are fast speed and PTZ adjustments to output use a slow speed.

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.