Skip to content
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

Implement --channels discrete format option #80

Closed
wants to merge 2 commits into from

Conversation

chris-hld
Copy link
Contributor

This implements an option to specify the channel format as individual, providing an alternative to the default and ambix format.
Currently, input with up to 8 channels is interpreted as surround input triggering coupled channels.
This behavior is, however, detrimental when using individual / discrete streams that should not be coded as stereo coupled, such as e.g. microphone array signals.
The proposed format uses the channel mapping family 255, which is explicitly defined for such scenarios.

@vadimkantorov
Copy link

Btw may be better to not do changes to CI scripts within this same PR...

@chris-hld
Copy link
Contributor Author

Btw may be better to not do changes to CI scripts within this same PR...

Ah yes, I was forking from the gitlab repo originally, which seems to have two more CI commits. Should be fixed now.

@chris-hld
Copy link
Contributor Author

The documentation specifies mapping families:

255 | Discrete channels

Therefore, renaming to discrete

@chris-hld chris-hld changed the title Implement --channels individual format option Implement --channels discrete format option Oct 31, 2023
@chris-hld
Copy link
Contributor Author

With the option, also channel counts <8 can be transported without stereo coding, correctly evoking mapping 255.
It produces a valid file, according to opusinfo.

./../../opus-tools/opusinfo multiTC.opus                                     
Processing file "multiTC.opus"...

New logical stream (#1, serial: 76fcb206): type opus
Encoded with libopus 1.4-6-g9fc8fc4c, libopusenc 0.2.1-16-ge4285b5
User comments section follows...
	ENCODER=opusenc from opus-tools 0.2-30-g78b8127-dirty
	ENCODER_OPTIONS=--bitrate 288 --channels discrete
Opus stream 1:
	Pre-skip: 312
	Playback gain: 0 dB
	Channels: 6
	Original sample rate: 48000 Hz
	Streams: 6, Coupled: 0
	Channel Mapping Family: 255 Map: [0, 1, 2, 3, 4, 5]
	Packet duration:   20.0ms (max),   20.0ms (avg),   20.0ms (min)
	Page duration:   1000.0ms (max),  910.9ms (avg),   20.0ms (min)
	Total data length: 350465 bytes (overhead: 0.788%)
	Playback length: 0m:10.000s
	Average bitrate: 280.4 kbit/s, w/o overhead: 278.2 kbit/s
Logical stream 1 ended

Decoding needs the fix in https://github.com/xiph/opusfile/pull/45/files.

@vadimkantorov
Copy link

vadimkantorov commented Oct 31, 2023

Curious, without the opusfile PR, will libopus-based libs not be able to decode properly?

Would ffmpeg be able to decode these "discrete"/"decoupled" audio files?

@chris-hld
Copy link
Contributor Author

chris-hld commented Oct 31, 2023

Would ffmpeg be able to decode these "discrete"/"decoupled" audio files?

Yes, it should be! Essentially this PR is just using channel mapping 255, which is defined and should be implemented by decoders. And opus info shows that the encoded file is valid, therefore any compliant decoder should be able to decode the file.

@vadimkantorov
Copy link

@mark4o Are PR's considered in this repo? Or should they be created in https://gitlab.xiph.org/xiph/opus-tools ?

@mark4o
Copy link
Collaborator

mark4o commented Nov 12, 2023

Thanks! Merged in a2be338 on https://gitlab.xiph.org/xiph/opus-tools/ (official repository). It looks like the mirroring to GitHub has stopped working; we'll get that fixed. Once that is working again this PR should get tagged and close automatically.

@vadimkantorov
Copy link

I also wonder, does gitlab ci / GitHub ci currently publishes any nightly binaries? (E.g. as some "nightly"-tagged release)

Additionally, having fully static musl/alpine binaries for opus-tools programs would be very nice to run on older systems

@mark4o
Copy link
Collaborator

mark4o commented Nov 13, 2023

The gitlab CI builds it for Debian but it doesn't retain the binaries. opus-tools is not very large so it doesn't take long to build.

@vadimkantorov
Copy link

I mean, god knows when a new release will happen :) So having the binaries from the same build process as release binaries is nice.

Yeah, static building is not difficult (I made the following GitHub Workflow file: https://gist.github.com/vadimkantorov/c2664ee326e1e929f2ab9fb5ac743d26), but for less build-savvy users, it would be helpful.

@ePirat ePirat closed this in a2be338 Nov 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants