Open Gracham opened 9 months ago
Hi, I'm glad you're liking it. 🙂 But be warned - you're going straight for the deep end!
It should be possible to add, but there's no official library. It's all based on reverse engineering by Skaarhoj, and he sadly stopped publishing updates years ago.
I added On Air myself in my copy by coaming through UDP packets with wireshark. Essentially you'd need to do the same. Maybe the Companion module for ATEM switchers has it implemented. If so, it's probably way simpler to look at their code for the right command, and add it here.
Sadly I'm limited on time at the moment, but if you find it I might be able to implement it, or show you where to look.
Thank you for your swift response! I completely understand! I've found some actions related to Recording in companion-module-bmd-atem/src/actions.ts Please correct me if i'm looking at the wrong thing
You're on the right path I think, but you have to get more low level.
Here you see what I added to parse raw streaming status data. https://github.com/AronHetLam/ATEM_tally_light_with_ESP8266/blob/master/libraries/ATEMmin/ATEMmin.cpp#L344-L361 You need to find a four letter string corresponding to ISO recording, and what the following data means.
Now that I'm thinking about it, maybe some recording commands can be found in Skaarhojs other ATEM libraries. He had different sizes with support different commands, so that you could run a smaller one on smaller hardware. Not sure if ISO recording is there. My copy is the smallest one.
Thanks for the tips! I can't find anything deeper related to Recording in bdm-atem repo and -base repo. I'm probably looking in wrong places as im not familiar with that codebase. I'll try looking further but i doubt my code skills.
As for the Skaarhojs repo i'm completely lost where to look due to the repo structure
As a workaround I could try replacing streaming state with one of the streaming error states you've implemented. That way by not filling out stream key I could use on air button and mode to turn on the red light while not putting load on the switcher needlessly
Maybe that could work.
Else this might. https://github.com/nrkno/sofie-atem-connection/tree/master/src%2Fcommands%2FRecording
It's the underlying library used by the Companion module.
Hi there, I've snooped around the code examples and other Atem libraries but im not code savvy enough to get useful serial data out of it. I've managed to find packet that I think corresponds to starting a recording via Wireshark Appears once when record button is pressed
Len=276
0000 18 7e b9 07 f6 93 7c 2e 0d 16 3e 9c 08 00 45 00 .~....|...>...E.
0010 01 30 bf 1f 00 00 ff 11 79 1b c0 a8 00 90 c0 a8 .0......y.......
0020 00 a1 26 b6 e3 74 01 1c e0 f0 89 14 80 82 6d 8f ..&..t........m.
0030 00 00 00 00 0f 4d 00 10 00 00 54 69 6d 65 0a 36 .....M....Time.6
0040 2b 00 00 00 00 54 00 10 4f 00 52 54 4d 53 00 02 +....T..O.RTMS..
0050 35 31 00 00 16 79 00 54 53 54 52 54 4d 44 00 00 51...y.TSTRTMD..
0060 00 00 00 00 16 7a 00 04 41 2d 49 53 4f 2d 44 79 .....z..A-ISO-Dy
0070 73 6b 31 00 53 44 53 52 53 44 00 00 00 00 00 00 sk1.SDSRSD......
0080 00 00 00 10 00 07 53 52 53 54 00 00 00 00 00 cc ......SRST......
0090 00 0b 00 10 17 70 53 52 53 44 00 00 00 00 00 00 .....pSRSD......
00a0 00 00 00 02 f9 00 00 00 16 7b 00 10 1f 42 52 54 .........{...BRT
00b0 4d 53 00 02 00 23 00 00 16 79 00 10 41 2d 52 54 MS...#...y..A-RT
00c0 4d 53 00 02 00 00 00 00 16 7a 00 54 ff ff 52 54 MS.......z.T..RT
00d0 4d 44 00 00 00 00 00 00 16 7a 00 08 41 2d 49 53 MD.......z..A-IS
00e0 4f 2d 44 79 73 6b 31 00 16 79 00 04 41 2d 49 53 O-Dysk1..y..A-IS
00f0 4f 2d 44 79 73 6b 31 00 ff ff ff ff 01 00 00 05 O-Dysk1.........
0100 00 ff ff ff ff ff ff 01 00 00 06 00 ff ff ff ff ................
0110 ff ff 01 00 00 07 00 ff ff ff ff ff ff 01 00 10 ................
0120 08 00 52 54 4d 53 00 03 01 00 00 00 16 7a 00 10 ..RTMS.......z..
0130 ff ff 52 54 4d 53 00 03 00 00 00 00 16 7a ..RTMS.......z
Or? Len=160
0000 18 7e b9 07 f6 93 7c 2e 0d 16 3e 9c 08 00 45 00 .~....|...>...E.
0010 00 bc 05 c9 00 00 ff 11 32 e6 c0 a8 00 90 c0 a8 ........2.......
0020 00 a1 26 b6 e3 74 00 a8 2e c1 08 a0 80 82 00 00 ..&..t..........
0030 00 00 00 00 47 ae 00 10 00 00 54 69 6d 65 0c 1b ....G.....Time..
0040 0a 0d 00 00 00 54 00 10 4f 00 52 54 4d 53 00 02 .....T..O.RTMS..
0050 35 31 00 00 0f bd 00 54 69 65 52 54 4d 44 00 00 51.....TieRTMD..
0060 00 00 00 00 0f bd 00 08 41 2d 49 53 4f 2d 44 79 ........A-ISO-Dy
0070 73 6b 31 00 6e 20 00 06 00 00 07 00 00 08 00 03 sk1.n ..........
0080 e8 00 07 d1 00 07 d2 00 0b c2 00 0b c3 00 0b cc ................
0090 00 0b cd 00 17 70 00 27 1a 00 00 10 00 23 52 54 .....p.'.....#RT
00a0 4d 53 00 02 f9 00 00 00 0f c6 00 10 1f 42 52 54 MS...........BRT
00b0 4d 53 00 03 00 23 00 00 0f bd 00 10 53 72 52 54 MS...#......SrRT
00c0 4d 53 00 03 00 00 00 00 0f bd MS........
And what i think is an ongoing recording status packet (appears periodicaly)
Len=144
0000 18 7e b9 07 f6 93 7c 2e 0d 16 3e 9c 08 00 45 00 .~....|...>...E.
0010 00 ac f5 3f 00 00 ff 11 43 7f c0 a8 00 90 c0 a8 ...?....C.......
0020 00 a1 26 b6 e3 74 00 98 c7 5a 08 90 80 82 00 00 ..&..t...Z......
0030 00 00 00 00 3b ac 00 10 00 00 54 69 6d 65 0c 07 ....;.....Time..
0040 2d 12 00 00 00 54 00 54 4f 00 52 54 4d 44 00 00 -....T.TO.RTMD..
0050 00 00 00 00 10 fc 00 08 41 2d 49 53 4f 2d 44 79 ........A-ISO-Dy
0060 73 6b 31 00 00 00 00 00 01 03 00 02 00 00 03 00 sk1.............
0070 00 04 03 00 05 00 00 06 00 00 07 00 00 08 00 03 ................
0080 e8 00 07 d1 00 07 d2 00 0b c2 00 0b c3 00 0b cc ................
0090 00 0b cd 00 17 70 00 27 1a 00 00 10 00 23 52 54 .....p.'.....#RT
00a0 4d 53 00 03 f9 00 00 00 10 fd 00 10 1f 42 52 54 MS...........BRT
00b0 4d 53 00 03 00 23 00 00 10 fc MS...#....
I would be greatful if you could guide me through modyfing the code or getting useful info out of the packets
I tried to replace "StRS" value in your streaming implementation with various 4 letter combinations from wireshark packets with no suceess. I figure it's not as straight forward as I suspected. I've tried RTMS RSSR SRST STRT SRSD RTMD RMRD None of them yield any response.
Alright, found a solution! Code "TcLk" corresponds to both starting and stopping of a recording. When I eddited On Air option with TcLk value LED responded with ifstatement when command REC STOP was issued. For now I've just swapped the LED colors to get behaviour close to what I want, although it still responds quite randomly to REC START. The only downside is that now the default state of LED is red, not green. Only when the recording starts and then stops it changes to green, but after a while it reverts back to red.
I would be glad if you could help me refine that! Here are wireshark dumps of the packets
REC START
0000 24 5e be 80 88 9c 7c 2e 0d 16 3e 9c 08 00 45 00 $^....|...>...E.
0010 00 44 16 dd 00 00 ff 11 22 a0 c0 a8 00 90 c0 a8 .D......".......
0020 00 4b 26 b6 fb bd 00 30 38 c2 08 28 80 02 00 00 .K&....08..(....
0030 00 00 00 00 57 bb 00 10 00 00 54 69 6d 65 10 1a ....W.....Time..
0040 12 0d 00 00 bc 02 00 0c ff ff 54 63 4c 6b 01 63 ..........TcLk.c
0050 00 00 ..
REC STOP
0000 24 5e be 80 88 9c 7c 2e 0d 16 3e 9c 08 00 45 00 $^....|...>...E.
0010 01 4c 16 eb 00 00 ff 11 21 8a c0 a8 00 90 c0 a8 .L......!.......
0020 00 4b 26 b6 fb bd 01 38 29 4d 09 30 80 02 00 00 .K&....8)M.0....
0030 00 00 00 00 57 c9 00 10 00 00 54 69 6d 65 10 1a ....W.....Time..
0040 15 0a 00 00 bc 02 00 54 ff ff 52 54 4d 44 00 00 .......T..RTMD..
0050 00 00 00 00 20 a9 00 04 41 2d 49 53 4f 2d 44 79 .... ...A-ISO-Dy
0060 73 6b 31 00 20 ae 00 10 41 2d 52 4d 52 44 00 00 sk1. ...A-RMRD..
0070 00 00 00 00 61 c0 00 06 00 00 07 00 00 08 00 03 ....a...........
0080 e8 00 07 d1 00 07 d2 00 0b c2 00 0b c3 00 0b cc ................
0090 00 0b cd 00 17 70 00 27 1a 00 00 10 00 23 52 54 .....p.'.....#RT
00a0 4d 53 00 02 f9 00 00 00 20 a9 00 10 1f 42 52 54 MS...... ....BRT
00b0 4d 53 00 02 00 23 00 00 20 a9 00 10 00 54 52 54 MS...#.. ....TRT
00c0 4d 52 00 00 00 00 00 00 20 ae 00 10 ff ff 52 4d MR...... .....RM
00d0 52 44 00 00 00 00 00 00 00 00 00 54 41 2d 52 54 RD.........TA-RT
00e0 4d 44 00 00 00 00 00 00 20 a8 00 04 41 2d 49 53 MD...... ...A-IS
00f0 4f 2d 44 79 73 6b 31 00 ff ff ff ff 01 00 00 05 O-Dysk1.........
0100 00 ff ff ff ff ff ff 01 00 00 06 00 ff ff ff ff ................
0110 ff ff 01 00 00 07 00 ff ff ff ff ff ff 01 00 10 ................
0120 08 00 52 54 4d 53 00 03 01 00 00 00 20 b2 00 10 ..RTMS...... ...
0130 ff ff 52 54 4d 53 00 02 00 8c 00 00 20 a9 00 10 ..RTMS...... ...
0140 67 49 52 54 4d 53 00 02 00 00 00 00 20 a8 00 0c gIRTMS...... ...
0150 00 01 54 63 4c 6b 00 0c 00 00 ..TcLk....
Sorry for the late reply, but i took a quick look at it. Thanks for your captures. :)
I added the RTMS
command, as that seems to be what the companion module uses, and also mainly looked at their definition of the status flags.
As each command has different flags just replacing the command as you tried to would lead to strange behavior, as the commands doesn't map one to one.
In this banch I have added these functions to the ATEMmin
library.
uint16_t getRecordingStatusFlags();
bool getRecordingIdle();
bool getRecordingRecording();
bool getRecordingStopping();
bool getRecordingErrorNone();
bool getRecordingNoMedial();
bool getRecordingMediaFull();
bool getRecordingMediaError();
bool getRecordingMediaUnformatted();
bool getRecordingDroppingFrames();
bool getRecordingUnknownError();
It compiles, but I haven't tested it. Let me know if it works, and I'll merge it.
Updated the libraries to the version in the branch you've posted and quickly edited OnAir to use GetRecordingRecording but no luck. Tally does not react to recording status like in my previous test where I replaced StRS
with RTMS
I found a bug.
Copy pasting is dangerous. I forgot to rename where I put the recording flag data, so it saved it to the streamingStatusFlags
instead of recordingStatusFlags
See #99
FIxed that bug on my end and it seems to be working! It even picked up recording status midway through a recording, without needing to register a button press like with my "solution". Will test it extensively in upcoming days but it seems like its ready for release after adding an additional Recording Status Tally Mode in the web interface
Awesome 🙂
However, it'll probably be at least a few weeks before I get to adding it as an option.
Alright, found weird behaviour. Sometimes when recording is stopped, tally will blink rapidly between two states and will stay on recording state despite recording being off. If left in that state for couple of minutes it changes back to idle state. Once it happens, tally becomes less responsive and blinking gets more common until restart. Let me know if there are any steps I need to take to help debug this. Here is a video of me cycling recording state until it happens.
Warning: Flashing Lights https://github.com/AronHetLam/ATEM_tally_light_with_ESP8266/assets/47783439/ca132699-c3d6-4a7f-aad4-412c8fcb57a3
Uncomment this line in the main program
//atemSwitcher.serialOutput(0xff); //Makes Atem library print debug info)
And change ATEM_debug
to 1
in ATEM_base.h
That will make it print debug information to the serial monitor. If you could send me a copy of that output it might help.
Thanks for the instructions and help! Sure, here you go https://pastebin.com/UPQUz6JD
It says it's private. You can also just upload a file here.
My mistake, my account hit unlisted pastes limit and it went private automatically. It should be available now Uploading as a file too TallyFlicker.txt
I expected to see output from these lines https://github.com/AronHetLam/ATEM_tally_light_with_ESP8266/blob/feature/recording-status-command/libraries/ATEMmin/ATEMmin.cpp#L367-L370
Did you cause the flickering and set the ATEM_debug
definition to 1
?
Yes, i caused flickering and ATEM_debug
in ATEM_base.h
is set to 1
Could this be the case because main code is using ATEM_min
instead of ATEM_base
?
ATEM_min
uses ATEM_base
, so that's not the issue.
Found that the library checks needs the passed value to be 0x80
instead of 0xff
, so
atemSwitcher.serialOutput(0x80); //Makes Atem library print debug info
Hi there! For starters I would like to say that I find this project very impressive and I would like to thank you for your work Aron! I've been using it for some time as a primary tally light system for my live streams.
Recently I have found myself in need of indicating ISO recording status by a light placed in front of the doors to the studio. I'm not familiar with ATEMLib or creating new library entries but I haven't found anything that might be able to get the recording status in current library included in the repo.
I would love to see an ISO Rec mode akin to the On Air mode in which tally light lights up red when Atem is ISO recording. If not in the official project, I would be greatful for tips in terms of modification of existing code to add that functionality!
Atem Switcher in question - Atem SDI Extreme ISO, Atem Mini Extreme ISO and Television Studio HD8 ISO All should have identical signal logic
Thank you in advance