0

In mp3 files with embedded artwork when getting the number frames from SF_INFO.frames it also seems to calculate the artwork as a frame in the audio file.

#include <sndfile.h>
#include <iostream>

void getFrames(char *filePath)
{
  SF_INFO *sfInfo;
  SNDFILE *sndFile = sf_open (filePath, SFM_READ, sfInfo);
  std::cout << sfInfo->frames << std::endl;
}

int main()
{
  getFrames("./sample1.mp3"); // Embedded artwork. returns 5121858
  getFrames("./sample2.mp3"); // Without embedded artwork. returns 4172109
  return 0;
}

How could I remove the frames that don't contain any audio, or how could be the actual audio frame be calculated without the non-audio one?

  • A note that trying to add an artwork wit ffmpeg doesn't produce the same results, while adding it with something like ProTools I was able to reproduce the issue – Alexandru Nitan Sep 17 '22 at 13:07

0 Answers0