pytorch / pytorch/audio

duration is wrong for m4a audios but works for flac and mp3 files

Open
#3,573 7 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
2.9k
Forks
799
Avg merge
58m
Merged PRs (30d)
3

Description

🚀 The feature

Currently torchaudio (try torchaudio.info(m4a_path), regardless of version returning wrong results.
I wish we could get duration correctly for m4a files.

Motivation, pitch

I want to do segmentation of m4a audios but it can't evaluate correctly the duration of audios.

I was using this script https://github.com/k2-fsa/text_search/blob/master/examples/libriheavy/run.sh
and the first stage is prepare_manifest.py https://github.com/k2-fsa/text_search/blob/master/examples/libriheavy/prepare_manifest.py
it works well when audio files are ".flac" but when I am using dataset that is m4a audio format it is computing duration wrong.

Alternatives
  1. https://github.com/lhotse-speech/lhotse/issues/1121
    pzelasko was able to create a work around it for now.

  2. I can compress m4a audios to opus type and then do segmentation i guess.

Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the incorrect result with torchaudio.info(m4a_path) and compare it with the working FLAC and MP3 cases. Read examples/libriheavy/prepare_manifest.py and run.sh to see how duration is consumed, then review the workaround referenced in lhotse issue 1121. Done means m4a duration is computed correctly for segmentation.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
audio-video-rtc
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.