I have some pull requests that I need to get reviewed and verified that they are ready to be merged. Some already have assigned reviewers, others need to be assigned. I would like to sponsor an effort to merge bug fixes, stability improving pull requests, and captions related features to master.
Specifically
master ← programmerjake:fix-stream-indexes
opened 06:59AM - 23 May 25 UTC
Fixes: #1632
This also adds more checks before trying to activate `alphamerge… ` mode, checking that the dimensions, sample aspect ratio, and field order match. It also checks that if there's 3 or more video streams that only the largest two are matching, since if there's 3 or more matching that seems more likely to be unrelated video streams than color and alpha streams.
master ← dedicatedbroadcastsolutions:pr-disable-keyer
opened 04:35PM - 02 Aug 26 UTC
## Summary
Adds a `disabled` keyer option for the DeckLink consumer, allowing… the
keyer to be skipped entirely instead of being enabled as `internal` or
`external`.
## Motivation
Not every DeckLink output is used for keying — a given device/connector
may be dedicated to plain playout while another output on the same
device is used for a different purpose. With the current
`internal`/`external`/`default` options, the consumer always attempts
to enable the keyer regardless of whether that output is actually
intended to key anything, which can produce a spurious
`Failed to enable external keyer` error when the connector isn't wired
or configured for keying and an internal keyer is missing. This adds an explicit `disabled` option so an
output can be configured to skip keyer setup entirely when it isn't
needed for that channel.
## Changes
- `config.h`: add `disabled_keyer` to the `keyer_t` enum
- `config.cpp`: support `<keyer>disabled</keyer>` in XML config and
`DISABLED_KEY` as an AMCP consumer parameter
- `decklink_consumer.cpp`: `set_keyer()` now returns early with an
info-level log (`Keyer disabled.`) when `disabled_keyer` is
configured, without touching the hardware keyer
- `monitor.cpp`: report `decklink/keyer` as `"disabled"` in the OSC/
monitor state when this option is active
- `casparcg.config`: document the new `disabled` option alongside the
existing `keyer` choices
## Testing
- Verified config parsing for both XML (`<keyer>disabled</keyer>`) and
AMCP (`DISABLED_KEY`) paths
- Verified `decklink/keyer` monitor state reports `disabled` correctly
- No changes to existing `internal`/`external`/`default` keyer
behavior
master ← programmerjake:add-captions-to-ffmpeg
opened 03:40AM - 10 Jun 25 UTC
Adds support for ASTC A/53 Part 4 Closed Captions (essentially EIA-608 and CTA-7… 08).
This adds a extensible side-data mixer (side-data naming is based on FFmpeg's `AVFrameSideDataType`), which for now just handles closed captions. For closed captions, for each layer, it chooses which input layer to take the closed captions from based on a priority associated with each layer. That priority can be any positive floating-point number. Zero, NaN, or negative numbers mean that there is no priority, so that layer won't be used for closed captions, allowing you to turn off closed captions.
The side-data mixer currently doesn't properly support switching the closed captions source in the middle of an input video, currently it'll just stop the previous video's side-data and start the next one's side data, rather than e.g. building a proper EIA-608 transition sequence. It does warn when you change the source like that though.
The side-data mixer also has functionality to use side-data from dropped frames in the input -- the code allows different side-data types to handle that differently since some types of side-data may only want to use the side-data from the frames that are actually sent to the output (e.g. `AV_FRAME_DATA_DYNAMIC_HDR_PLUS` I guess), and some may not want to miss any frames (closed captions, where missing a frame of data can cause the captions to be garbled).
So far, I've implemented closed captions support in:
* FFmpeg producer: it supports getting closed captions from either the video stream's side data, or from a separate subtitles stream (e.g. in `.mxf` files). It also has support for reading a subtitles-only file (e.g. `.scc` or `.mcc`).
* FFmpeg consumer: it supports putting closed captions into the video stream's side data. It doesn't yet support generating the VANC stream for `.mxf` files, or other file types that need the closed captions to be a separate subtitles stream.
* Decklink consumer: supported only with FFmpeg 8.0 or later. Prints a warning and disables closed captions output on earlier versions.
I added a ACMP command (`MIXER CLOSED_CAPTIONS_PRIORITY`) for changing a layer's closed-captions priority.
Since information on which inputs to use for closed captions or not is stored in the frame transforms, and those are all cleared by the `MIXER CLEAR` command, I decided to add a per-producer closed-captions priority setting that is associated with the producer rather than only with frame transforms. to set that, you have to pass the new `CLOSED_CAPTIONS_PRIORITY` option to whatever `LOAD`/`LOADBG`/`PLAY` command you use to create that producer. That has the benefit of also following the transition between different producers in a layer, rather than you having to be quick and sending `MIXER CLOSED_CAPTIONS_PRIORITY` at the right time. An additional benefit of having the new `CLOSED_CAPTIONS_PRIORITY` argument for `PLAY` is that you can enable closed captions directly from the config file if you didn't want to start up an ACMP client or type any commands into stdin.
# FIXMEs for future contributors
I'm no longer doing substantial work on this since I'm busy with other stuff, so there is stuff that I'm leaving for someone else to do:
* after writing the whole system around A53 CC packets (EIA-608/708), I realized that it would probably be better to base it around something equivalent to FFmpeg's `AVSmpte436mCodedAnc` instead, since that retains all the information around line numbers, frame rates, and other information that is stripped when converting to A53 CC packets. I wrote the code in FFmpeg for that.
master ← dedicatedbroadcastsolutions:BUG_Fix_url_encoding_for_path
opened 10:23PM - 02 Jan 26 UTC
This is a rough but successful attempt at fixing url path encoding errors with t… humbnail retrieval. Thumbnail retrieval was broken on windows for files with some special characters. This was an AI assisted patch so please review changes closely.
master ← dedicatedbroadcastsolutions:pr-decklink-modelname-leak
opened 04:58PM - 02 Aug 26 UTC
### What
`get_model_name()` in `src/modules/decklink/util/util.h` calls
`IDeck… Link::GetModelName()` but never releases the string it returns,
leaking it on every call.
### Why
`GetModelName()` returns an owned string that the caller must free:
- On Windows this is a `BSTR`, which must be released with `SysFreeString()`.
- On other platforms it's a heap-allocated C string, which must be released with `free()`.
Since `get_model_name()` is called whenever a DeckLink device's model
name is queried (e.g. during device enumeration/logging), this leaked
memory on every call.
### Change
Store the converted result before freeing `pModelName`, then return
the stored result. No behavioral/output change — this is purely a
memory-leak fix.
Please let me know the best way to accelerate getting these features working. I also see there are some other potentially useful stability related bug fixes in the queue.
Other open PRs worth taking a look at:
#1763 — fixes a DeckLink consumer crash (use-after-free/heap corruption) during teardown
#1757 — fixes a Windows thread-handle leak that can crash long-running streams under exception churn (e.g. flaky network reconnects)
#1691 — fixes the NDI consumer memory leak reported in #1591
#1633 — fixes incorrect stream-to-filter assignment in the FFmpeg producer (#1632 )
#1692 — fixes a crash/failure retrieving thumbnails and media info for files with spaces, special characters, or subfolders
All are focused bugfixes with passing CI and no merge conflicts against master. Some of those will need review to make sure they implemented the fixes requested.