Specified sample format -1 is invalid or not supported

The aac that comes with ffmpeg itself does not support AV_SAMPLE_FMT_S16, and needs to be resampled to AV_SAMPLE_FMT_FLTP. If there is no resampling, an error may be reported:

Specified sample format s16 is invalid or not supported

But if you don't want to resample, you can also change the encoder, such as fdk-aac, which is a better encoder than ffmpeg itself, and it is also one of the mainstream choices. I wrote a blog about compiling and installing fdk-aac before.
Attached link:

https://blog.csdn.net/weixin_43466192/article/details/120843342

But I used fdk-aac, after AV_SAMPLE_FMT_S16 format. There was no problem under ubuntu16 before. After porting the environment to centos7, an error occurred:

Specified sample format -1 is invalid or not supported

Looking at the macro and finding that AV_SAMPLE_FMT_S16 is 1 instead of -1, I began to suspect that it is a version problem.
View my compiled executable Capture with the command

ldd Capture

It is found that the fdk-aac library it connects to is not the one I compiled and placed in /usr/local/lib,
but a fdk-aac library in /usr/local/lib64, indicating that the library that comes with centos7 is used , immediately uninstall the library that comes with the system:

yum remove fdk-aac

After recompiling the executable file Capture, execute:

ldd Capture

It was found that it went to /usr/local/lib to connect fdk-aac.
It won't be wrong either.

ffmpeg is a must for audio and video, but even after several years in the industry, it still seems to have endless secrets. If you are interested, add the author on WeChat: YQW1163720468, and join the discussion in the ffmpeg WeChat group.  But remember to note: ffmpeg lovers

Guess you like

Origin blog.csdn.net/weixin_43466192/article/details/121010281#comments_28202319