Found while verifying #638's format matrix. Independent of #638's frame-size/sample-format adaptation — that fix landed and took the extract matrix from 2/14 to 13/14 formats. dts is the remaining one, and it fails for a different reason.
Symptom
With #638's fix in place, AudioExtractStage over a stereo 48 kHz AAC source:
dts: audio extract stage failed: failed to open audio encoder for transcode:
FFmpeg library error: Experimental feature
[dca @ ...] The encoder 'dca' is experimental but experimental codecs are not
enabled, add '-strict -2' if you want to use it.
The failure is at avcodec_open2, before any frame is sent — so it is not an adaptation problem.
Ground truth
$ ffmpeg -i stereo48.mp4 -vn -c:a dca out.dts # 0 bytes, "Terminating thread with return code -22"
$ ffmpeg -i stereo48.mp4 -vn -c:a dca -strict -2 out.dts # 354192 bytes, OK
Root cause
AUDIO_CODECS maps dts → encoder dca (crates/rdlp-ffmpeg/src/ffmpeg/audio_codecs.rs), but nothing in the extract path sets strict_std_compliance on the encoder context. FFmpeg's native dca encoder is marked experimental, so avcodec_open2 refuses it at the default compliance level.
So --audio-format=dts is an advertised option that cannot succeed on any build using the native encoder.
Options
- Set
strict_std_compliance = FF_COMPLIANCE_EXPERIMENTAL on the encoder context when — and only when — the selected encoder is flagged experimental (AV_CODEC_CAP_EXPERIMENTAL). Generic, and covers any future experimental encoder rather than special-casing dca.
- Prefer a non-experimental encoder when one exists in the build (e.g.
libdca where linked), falling back to (1).
- Reject
--audio-format=dts up front with a message naming the experimental gate, rather than failing deep in the stage.
(1) is closest to ffmpeg's own -strict -2 and keeps the option honest; it should be opt-in per-encoder rather than a blanket compliance downgrade.
Acceptance
Refs #638
Found while verifying #638's format matrix. Independent of #638's frame-size/sample-format adaptation — that fix landed and took the extract matrix from 2/14 to 13/14 formats.
dtsis the remaining one, and it fails for a different reason.Symptom
With #638's fix in place,
AudioExtractStageover a stereo 48 kHz AAC source:The failure is at
avcodec_open2, before any frame is sent — so it is not an adaptation problem.Ground truth
Root cause
AUDIO_CODECSmapsdts→ encoderdca(crates/rdlp-ffmpeg/src/ffmpeg/audio_codecs.rs), but nothing in the extract path setsstrict_std_complianceon the encoder context. FFmpeg's nativedcaencoder is marked experimental, soavcodec_open2refuses it at the default compliance level.So
--audio-format=dtsis an advertised option that cannot succeed on any build using the native encoder.Options
strict_std_compliance = FF_COMPLIANCE_EXPERIMENTALon the encoder context when — and only when — the selected encoder is flagged experimental (AV_CODEC_CAP_EXPERIMENTAL). Generic, and covers any future experimental encoder rather than special-casingdca.libdcawhere linked), falling back to (1).--audio-format=dtsup front with a message naming the experimental gate, rather than failing deep in the stage.(1) is closest to ffmpeg's own
-strict -2and keeps the option honest; it should be opt-in per-encoder rather than a blanket compliance downgrade.Acceptance
--audio-format=dtsproduces a decodable DTS file, or fails with a message that names the experimental-codec gate instead of a bare "Experimental feature".AV_CODEC_CAP_EXPERIMENTALcapability, not a hardcodeddcastring.dtsis re-enabled in theaudio_extract_format_matrixsuite (it is currently excluded there with a pointer to this issue).Refs #638