0

How can the play-time of a .flac file be determined?

$ metaflac --list 01\ Mrs.\ Robinson.flac

METADATA block #0
  type: 0 (STREAMINFO)
  is last: false
  length: 34
  minimum blocksize: 4096 samples
  maximum blocksize: 4096 samples
  minimum framesize: 14 bytes
  maximum framesize: 11923 bytes
  sample_rate: 44100 Hz
  channels: 2
  bits-per-sample: 16
  total samples: 10238256
  MD5 signature: 42aabab0b89db824243448fe361ac399

METADATA block #1
  type: 3 (SEEKTABLE)
  is last: false
  length: 432
  seek points: 24
   point 0: sample_number=0, stream_offset=0, frame_samples=4096
   point 1: sample_number=438272, stream_offset=644857, frame_samples=4096
   point 2: sample_number=880640, stream_offset=1468851, frame_samples=4096
    …
   point 21: sample_number=9285632, stream_offset=19168477, frame_samples=4096
   point 22: sample_number=9723904, stream_offset=19982848, frame_samples=4096
   point 23: sample_number=10166272, stream_offset=20488823, frame_samples=4096

METADATA block #2
  type: 4 (VORBIS_COMMENT)
  is last: true
  length: 403
  vendor string: reference libFLAC 1.3.0 20130526
  comments: 10
    comment[0]: TITLE=Mrs. Robinson
    comment[1]: ALBUM=Simon & Garfunkel's Greatest Hits
    comment[2]: ARTIST=Simon & Garfunkel
    comment[3]: COMPOSER=Paul Simon
    comment[4]: GENRE=Contemporary Folk
    comment[5]: WM/MCDI=E+96+449A+6F0E+CA0A+EA6A+120E8+1535B+18ABF+1BA64+21009+ …
    comment[6]: TRACKNUMBER=1
    comment[7]: YEAR=1972
    comment[8]: ALBUMARTIST=Simon & Garfunkel
    comment[9]: WM/WMCOLLECTIONID={b5020207-474e-4720-b58b-782e0ed68300}

Perhaps it can be calculated using the seek points.

P.S. This site has amazingly few tag descriptions.

1 Answer 1

2

Total Samples / Sample Rate (Hz) = playback/recording time (s)

In this case:

  • Total Samples = 10238256
  • Sample Rate = 44100 Hz

Thus: 10238256 / 44100 = 232.160068027210884 seconds

Explanation

The sample rate is the number of samples recorded in a specific amount of time. In this case, the sample rate is expressed in Hz which means "per second" - kHz would mean "per one-thousandth of a second" and MHz would be "per one-millionth of a second".

Dividing the total number of samples by the rate that the samples are played/recorded gives us the number of time units required.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.