Skip to content

sample_rate and channels returning 0 instead of None with m4a #661

@UnknownSuperficialNight

Description

@UnknownSuperficialNight

Reproducer

I tried this code:

// 1. Try to extract from provided TaggedFile
if let Some(tagged_file) = tagged &&
    let Some(sample_rate) = tagged_file.properties().sample_rate()
{
    println!("Sample rate2: {}", sample_rate);
    return Some(sample_rate);
}

Output returned:

Sample rate2: 0

AND

// 1. Try to extract from provided TaggedFile
if let Some(tagged_file) = tagged &&
    let Some(audio_channels) = tagged_file.properties().channels()
{
    println!("Audio channels: {}", audio_channels);
    return Some(audio_channels);
}

Output returned:

Audio channels: 0

Summary

sample_rate and channels returning 0 instead of None

When used on a m4a file here are properties of said file:

General
Complete name                            : example_E-AC-3 JOC.m4a
Format                                   : MPEG-4
Format profile                           : Base Media / Version 2
Codec ID                                 : mp42 (mp42/isom)
File size                                : 23.9 MiB
Duration                                 : 3 min 43 s
Overall bit rate mode                    : Constant
Overall bit rate                         : 896 kb/s
Recorded date                            : 2025-09-05
Encoded date                             : 2025-08-29 18:32:19 UTC
Tagged date                              : 2025-08-29 18:32:19 UTC

Audio
ID                                       : 1
Format                                   : E-AC-3 JOC
Format/Info                              : Enhanced AC-3 with Joint Object Coding
Commercial name                          : Dolby Digital Plus with Dolby Atmos
Codec ID                                 : ec-3
Duration                                 : 3 min 43 s
Bit rate mode                            : Constant
Bit rate                                 : 768 kb/s
Channel(s)                               : 6 channels
Channel layout                           : L R C LFE Ls Rs
Sampling rate                            : 48.0 kHz
Frame rate                               : 31.250 FPS (1536 SPF)
Compression mode                         : Lossy
Stream size                              : 20.4 MiB (86%)
Service kind                             : Complete Main
Default                                  : Yes
Alternate group                          : 2
Encoded date                             : 2025-08-29 18:32:19 UTC
Tagged date                              : 2025-08-29 18:32:19 UTC
Complexity index                         : 16
Number of dynamic objects                : 15
Bed channel count                        : 1 channel
Bed channel configuration                : LFE
Dialog Normalization                     : -16 dB
compr                                    : -0.28 dB
dmixmod                                  : Lo/Ro
ltrtcmixlev                              : -3.0 dB
ltrtsurmixlev                            : -3.0 dB
lorocmixlev                              : -3.0 dB
lorosurmixlev                            : -3.0 dB
dialnorm_Average                         : -16 dB
dialnorm_Minimum                         : -16 dB
dialnorm_Maximum                         : -16 dB

Expected behavior

It prints out None

Audio channels: None
Sample rate2: None

Assets

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions