[Python] Why the number of samples given by `ffmpegio` differs using 2 methods?

Discussão em 'Python' iniciado por Stack, Setembro 24, 2024.

  1. Stack

    Stack Membro Participativo

    I have an mp3 file at a sample rate value of 44100, let's name it a.mp3.

    Using python library ffmpegio with the following code, i get a total amount of sample equal to 290704.

    with ffmpegio.open(file, 'ra', blocksize = 16, sample_fmt = 'dbl') as file_opened:

    for i, indata in enumerate(file_opened):

    do some stuff
    print((i + 1) * 16)


    But,

    ffmpegio.probe.audio_streams_basic('a.mp3')[0]['nb_samples']

    gives me 292608

    How the difference between 292608 and 290704 could be explained?

    I search in ffmpegio documentation, but found nothing that trigered my attention:

    https://python-ffmpegio.github.io/python-ffmpegio/

    Thanks.

    I tried to get more information about how the total number of samples was calculated in ffmpegio.probe.audio_streams_basic()

    Also, the difference does not seem to increase with increasing the length of the mp3 file.

    Continue reading...

Compartilhe esta Página