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

ADM (Audio Definition Model) and Dolby Metadata in WAV/RIFF #991

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -73,6 +73,7 @@ bzip2,
[dolby_metadata](doc/formats.md#dolby_metadata),
dns,
dns_tcp,
[dolby_metadata](doc/formats.md#dolby_metadata),
elf,
ether8023_frame,
exif,
18 changes: 14 additions & 4 deletions doc/formats.md
Original file line number Diff line number Diff line change
@@ -45,6 +45,7 @@
|[`dolby_metadata`](#dolby_metadata) |Dolby&nbsp;Metadata&nbsp;(Atmos,&nbsp;AC3,&nbsp;Digital&nbspPlus) |<sub>`riff`</sub>|
|`dns` |DNS&nbsp;packet |<sub></sub>|
|`dns_tcp` |DNS&nbsp;packet&nbsp;(TCP) |<sub></sub>|
|[`dolby_metadata`](#dolby_metadata) |Dolby&nbsp;Metadata&nbsp;(Atmos,&nbsp;AC3,&nbsp;Dolby&nbsp;Digital) |<sub></sub>|
|`elf` |Executable&nbsp;and&nbsp;Linkable&nbsp;Format |<sub></sub>|
|`ether8023_frame` |Ethernet&nbsp;802.3&nbsp;frame |<sub>`inet_packet`</sub>|
|`exif` |Exchangeable&nbsp;Image&nbsp;File&nbsp;Format |<sub></sub>|
@@ -133,7 +134,7 @@
|`vp9_frame` |VP9&nbsp;frame |<sub></sub>|
|`vpx_ccr` |VPX&nbsp;Codec&nbsp;Configuration&nbsp;Record |<sub></sub>|
|[`wasm`](#wasm) |WebAssembly&nbsp;Binary&nbsp;Format |<sub></sub>|
|`wav` |WAV&nbsp;file |<sub>`id3v2` `id3v1` `id3v11`</sub>|
|`wav` |WAV&nbsp;file |<sub>`id3v2` `id3v1` `id3v11` `dolby_metadata`</sub>|
|`webp` |WebP&nbsp;image |<sub>`exif` `vp8_frame` `icc_profile` `xml`</sub>|
|[`xml`](#xml) |Extensible&nbsp;Markup&nbsp;Language |<sub></sub>|
|`yaml` |YAML&nbsp;Ain't&nbsp;Markup&nbsp;Language |<sub></sub>|
@@ -616,6 +617,8 @@ $ fq -d csv '.[0] as $t | .[1:] | map(with_entries(.key = $t[.key]))' file.csv
```

## dolby_metadata
Dolby Metadata (Atmos, AC3, Dolby Digital).

Dolby Metadata from `<dbmd>` chunk of RIFF / WAV / Broadcast Wave Format (BWF),
including Dolby Atmos, AC3, Dolby Digital \[Plus\], and Dolby Audio Info (e.g. LUFS, True Peak).

@@ -625,13 +628,20 @@ Decode Dolby metadata from `<dbmd>` chunk:
$ fq -d wav '.chunks[] | select(.id | IN("dbmd")) | tovalue' bwf.wav
```

### References
- https://tech.ebu.ch/files/live/sites/tech/files/shared/tech/tech3285s6.pdf
- https://github.com/DolbyLaboratories/dbmd-atmos-parser
RIFF / WAV / Broadcast Wave Format (BWF) chunks:
- `<chna>` Track UIDs of Audio Definition Model
- `<axml>` BWF XML Metadata, e.g. for Audio Definition Model ambisonics and elements

### Authors
- [@johnnymarnell](https://johnnymarnell.github.io), original author

Copy link
Owner

@wader wader Aug 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move this to a doly_metadata.md file in format/tiff, formats.md is autogenerated via make doc. Then also add something like this https://github.com/wader/fq/blob/master/format/msgpack/msgpack.go#L16-L29 and the documentation will also ge available in the cli fq -h dolby_metadata and help(dolby_metadata)

Same for adm above

### References
- https://adm.ebu.io/background/what_is_the_adm.html
- https://tech.ebu.ch/publications/tech3285s7
- https://tech.ebu.ch/publications/tech3285s5
- https://tech.ebu.ch/files/live/sites/tech/files/shared/tech/tech3285s6.pdf
- https://github.com/DolbyLaboratories/dbmd-atmos-parser

## fit
Garmin Flexible and Interoperable Data Transfer.

1 change: 1 addition & 0 deletions format/format.go
Original file line number Diff line number Diff line change
@@ -92,6 +92,7 @@ var (
CSV = &decode.Group{Name: "csv"}
DNS = &decode.Group{Name: "dns"}
DNS_TCP = &decode.Group{Name: "dns_tcp"}
Dolby_Metadata = &decode.Group{Name: "dolby_metadata"}
ELF = &decode.Group{Name: "elf"}
Ether_8023_Frame = &decode.Group{Name: "ether8023_frame"}
Exif = &decode.Group{Name: "exif"}
26 changes: 13 additions & 13 deletions format/riff/adm.go
Original file line number Diff line number Diff line change
@@ -9,22 +9,22 @@ import (
"github.com/wader/fq/pkg/decode"
)

func chnaDecode(d *decode.D, size int64) {
func chnaDecode(d *decode.D) {
d.FieldU16("num_tracks")
d.FieldU16("num_uids")

audioIdLen := (size - 4) / 40
d.FieldStructNArray("audio_ids", "audio_id", int64(audioIdLen), func(d *decode.D) {
d.FieldU16("track_index")
d.FieldUTF8("uid", 12)
d.FieldUTF8("track_format_id_reference", 14)
d.FieldUTF8("pack_format_id_reference", 11)
// Skip padding single byte
d.U8()
d.FieldArray("audio_ids", func(d *decode.D) {
for !d.End() {
d.FieldStruct("audio_id", func(d *decode.D) {
d.FieldU16("track_index")
d.FieldUTF8("uid", 12)
d.FieldUTF8("track_format_id_reference", 14)
d.FieldUTF8("pack_format_id_reference", 11)
d.FieldRawLen("padding", 8)
})
}
})
}

func axmlDecode(d *decode.D, size int64) {
// TODO(jmarnell): this chunk is all variable xml, so leave as is?
d.FieldRawLen("xml", size*8)
func axmlDecode(d *decode.D) {
d.FieldUTF8("xml", int(d.BitsLeft())/8)
}
4 changes: 2 additions & 2 deletions format/riff/common.go
Original file line number Diff line number Diff line change
@@ -58,8 +58,8 @@ var chunkIDDescriptions = scalar.StrMapDescription{

"dmlh": "Extended AVI header",

"chna": "<chna> Chunk, Track UIDs of Audio Definition Model",
"axml": "<axml> Chunk, BWF XML Metadata, e.g. for Audio Definition Model ambisonics and elements",
"chna": "Track UIDs of Audio Definition Model",
"axml": "Audio Definition Model ambisonics and elements",
"dbmd": "Dolby Metadata, e.g. Atmos, AC3, Dolby Digital [Plus]",

"ISMP": "SMPTE timecode",
Loading