question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Zero duration for FLAC without header

See original GitHub issue

Suppose I generate a raw FLAC file, but in a streaming way where the STREAMINFO block isn’t updated after encoding:

ffmpeg -f lavfi -i "sine=1000:d=5" -f flac - > test-unknown-duration.flac

In the output file, the total sample count is zero, which is a special value for “total samples unknown”.

When loading metadata with music-metadata-browser, meadata.format.duration is zero 0.

I see that there is an option to set, {duration: true}, to force reading of the whole file to determine a duration. Even when that’s set to true, the duration ends up being zero 0.

It would be helpful in this case if the file were read to get its real duration. In the event this isn’t possible, I think it would be good if this module returned undefined or null instead.

A sample file is attached. Thanks!

test-unknown-duration.zip

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Borewitcommented, Jun 16, 2020

@bradisbell, if it no to much extra weight, will consider it for sure.

0reactions
bradisbellcommented, Jun 16, 2020

It’s about the added complexity of parsing the FLAC audio, and change code size for a very specific use case.

@Borewit Thanks for the reply, I can appreciate that concern. I’ve seen though that FLAC without header data is quite common, and I’m guessing more common than some of the other audio types that are supported. In any case, if a pull request were submitted to properly fix this issue, would you consider accepting it? Or is it purely the case that you’re trying to prevent adding any additional weight to the project?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Format - FLAC - Xiph.org
Following the frame header are encoded subframes, one for each channel, and finally, the frame is zero-padded to a byte boundary. Each subframe...
Read more >
FFMPEG: flac audio file duration in metadata is 0
FLAC usually doesn't have a duration in the metadata. You can work out the duration from the sample count and sample rate in...
Read more >
Correcting song length in flac files - Slimdevices forum
(i) use zero in STREAMINFO - means length unknown (ii) ignore length given in header (e.g. via flac command line option ignore-length)
Read more >
View topic - Track length missing from metadata in flac [Solved]
The format is flac, and it is only the track length tag that needs to be corrected. Can anyone recommend some neat utility...
Read more >
Metadata from OGG, FLAC and zero duration - Google Groups
a duration of zero seconds until you start playing the track ... directshow filter at fault for not providing the correct information to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found