rodio icon indicating copy to clipboard operation
rodio copied to clipboard

symphonia impl total_duration

Open kamiyaa opened this issue 4 years ago • 3 comments

https://github.com/RustAudio/rodio/blob/master/src/decoder/symphonia.rs#L136

Just wanted to create an issue tracking this. Am also curious if there is any active work on this? Thank you!

kamiyaa avatar Dec 05 '21 15:12 kamiyaa

Bit of a novice here, but it looks like the sampling rate and total number of frames are both available in CodecParameters for the track, but I have no idea how many samples / packet there are, or how to find that information. If anyone else knows how to get that, though, an implementation should be pretty trivial (samples_per_frame * n_frames / sample_rate = length in seconds)

alch-emi avatar Jan 03 '22 04:01 alch-emi

Not all formats have streams where each frame has the same number of samples. E.g. in vorbis the number can vary from frame to frame.

est31 avatar Jan 25 '22 01:01 est31

I needed this as part of #513. I implemented it following the suggested approach in the symphonia documentation

yara-blue avatar Oct 11 '23 12:10 yara-blue