-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uploading images to the ATEM Switcher #20
Comments
Hi Terry, I've trying to implement it because of a previous request I've received... with no luck 😢 I tried to use libqatemcontrol as a reference but the switcher I have at hand responds with messages that not fit into It would be very nice from you to submit a pull request if you can do something about it. Thanks!! |
Thanks for the reply. Yes, happy to have a go. Would you also be happy sharing your 'attempted' code - to get me started? Best wishes |
Thanks a lot for the help, Terry! I've just created a new branch for the issue: 20-uploading-images-to-the-atem-switcher and pushed the work in progress commits I had. Basically, I was trying to emulate the libqatemcontrol library. The reason for choosing this one is that in the unofficial reverse engineered BMD protocol You will find this code is not yet ready to be merged into
If you succeed in making this work, we'll do a little cleanup before merging. List of changesI'll go through the list of changes to explain what I changed in each commit: a765ac0 - Scraped new command IDs from wireshark-atem-dissector / libqatemcontrolIn this commit I could get a few unknown command names from libqatemcontrol and wireshark-atem-dissector. PyATEMMax/ATEMProtocol.pyNo useful code added, just nice descriptions for commands that won't be processed (because their message structure is unknown/undocumented). 8ef62a6 - File transfer WIPIn this commit I tried to implement the client/switcher commands that I could see Inside
As an example, to see the payload structure for the PyATEMMax/ATEMProtocol.pyMoved the following commands from the not implemented to the implemented section:
PyATEMMax/ATEMCommandHandlers.pyImplemented the parsing of the switcher side commands (notifications to the client):
PyATEMMax/ATEMSetterMethods.pyImplemented the construction of the client side commands (requests to the switcher):
65a6318 - TEMPORARY: use events.py to testIn this commit I tried to follow the I'm using the examples/events.py
67bf8ba - Fix names of FTSD/FTSUIt seems I forgot removing the 0b28078 - Add tmp-dev-utils (TEMPORARY)In this commit I upload the utilities I'm using to study the communications with the switcher (see below). The problemIn the
After that, I should wait for a Then, I do a
After that the rest of code is commented, I suppose because the response from the switcher was not the expected at this point. Honestly... I tried this about 6 months ago and some details got lost in the way. The debug toolsFor all these tests, the So, my first attempt was to create a The idea was to use it to record the conversation between the official ATEM client software and the switcher when an image was uploaded, so I could inspect those huge hex streams or even create a log reader to make it a bit easier. The result are huge I would have loved to reuse the parser from the library, but... when starting the project I decided to follow the code structure of the original library to make the porting process easier. A refactor is an option I've been evaluating but I don't have that kind of time right now, so I kind of reprogrammed the ATEM message parsing in the Both utilities are now uploaded to the repo in a The end... and I think that's it ! Sorry for the loooooong answer, but I didn't want to leave anything behind, as you're being so kind to offer your help. Thanks again, and please let me know if you have any doubts. |
Thanks.
I’ll download it, and have a look at it over the next couple of weeks, then I’ll get back to you.
Best wishes
Terry
Professor W T Hewitt
WTH Associates Ltd
Telephone: +44 7905 759 003
Company registration number:7336226
HMRC VAT Registration number: 998 8457 23
Company Registered Address
St George's House | 215 - 219 Chester Road | Manchester | M15 4JE
From: clvLabs ***@***.***>
Sent: 18 August 2022 01:33
To: clvLabs/PyATEMMax ***@***.***>
Cc: Terry Hewitt ***@***.***>; Author ***@***.***>
Subject: Re: [clvLabs/PyATEMMax] Uploading images to the ATEM Switcher (Issue #20)
Thanks a lot for the help, Terry!
I've just created a new branch for the issue: 20-uploading-images-to-the-atem-switcher <https://github.com/clvLabs/PyATEMMax/tree/20-uploading-images-to-the-atem-switcher> and pushed the work in progress commits I had.
Basically, I was trying to emulate the libqatemcontrol <https://github.com/petersimonsson/libqatemcontrol> library. The reason for choosing this one is that in the unofficial reverse engineered BMD protocol <http://skaarhoj.com/fileadmin/BMDPROTOCOL.html> PyATEMMax is based on, Kasper Skårhøj himself recommends it for uploading clips and stills.
You will find this code is not yet ready to be merged into master, even if it worked:
* It has a lot of debug messages (look for [DBG] tags in log messages).
* It has commented code from other libraries inserted as reference when coding.
If you succeed in making this work, we'll do a little cleanup before merging.
List of changes
I'll go through the list of changes <master...20-uploading-images-to-the-atem-switcher> to explain what I changed in each commit:
<a765ac0> a765ac0 - Scraped new command IDs from wireshark-atem-dissector / libqatemcontrol
In this commit I could get a few unknown command names from libqatemcontrol <https://github.com/petersimonsson/libqatemcontrol> and wireshark-atem-dissector <https://github.com/peschuster/wireshark-atem-dissector> .
PyATEMMax/ATEMProtocol.py
No useful code added, just nice descriptions for commands that won't be processed (because their message structure is unknown/undocumented).
<8ef62a6> 8ef62a6 - File transfer WIP
In this commit I tried to implement the client/switcher commands that I could see libqatemcontrol using for its file transfers.
Inside libqatemcontrol:
* qatemconnection.cpp <https://github.com/petersimonsson/libqatemcontrol/blob/master/qatemconnection.cpp> contains the code generating the command packets.
* qatemuploader.cpp <https://github.com/petersimonsson/libqatemcontrol/blob/master/example/qatemuploader/qatemuploader.cpp> is an example which supposedly uploads images to an ATEM switcher (didn't compile/try it myself).
As an example, to see the payload structure for the FTSU (Data Transfer Request) command I found a requestData() method in QAtemConnection which filled the command fields, revealing the packet structure (see requestData() code <https://github.com/petersimonsson/libqatemcontrol/blob/252b0319fabf291a90d791bddc7619c2ebf0b095/qatemconnection.cpp#L1496> ).
PyATEMMax/ATEMProtocol.py
Moved the following commands from the not implemented to the implemented section:
* LKST: Lock State
* PLCK: Acquire Media Lock
* LKOB: Lock Obtained
* LOCK: Set Lock State
* FTDE: Data Transfer Error
* FTUA: Data Transfer Ack
* RXMS: HyperDeck Settings Get
PyATEMMax/ATEMCommandHandlers.py
Implemented the parsing of the switcher side commands (notifications to the client):
* LKST: Lock State
* LKOB: Lock Obtained
* FTDE: Data Transfer Error
* FTUA: Data Transfer Ack
* RXMS: HyperDeck Settings Get
PyATEMMax/ATEMSetterMethods.py
Implemented the construction of the client side commands (requests to the switcher):
* LOCK: Set Lock State
* PLCK: Acquire Media Lock
* FTSU: Data Transfer Request (ooops! fixed in <67bf8ba> 67bf8ba)
* FTSD: Data Transfer to Switcher (ooops! fixed in <67bf8ba> 67bf8ba)
<65a6318> 65a6318 - TEMPORARY: use events.py to test
In this commit I tried to follow the qatemuploader example using the new commands (sadly, with no luck).
I'm using the events.py library example as a temporary placeholder for the test code, it will be restored to its original state before merging.
examples/events.py
* Activated DEBUG log level both for the library and the socket communication, to get as much log info as possible.
* Printed some values received from the switcher as soon the connection is established.
* Tried to initiate a data transfer.
* Trouble started here... explained below.
<67bf8ba> 67bf8ba - Fix names of FTSD/FTSU
It seems I forgot removing the Not implemented text from FTSU/FTSD and I found out while writing this text. This commit fixes that :)
<0b28078> 0b28078 - Add tmp-dev-utils (TEMPORARY)
In this commit I upload the utilities I'm using to study the communications with the switcher (see below).
The problem
In the events.py example, I first try a sendAcquireMediaLock() with:
* storeId: 0
* index: 2.
After that, I should wait for a LKOB or LKST but I'm getting away with a time.sleep(1) because I can see hex logs ;)
Then, I do a sendInitDownloadToSwitcherRequest() with:
* transferId: 0
* storeId: 0
* index: 2
* data_size: 100
After that the rest of code is commented, I suppose because the response from the switcher was not the expected at this point. Honestly... I tried this about 6 months ago and some details got lost in the way.
The debug tools
For all these tests, the stdout hex dump offered by the DEBUG logging activated in 65a6318 was not enough. I soon found myself pausing the console output to wrap my head around a stream of hex representations of messages to understand what was happening, and you know that's not good for human brains :)
So, my first attempt was to create a switcher-spy, some kind of proxy with the ability to capture the traffic between a client and a switcher and save it to a log file.
The idea was to use it to record the conversation between the official ATEM client software and the switcher when an image was uploaded, so I could inspect those huge hex streams or even create a log reader to make it a bit easier.
The result are huge jsonl files (see jsonlines.org <https://jsonlines.org/> ) with never-ending lines of brain-killing hex values. A log-reader was mandatory.
I would have loved to reuse the parser from the library, but... when starting the project I decided to follow the code structure of the original library to make the porting process easier. A refactor is an option I've been evaluating but I don't have that kind of time right now, so I kind of reprogrammed the ATEM message parsing in the log-reader.
Both utilities are now uploaded to the repo in a tmp-dev-utils folder that we'll remove before merging (the idea is to release them after that refactor I talked about).
The end
... and I think that's it !
Sorry for the loooooong answer, but I didn't want to leave anything behind, as you're being so kind to offer your help.
Thanks again, and please let me know if you have any doubts.
—
Reply to this email directly, view it on GitHub <#20 (comment)> , or unsubscribe <https://github.com/notifications/unsubscribe-auth/ADX3D45IOQCLBLJTU4BEA3DVZWAENANCNFSM5TTTZ2JA> .
You are receiving this because you authored the thread. <https://github.com/notifications/beacon/ADX3D452DL42V62KQHYPWDLVZWAENA5CNFSM5TTTZ2JKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOJCSO6PI.gif> Message ID: ***@***.*** ***@***.***> >
|
A status update….
I’ve downloaded the code from Github.
Printed out the documentation and the listings I want handy
From qatemconnection.cpp <https://github.com/petersimonsson/libqatemcontrol/blob/master/qatemconnection.cpp> and qatemuploader.cpp <https://github.com/petersimonsson/libqatemcontrol/blob/master/example/qatemuploader/qatemuploader.cpp> figured out and understand the algorithm
Made an UploadTest.py as a development vehicle and eventually a program for examples.
UploadTest works – except the UploadToSwitcher is not doing anything useful yet of course.
These commands need implementing
'FTDa': 'Data Transfer Data',
'FTCD': 'Data Transfer Upload Continue',
'FTDC': 'Data Transfer Completed','
'FTFD': 'Data File Description',
Done _handleFTDC and _handleFTCD but NOT tested either
Other two are ‘output’ only so will be implemented in below functions
So need to implement
* High level routine to Upload image
* SendDataToSwitcher
* flushTransfer Buffer
* initDownloadToSwitcher
* SendFileDescription
Test it all.
Another update in a week or so.
By the way whats your name? can’t keep calling you clvlabs!
Best wishes
Terry
Professor W T Hewitt
WTH Associates Ltd
Telephone: +44 7905 759 003
Company registration number:7336226
HMRC VAT Registration number: 998 8457 23
Company Registered Address
St George's House | 215 - 219 Chester Road | Manchester | M15 4JE
From: clvLabs ***@***.***>
Sent: 18 August 2022 01:33
To: clvLabs/PyATEMMax ***@***.***>
Cc: Terry Hewitt ***@***.***>; Author ***@***.***>
Subject: Re: [clvLabs/PyATEMMax] Uploading images to the ATEM Switcher (Issue #20)
Thanks a lot for the help, Terry!
I've just created a new branch for the issue: 20-uploading-images-to-the-atem-switcher <https://github.com/clvLabs/PyATEMMax/tree/20-uploading-images-to-the-atem-switcher> and pushed the work in progress commits I had.
Basically, I was trying to emulate the libqatemcontrol <https://github.com/petersimonsson/libqatemcontrol> library. The reason for choosing this one is that in the unofficial reverse engineered BMD protocol <http://skaarhoj.com/fileadmin/BMDPROTOCOL.html> PyATEMMax is based on, Kasper Skårhøj himself recommends it for uploading clips and stills.
You will find this code is not yet ready to be merged into master, even if it worked:
* It has a lot of debug messages (look for [DBG] tags in log messages).
* It has commented code from other libraries inserted as reference when coding.
If you succeed in making this work, we'll do a little cleanup before merging.
List of changes
I'll go through the list of changes <master...20-uploading-images-to-the-atem-switcher> to explain what I changed in each commit:
<a765ac0> a765ac0 - Scraped new command IDs from wireshark-atem-dissector / libqatemcontrol
In this commit I could get a few unknown command names from libqatemcontrol <https://github.com/petersimonsson/libqatemcontrol> and wireshark-atem-dissector <https://github.com/peschuster/wireshark-atem-dissector> .
PyATEMMax/ATEMProtocol.py
No useful code added, just nice descriptions for commands that won't be processed (because their message structure is unknown/undocumented).
<8ef62a6> 8ef62a6 - File transfer WIP
In this commit I tried to implement the client/switcher commands that I could see libqatemcontrol using for its file transfers.
Inside libqatemcontrol:
* qatemconnection.cpp <https://github.com/petersimonsson/libqatemcontrol/blob/master/qatemconnection.cpp> contains the code generating the command packets.
* qatemuploader.cpp <https://github.com/petersimonsson/libqatemcontrol/blob/master/example/qatemuploader/qatemuploader.cpp> is an example which supposedly uploads images to an ATEM switcher (didn't compile/try it myself).
As an example, to see the payload structure for the FTSU (Data Transfer Request) command I found a requestData() method in QAtemConnection which filled the command fields, revealing the packet structure (see requestData() code <https://github.com/petersimonsson/libqatemcontrol/blob/252b0319fabf291a90d791bddc7619c2ebf0b095/qatemconnection.cpp#L1496> ).
PyATEMMax/ATEMProtocol.py
Moved the following commands from the not implemented to the implemented section:
* LKST: Lock State
* PLCK: Acquire Media Lock
* LKOB: Lock Obtained
* LOCK: Set Lock State
* FTDE: Data Transfer Error
* FTUA: Data Transfer Ack
* RXMS: HyperDeck Settings Get
PyATEMMax/ATEMCommandHandlers.py
Implemented the parsing of the switcher side commands (notifications to the client):
* LKST: Lock State
* LKOB: Lock Obtained
* FTDE: Data Transfer Error
* FTUA: Data Transfer Ack
* RXMS: HyperDeck Settings Get
PyATEMMax/ATEMSetterMethods.py
Implemented the construction of the client side commands (requests to the switcher):
* LOCK: Set Lock State
* PLCK: Acquire Media Lock
* FTSU: Data Transfer Request (ooops! fixed in <67bf8ba> 67bf8ba)
* FTSD: Data Transfer to Switcher (ooops! fixed in <67bf8ba> 67bf8ba)
<65a6318> 65a6318 - TEMPORARY: use events.py to test
In this commit I tried to follow the qatemuploader example using the new commands (sadly, with no luck).
I'm using the events.py library example as a temporary placeholder for the test code, it will be restored to its original state before merging.
examples/events.py
* Activated DEBUG log level both for the library and the socket communication, to get as much log info as possible.
* Printed some values received from the switcher as soon the connection is established.
* Tried to initiate a data transfer.
* Trouble started here... explained below.
<67bf8ba> 67bf8ba - Fix names of FTSD/FTSU
It seems I forgot removing the Not implemented text from FTSU/FTSD and I found out while writing this text. This commit fixes that :)
<0b28078> 0b28078 - Add tmp-dev-utils (TEMPORARY)
In this commit I upload the utilities I'm using to study the communications with the switcher (see below).
The problem
In the events.py example, I first try a sendAcquireMediaLock() with:
* storeId: 0
* index: 2.
After that, I should wait for a LKOB or LKST but I'm getting away with a time.sleep(1) because I can see hex logs ;)
Then, I do a sendInitDownloadToSwitcherRequest() with:
* transferId: 0
* storeId: 0
* index: 2
* data_size: 100
After that the rest of code is commented, I suppose because the response from the switcher was not the expected at this point. Honestly... I tried this about 6 months ago and some details got lost in the way.
The debug tools
For all these tests, the stdout hex dump offered by the DEBUG logging activated in 65a6318 was not enough. I soon found myself pausing the console output to wrap my head around a stream of hex representations of messages to understand what was happening, and you know that's not good for human brains :)
So, my first attempt was to create a switcher-spy, some kind of proxy with the ability to capture the traffic between a client and a switcher and save it to a log file.
The idea was to use it to record the conversation between the official ATEM client software and the switcher when an image was uploaded, so I could inspect those huge hex streams or even create a log reader to make it a bit easier.
The result are huge jsonl files (see jsonlines.org <https://jsonlines.org/> ) with never-ending lines of brain-killing hex values. A log-reader was mandatory.
I would have loved to reuse the parser from the library, but... when starting the project I decided to follow the code structure of the original library to make the porting process easier. A refactor is an option I've been evaluating but I don't have that kind of time right now, so I kind of reprogrammed the ATEM message parsing in the log-reader.
Both utilities are now uploaded to the repo in a tmp-dev-utils folder that we'll remove before merging (the idea is to release them after that refactor I talked about).
The end
... and I think that's it !
Sorry for the loooooong answer, but I didn't want to leave anything behind, as you're being so kind to offer your help.
Thanks again, and please let me know if you have any doubts.
—
Reply to this email directly, view it on GitHub <#20 (comment)> , or unsubscribe <https://github.com/notifications/unsubscribe-auth/ADX3D45IOQCLBLJTU4BEA3DVZWAENANCNFSM5TTTZ2JA> .
You are receiving this because you authored the thread. <https://github.com/notifications/beacon/ADX3D452DL42V62KQHYPWDLVZWAENA5CNFSM5TTTZ2JKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOJCSO6PI.gif> Message ID: ***@***.*** ***@***.***> >
|
Hi Terry, thanks for the update!! BTW, my name is Tony :) |
Tony,
After that initial spark, I’ve been side tracked, and will be going on holiday in a few days. So I will update you again at the end of September when hopefully I’ve had time to actually do something!
Best wishes
Terry
Professor W T Hewitt
WTH Associates Ltd
Telephone: +44 7905 759 003
Company registration number:7336226
HMRC VAT Registration number: 998 8457 23
Company Registered Address
St George's House | 215 - 219 Chester Road | Manchester | M15 4JE
From: clvLabs ***@***.***>
Sent: 30 August 2022 20:34
To: clvLabs/PyATEMMax ***@***.***>
Cc: Terry Hewitt ***@***.***>; Author ***@***.***>
Subject: Re: [clvLabs/PyATEMMax] Uploading images to the ATEM Switcher (Issue #20)
Hi Terry, thanks for the update!!
BTW, my name is Tony :)
—
Reply to this email directly, view it on GitHub <#20 (comment)> , or unsubscribe <https://github.com/notifications/unsubscribe-auth/ADX3D4ZWEIRO7TEVEDIZJGTV3ZO2TANCNFSM5TTTZ2JA> .
You are receiving this because you authored the thread. <https://github.com/notifications/beacon/ADX3D4ZAHFPS6JSDWL4SAM3V3ZO2TA5CNFSM5TTTZ2JKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOJFYBAMY.gif> Message ID: ***@***.*** ***@***.***> >
|
I have an ATEM Mini and I would like to populate the 20 still images buffer with images.
I can't see a function to upload the image. Have I missed it?
If I haven't I'm happy to have a go and add it to the library.
Best wishes
Terry
The text was updated successfully, but these errors were encountered: