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

feat: streaming audio bitrates #130

Closed bevand10 closed 1 year ago

bevand10 commented 1 year ago

What kind of change does this PR introduce?

Support for the STAB message - STreaming Audio Bitrates

What is the current behaviour?

STAB is not currently supported.

What is the new behaviour?

STAB message receipt is supported

Data received is added to the atem.streaming object. Here's the results of a console.log(atem.state); command in Node when using this branch.

...
  streaming: {
    service: {
      serviceName: 'my service name',
      url: 'rtmp://a.rtmp.youtube.com/live2',
      key: '****-****-****-****-****',
      bitrates: [Array]
    },
    audioBitrates: { lowBitrate: 128000, highBitrate: 128000 },
    status: { state: 1, error: 0 },
    duration: { hours: 0, minutes: 0, seconds: 0, frames: 0, isDropFrame: false },
    stats: { encodingBitrate: 0, cacheUsed: 0 }
  },
...

STAB message transmission is supported

A new command has been added to set streaming audio bitrates. BMD documentation states that a STAB message defines two bitrate values, one for framerates up to 30fps, and another for framerates greater than 30fps. It refers to these as lowBitrate and highBitrate values. Strictly speaking, IMO, these should really be referred to as lowFramerates and highFramerates or even more explicitly, upto30fps and morethan30fps, but I'll overlook that mistake from BMD!

This example sets both values to 128k:

atem.setStreamingAudioBitrates(128000, 128000);

Safe defaults

When calling atem.setStreamingAudioBitrates() (i.e. without params), safe defaults are applied:

    audiobitrates: { lowBitrate: 128000, highBitrate: 192000 },

image

codecov-commenter commented 1 year ago

Codecov Report

Base: 85.97% // Head: 85.98% // Increases project coverage by +0.00% :tada:

Coverage data is based on head (bd070cf) compared to base (cc1ee5e). Patch coverage: 86.66% of modified lines in pull request are covered.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #130 +/- ## ======================================= Coverage 85.97% 85.98% ======================================= Files 165 166 +1 Lines 5292 5322 +30 Branches 885 890 +5 ======================================= + Hits 4550 4576 +26 - Misses 722 726 +4 Partials 20 20 ``` | [Impacted Files](https://codecov.io/gh/nrkno/sofie-atem-connection/pull/130?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=nrkno) | Coverage Δ | | |---|---|---| | [src/atem.ts](https://codecov.io/gh/nrkno/sofie-atem-connection/pull/130/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=nrkno#diff-c3JjL2F0ZW0udHM=) | `21.02% <0.00%> (-0.12%)` | :arrow_down: | | [...ommands/Streaming/StreamingAudioBitratesCommand.ts](https://codecov.io/gh/nrkno/sofie-atem-connection/pull/130/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=nrkno#diff-c3JjL2NvbW1hbmRzL1N0cmVhbWluZy9TdHJlYW1pbmdBdWRpb0JpdHJhdGVzQ29tbWFuZC50cw==) | `96.15% <96.15%> (ø)` | | | [src/commands/Streaming/index.ts](https://codecov.io/gh/nrkno/sofie-atem-connection/pull/130/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=nrkno#diff-c3JjL2NvbW1hbmRzL1N0cmVhbWluZy9pbmRleC50cw==) | `100.00% <100.00%> (ø)` | | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=nrkno). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=nrkno)

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

Julusian commented 1 year ago

Thanks, this is published in v3.1.0