Jona
Jona

Reputation: 13555

FFmpeg 1.0 < causing audio playback issues

I have an audio streamer based on ffplay. It works great using ffmpeg 0.11 but when I use ffmpeg 1.0 or the latest 1.2 release the audio seems to be decoded or played weirdly.

Essentially it sounds like chipmunks with mp3 streams and with aac streams I hear tons of static barely hearing the actual stream and the actual stream sounds slow.

Any ideas the possible changes in ffmpeg that could have caused these types of issues?

Similar issue was posted here but no actual answer about what is going on. Supposedly this code reproduces the same issue.

UPDATE 1:
I have done a step by step copy from ffplay and still no luck! :/ The channel and sampling rate look correct so there must be something internally that is returning a weird decoded format?

Upvotes: 1

Views: 550

Answers (2)

Steven
Steven

Reputation: 48

pCodecCtx->request_sample_fmt = AV_SAMPLE_FMT_S16 doesn't change the behavior! I didn't find any better solution than using swr_convert to convert audio sample from AV_SAMPLE_FMT_FLT to AV_SAMPLE_FMT_S16.

Upvotes: 1

Jona
Jona

Reputation: 13555

Found a fix... So initially it sounded like something wasn't matching correctly with the decoded raw PCM data and my PCM player. I took a deeper look at what was being returned by the decoder and any potential differences. Turns out that the default decoded format has changed from AV_SAMPLE_FMT_S16 to AV_SAMPLE_FMT_S16P. The fix was to simply specify pCodecCtx->request_sample_fmt = AV_SAMPLE_FMT_S16; before opening the decoder.

Any feedback if this is a bad idea? I'm concerned if there might be issues with other formats and potential performance issues...

Upvotes: 1

Related Questions