andreanidouglas / ffmpeg-miniaudio-player

Basic C mp3 player
MIT License
0 stars 1 forks source link

Only plays a second or two of my audio files (various MP3s) #2

Closed Hammit closed 2 days ago

Hammit commented 5 days ago

OS: KUbuntu 24.04 Compiler: gcc (Ubuntu 13.2.0-23ubuntu4) 13.2.0

I put an MP3 file in the same directory as the miniaudio binary called output.mp3 I run the miniaudio binary Only a very limited amount of audio comes out of the speakers (a split second to 1 or 2 seconds) and there is very limited output in the console showing "Inserted x into fifo"

andreanidouglas commented 5 days ago

Hi, thank you for the PR and the new issue.

I created this repo last year, to try to understand how to use libav {decoder, format...} to decode audio files into a player. The reality is, I don't understand it very well and the API for the library is confusing to me.

I will check to see if I can spot the problem and come back to you, but i don't think I will have time to do it soon.

Hammit commented 4 days ago

I'm glad I'm not the only one having a tough time with it then :) Thanks for the repo

Hammit commented 4 days ago

Just a heads up. I think the issue with the audio cutting out prematurely was due to there only being one fread of the audio file. I think this should be looped until fread returns 0, indicating the EOF.

Hammit commented 3 days ago

Ok, problem solved. I've just given you a PR that fixes the problem for me. Not sure how an official example could have such a bug, but ah well, glad it's fixed now :)