Gstreamer AAC编码不再支持?

时间:2016-07-18 14:10:32

标签: ubuntu ffmpeg gstreamer aac

我想将AAC作为我的应用程序中的兼容格式之一,但我的编码遇到了麻烦。 在GStreamer-1.0 Debian派生的软件包(参见Ubuntu)中似乎缺少FAAC,主要原因(如果我正确地说)是avenc_aac(Lunchpad bugreport)作为替代品的存在。

我尝试了以下内容:

gst-launch-1.0 filesrc location="src.avi" ! tee name=t  t.! queue ! decodebin ! progressreport ! x264enc ! mux. t.! queue ! decodebin ! audioconvert ! audioresample ! avenc_aac compliance=-2 ! mux. avmux_mpegts name=mux ! filesink location=/tmp/test.avi

它挂起预先滚动:

ERROR libav :0:: AAC bitstream not in ADTS format and extradata missing

使用mpegtsmux而不是avmux_mpegts似乎可以正常工作,因为文件已创建,但结果没有工作音频(某些播放器完全无法播放)。

这是mplayer的痕迹:

Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
[aac @ 0x7f2860d6c3c0]channel element 3.15 is not allocated
[aac @ 0x7f2860d6c3c0]Sample rate index in program config element does not match the sample rate index configured by the container.
[aac @ 0x7f2860d6c3c0]Inconsistent channel configuration.
[aac @ 0x7f2860d6c3c0]get_buffer() failed
[aac @ 0x7f2860d6c3c0]Assuming an incorrectly encoded 7.1 channel layout instead of a spec-compliant 7.1(wide) layout, use -strict 1 to decode according to the specification instead.
[aac @ 0x7f2860d6c3c0]Reserved bit set.
[aac @ 0x7f2860d6c3c0]Number of bands (20) exceeds limit (14).
[aac @ 0x7f2860d6c3c0]invalid band type
[aac @ 0x7f2860d6c3c0]More than one AAC RDB per ADTS frame is not implemented. Update your FFmpeg version to the newest one from Git. If the problem still occurs, it means that your file has a feature which has not been implemented.
[aac @ 0x7f2860d6c3c0]Reserved bit set.
[aac @ 0x7f2860d6c3c0]Number of bands (45) exceeds limit (28).
Unknown/missing audio format -> no sound
ADecoder init failed :(
Opening audio decoder: [faad] AAC (MPEG2/4 Advanced Audio Coding)
FAAD: compressed input bitrate missing, assuming 128kbit/s!
AUDIO: 44100 Hz, 2 ch, floatle, 128.0 kbit/9.07% (ratio: 16000->176400)
Selected audio codec: [faad] afm: faad (FAAD AAC (MPEG-2/MPEG-4 Audio))
==========================================================================
AO: [pulse] 44100Hz 2ch floatle (4 bytes per sample)
Starting playback...
FAAD: error: Bitstream value not allowed by specification, trying to resync!
FAAD: error: Invalid number of channels, trying to resync!
FAAD: error: Invalid number of channels, trying to resync!
FAAD: error: Bitstream value not allowed by specification, trying to resync!
FAAD: error: Invalid number of channels, trying to resync!
FAAD: error: Bitstream value not allowed by specification, trying to resync!
FAAD: error: Channel coupling not yet implemented, trying to resync!
FAAD: error: Invalid number of channels, trying to resync!
FAAD: error: Invalid number of channels, trying to resync!
FAAD: error: Bitstream value not allowed by specification, trying to resync!
FAAD: Failed to decode frame: Bitstream value not allowed by specification 
Movie-Aspect is 1.33:1 - prescaling to correct movie aspect.
VO: [vdpau] 640x480 => 640x480 Planar YV12 
A:3602.2 V:3600.0 A-V:  2.143 ct:  0.000   3/  3 ??% ??% ??,?% 0 0 
FAAD: error: Array index out of range, trying to resync!
FAAD: error: Bitstream value not allowed by specification, trying to resync!
FAAD: error: Bitstream value not allowed by specification, trying to resync!
FAAD: error: Unexpected fill element with SBR data, trying to resync!
FAAD: error: Bitstream value not allowed by specification, trying to resync!
FAAD: error: Bitstream value not allowed by specification, trying to resync!
FAAD: error: Channel coupling not yet implemented, trying to resync!
FAAD: error: Invalid number of channels, trying to resync!
FAAD: error: PCE shall be the first element in a frame, trying to resync!
FAAD: error: Invalid number of channels, trying to resync!
FAAD: Failed to decode frame: Invalid number of channels 
A:3602.2 V:3600.1 A-V:  2.063 ct:  0.000   4/  4 ??% ??% ??,?% 0 0 

这些消息由VLC产生(播放10秒):

ts info: MPEG-4 descriptor not found for pid 0x42 type 0xf
core error: option sub-original-fps does not exist
subtitle warning: failed to recognize subtitle type
core error: no suitable demux module for `file/subtitle:///tmp//test.avi.idx'
avcodec info: Using NVIDIA VDPAU Driver Shared Library 361.42 Tue Mar 22 17:29:16 PDT 2016 for hardware decoding.
core warning: VoutDisplayEvent 'pictures invalid'
core warning: VoutDisplayEvent 'pictures invalid'
packetizer_mpeg4audio warning: Invalid ADTS header
packetizer_mpeg4audio warning: ADTS CRC not supported
packetizer_mpeg4audio warning: Invalid ADTS header
packetizer_mpeg4audio error: Multiple blocks per frame in ADTS not supported
packetizer_mpeg4audio warning: Invalid ADTS header
packetizer_mpeg4audio error: Multiple blocks per frame in ADTS not supported
packetizer_mpeg4audio warning: ADTS CRC not supported
packetizer_mpeg4audio error: Multiple blocks per frame in ADTS not supported
packetizer_mpeg4audio error: Multiple blocks per frame in ADTS not supported
packetizer_mpeg4audio error: Multiple blocks per frame in ADTS not supported
packetizer_mpeg4audio error: Multiple blocks per frame in ADTS not supported
packetizer_mpeg4audio error: Multiple blocks per frame in ADTS not supported
packetizer_mpeg4audio error: Multiple blocks per frame in ADTS not supported
packetizer_mpeg4audio error: Multiple blocks per frame in ADTS not supported
packetizer_mpeg4audio error: Multiple blocks per frame in ADTS not supported
packetizer_mpeg4audio warning: Invalid ADTS header
packetizer_mpeg4audio error: Multiple blocks per frame in ADTS not supported
packetizer_mpeg4audio warning: Invalid ADTS header
packetizer_mpeg4audio warning: Invalid ADTS header
packetizer_mpeg4audio error: Multiple blocks per frame in ADTS not supported
packetizer_mpeg4audio warning: Invalid ADTS header
packetizer_mpeg4audio warning: Invalid ADTS header
packetizer_mpeg4audio warning: Invalid ADTS header
packetizer_mpeg4audio error: Multiple blocks per frame in ADTS not supported
packetizer_mpeg4audio warning: Invalid ADTS header
packetizer_mpeg4audio warning: Invalid ADTS header
packetizer_mpeg4audio error: Multiple blocks per frame in ADTS not supported
packetizer_mpeg4audio warning: Invalid ADTS header
packetizer_mpeg4audio error: Multiple blocks per frame in ADTS not supported
packetizer_mpeg4audio error: Multiple blocks per frame in ADTS not supported
packetizer_mpeg4audio error: Multiple blocks per frame in ADTS not supported
packetizer_mpeg4audio error: Multiple blocks per frame in ADTS not supported
packetizer_mpeg4audio error: Multiple blocks per frame in ADTS not supported
packetizer_mpeg4audio error: Multiple blocks per frame in ADTS not supported
packetizer_mpeg4audio warning: Invalid ADTS header
packetizer_mpeg4audio error: Multiple blocks per frame in ADTS not supported
packetizer_mpeg4audio error: Multiple blocks per frame in ADTS not supported
packetizer_mpeg4audio error: Multiple blocks per frame in ADTS not supported
packetizer_mpeg4audio error: Multiple blocks per frame in ADTS not supported
packetizer_mpeg4audio error: Multiple blocks per frame in ADTS not supported
packetizer_mpeg4audio error: Multiple blocks per frame in ADTS not supported
packetizer_mpeg4audio error: Multiple blocks per frame in ADTS not supported

使用悬挂管道的错误我终于发现应该以这种方式告诉avenc_aac输出数据不是在RAW AAC中但在ADTS AAC中,关键是我不知道怎么做GStreamer的。请参见页面底部:FFMPEG Ticket

此时我发现没有文档似乎说我们不支持GStreamer中的AAC编码......这不是真的,我猜! (如果AVENC_AAC要求所有时间都设置为实验模式,恕我直言,似乎很奇怪FAAC的缺失)

有人可以提出一个有效的管道吗?

更新

经过一些研究后,我发现(通过gven-inspect on avenc_aac)我可能正在寻找什么,但我不知道如何根据需要设置它。 看一下流格式:

Pad Templates:
  SRC template: 'src'
    Availability: Always
    Capabilities:
      audio/mpeg
               channels: [ 1, 6 ]
                   rate: [ 4000, 96000 ]
            mpegversion: 4
          stream-format: raw
        base-profile: lc

由于

1 个答案:

答案 0 :(得分:0)

还有voaacenc是AAC编码器。另请尝试在AAC编码器元素之后添加aacparse