xiph / opus-tools

A set of tools to encode, inspect, and decode audio in the Opus format.
https://opus-codec.org/
Other
214 stars 78 forks source link

Show total samples used to calculate duration in opusinfo #40

Open anthumchris opened 5 years ago

anthumchris commented 5 years ago

opusinfo currently shows the total playback duration/length. It would also be nice to see the total samples that would be decoded. In the example below, 6.02s * 48,000 yields 288,960 samples, which does not reflect the 297,910 samples that would actually be decoded for that file for that file.

$ opusinfo trimmed.opus
Processing file "trimmed.opus"...

New logical stream (#1, serial: 1c033e62): type opus
Encoded with libopus 1.1
User comments section follows...
  ENCODER=opusenc from opus-tools 0.1.9
  ENCODER_OPTIONS=--hard-cbr --bitrate 64
Opus stream 1:
  Pre-skip: 312
  Playback gain: 0 dB
  Channels: 2
  Original sample rate: 48000 Hz
  Packet duration:   20.0ms (max),   20.0ms (avg),   20.0ms (min)
  Page duration:   1000.0ms (max),  888.6ms (avg),  220.0ms (min)
  Total data length: 51101 bytes (overhead: 2.62%)
  Playback length: 0m:06.206s
  Average bitrate: 65.87 kbit/s, w/o overhead: 64.14 kbit/s (hard-CBR)
Logical stream 1 ended