nrkno / sofie-atem-connection

Sofie ATEM Connection: A Part of the Sofie TV Studio Automation System
https://github.com/nrkno/Sofie-TV-automation/
MIT License
129 stars 36 forks source link

Add support for camera control #85

Open GarthDB opened 4 years ago

GarthDB commented 4 years ago

I'm trying to dig into the Blackmagic Developer documentation and all I can see in the manual are the SDI camera control docs, however, the ATEM software now can control cameras over HDMI (BMPCC 4K, etc). I'm wondering if it is possible to add camera control support to this package.

I'll try throwing some commands at my ATEM Mini connected to a BMPCC 4K and see if I can get anything to work.

I would like the feature if possible. It would be so handy to do simple things like autofocus over a network command.

Julusian commented 4 years ago

This is not something we are likely to implement any time soon, as it could take a bit of work to interpret everything correctly and we dont have any blackmagic cameras to test it with. However we will happily accept a pr if you want to give it a go. I remember seeing https://github.com/haydendonald/blackmagic-atem-nodered/blob/master/commands/cameraControl.js the other day, which could serve as a good reference/starting point

GarthDB commented 4 years ago

Excellent. Thanks. I’m curious if the api for hdmi and sdi cameras/stems are the same.

Julusian commented 4 years ago

It is unlikely for them to be different, except for in small areas if they have different functionality

Julusian commented 4 years ago

I have recently been playing around with this in my C# library which has some unit tests, so it should be fairly straightforward to port to typescript. https://github.com/LibAtem/LibAtem/tree/master/LibAtem/Commands/CameraControl https://github.com/LibAtem/LibAtem/blob/master/LibAtem.State/Util/CameraControlUtil.cs#L45

nitsuj102284 commented 3 years ago

Hi, @Julusian, have you had any progress with porting your code to TS? We would like to get camera control data from the ATEM.

Julusian commented 3 years ago

No, I havent done anything on this. I dont expect to have the time for a couple of months

nitsuj102284 commented 3 years ago

@Julusian, are those the only files that had to be added to get the camera control data in your C# library? Assuming that the same could be added for TS.

Julusian commented 3 years ago

@nitsuj102284 There is also https://github.com/LibAtem/LibAtem/blob/master/LibAtem.State/CameraControllerState.cs and https://github.com/LibAtem/LibAtem/blob/master/LibAtem.State/Builder/CameraControllerUpdater.cs which are quite simple. But yes, if you compare some of the other commands between the two libraries that should give a reference for how to go about porting it. Unfortunately camera control is a quite annoying one to work with due to how it encodes the data, and the meaning of the enums was quite a bit of guesswork..

haydendonald commented 3 years ago

This is not something we are likely to implement any time soon, as it could take a bit of work to interpret everything correctly and we dont have any blackmagic cameras to test it with. However we will happily accept a pr if you want to give it a go. I remember seeing https://github.com/haydendonald/blackmagic-atem-nodered/blob/master/commands/cameraControl.js the other day, which could serve as a good reference/starting point

Haha that's my own project :) (I am aiming to move away from development of the specifics of that project) I can do a PR to add the feature.

Is there any documents on how to add the feature to this project?

Julusian commented 3 years ago

@haydendonald I have written up a bit of a guide on how to write commands for this library https://github.com/nrkno/tv-automation-atem-connection/blob/master/.github/CONTRIBUTING.md#api-stability

Let me know if anything is lacking or needs clarifying, I have probably overlooked something or am forgetting bits which are obvious to me :)

nitsuj102284 commented 3 years ago

This is not something we are likely to implement any time soon, as it could take a bit of work to interpret everything correctly and we dont have any blackmagic cameras to test it with. However we will happily accept a pr if you want to give it a go. I remember seeing https://github.com/haydendonald/blackmagic-atem-nodered/blob/master/commands/cameraControl.js the other day, which could serve as a good reference/starting point

Haha that's my own project :) (I am aiming to move away from development of the specifics of that project) I can do a PR to add the feature.

Is there any documents on how to add the feature to this project?

@haydendonald, have you had any progress on adding the feature?

haydendonald commented 3 years ago

This is not something we are likely to implement any time soon, as it could take a bit of work to interpret everything correctly and we dont have any blackmagic cameras to test it with. However we will happily accept a pr if you want to give it a go. I remember seeing https://github.com/haydendonald/blackmagic-atem-nodered/blob/master/commands/cameraControl.js the other day, which could serve as a good reference/starting point

Haha that's my own project :) (I am aiming to move away from development of the specifics of that project) I can do a PR to add the feature. Is there any documents on how to add the feature to this project?

@haydendonald, have you had any progress on adding the feature?

I have had some success but have not been able to test/implement all the features. I'll do a pull request but i'm not sure if it's good enough as features are not fully/correctly implemented and there may be bugs. (We are currently using it for a CCU and switcher)

You can grab it on my git as i forked it.

nitsuj102284 commented 3 years ago

@haydendonald Great news! Will this also get camera control values from the ATEM. For instance, using the ATEM camera control panel or ATEM software control to change iris, etc. Does your pull request have an event to receive those changes?

rohanwright commented 1 year ago

Theres a merge waiting that would help with this but it has been waiting, how can we get it moved along?

gavalierm commented 1 year ago

+1

Julusian commented 7 months ago

I have just published a library which extends this one to provide camera control functionality https://www.npmjs.com/package/@atem-connection/camera-control

I decided to make this a separate library for now, as I am uncertain how 'final' the types and implementation is. Once it is proven to be complete and to not need any large overhauls, I will consider trying to get it merged back into here.

Let me know how you get on with it, report any issues or anything that feels/looks/seems wrong at https://github.com/julusian/atem-connection-camera-control

It doesn't cover 100% of what the sdk docs say can be done, but as far as I can tell it covers everything that the camera I have supports, so it is all that I can be confident in.

gavalierm commented 7 months ago

@Julusian thank you. Looks very promising.

If you remember - somewere i asked for HEX payload messages, because i was working on this project

https://github.com/gavalierm/btbm-tally

It is BLE - WIFI proxy bridge to forward all BLE CCU data from BLE to WIFI endpoint. And with ATEM CCU messages (in raw format) it can be very usefull i think.

I will try how it goes.