我正在尝试使用 ffmpeg 命令运行音频编码器,但是当我尝试在 aac_ld 编解码器或 aac_eld 编解码器中进行编码时,它会给我一个错误,指出...
[libfdk_aac @ 0x1e20770] Unable to initialize the encoder: Transport library initialization error
但对于其他编解码器,它运行得非常好。
我将此命令用于 aac_eld 编解码器
ffmpeg -y -f alsa -ac 2 -ar 44100 -i hw:0 -acodec libfdk_aac -profile:a aac_eld -b:a 320k -r:a 48000 -f mpegts udp://192.168.1.60:1234?pkt_size=1316
并得到这个输出
ffmpeg version 2.6.9 Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 4.9.2 (Debian 4.9.2-10)
configuration: --prefix=/usr --extra-cflags='-g -O2 -fstack-protector-strong -Wformat -Werror=format-security ' --extra-ldflags='-Wl,-z,relro' --cc='ccache cc' --enable-shared --enable-libmp3lame --enable-gpl --enable-nonfree --enable-libvorbis --enable-pthreads --enable-libfaac --enable-libxvid --enable-postproc --enable-x11grab --enable-libgsm --enable-libtheora --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libx264 --enable-libspeex --enable-nonfree --disable-stripping --enable-libvpx --enable-libschroedinger --disable-encoder=libschroedinger --enable-version3 --enable-libopenjpeg --enable-librtmp --enable-avfilter --enable-libfreetype --enable-libvo-aacenc --disable-decoder=amrnb --enable-libvo-amrwbenc --enable-libaacplus --libdir=/usr/lib/arm-linux-gnueabihf --disable-vda --enable-libbluray --enable-libcdio --enable-gnutls --enable-frei0r --enable-openssl --enable-libass --enable-libopus --enable-fontconfig --enable-libpulse --disable-mips32r2 --disable-mipsdspr1 --disable-mipsdspr2 --enable-libvidstab --enable-libzvbi --enable-avresample --disable-htmlpages --disable-podpages --enable-libutvideo --enable-libfdk-aac --enable-libx265 --enable-libiec61883 --enable-libdc1394 --disable-altivec --shlibdir=/usr/lib/arm-linux-gnueabihf
libavutil 54. 20.100 / 54. 20.100
libavcodec 56. 26.100 / 56. 26.100
libavformat 56. 25.101 / 56. 25.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 11.102 / 5. 11.102
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 3.100 / 53. 3.100
Guessed Channel Layout for Input Stream #0.0 : stereo
Input #0, alsa, from 'hw:0':
Duration: N/A, start: 1505822120.258801, bitrate: 1411 kb/s
Stream #0:0: Audio: pcm_s16le, 44100 Hz, 2 channels, s16, 1411 kb/s
[libfdk_aac @ 0x1e20770] Unable to initialize the encoder: Transport library initialization error
Output #0, mpegts, to 'udp://192.168.1.60:1234?pkt_size=1316':
Stream #0:0: Audio: aac, 0 channels, 128 kb/s
Metadata:
encoder : Lavc56.26.100 libfdk_aac
Stream mapping:
Stream #0:0 -> #0:0 (pcm_s16le (native) -> aac (libfdk_aac))
Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
[1]+ Killed ffmpeg -y -f alsa -ac 2 -ar 44100 -i hw:0 -acodec libfdk_aac -profile:a aac_he -b:a 320k -r:a 48000 -f mpegts udp://192.168.1.60:1234?pkt_size=1316
但对于另一个编解码器(例如 aac_low)来说,它运行得很好。
答案1
我终于找到了我的问题的解决方案。显然 mpegts 不是以 aac_ld 或 aac_eld 编码音频的正确输出格式。我用 nut 替换了 mpegts。
ffmpeg -y -f alsa -ac 2 -ar 44100 -i hw:0 -acodec libfdk_aac -profile:a aac_eld -b:a 320k -r:a 48000 -f nut udp://192.168.1.60:1234?pkt_size=1316
但这种格式只能使用 ffplay 解码。