为什么有的文件AAC音频解码会这样子

Input channel count and layout are unset
url=rtsp://192.168.13.180:554/HN20200113_191814.ts,video codec_id=0x1b, audio codec_id=0x15002 m_videoType=96 audioindex=1 proto=tcp transport proto=rtsp

CRx::SendStream<4033>: [4]更新解码器 96,1,5 >> 96,1,5
CShmExe::Process<826>: 长度检测成功<4033ms> 长度:2016bytes!
[aac @ 0x1fefbd0] get_buffer() failed
decode error
[aac @ 0x1fefbd0] getMMB LEAK(pid=1314): 0x50218000, 65536 bytes, 'AO(1,0) CirBuf'
_buffer() failed
decode error
mz_userdev_release: mmb<0x50218000> mapped to userspace 0xb4ca5000 will be force unmaped!
36m[aac @ 0x1fefbd0] get_buffMMB LEAK(pid=1314): 0x91FDC000, 65536 bytes, 'AO(2,0) CirBuf'
er() failed
decode error
[ammz_userdev_release: mmb<0x91FDC000> mapped to userspace 0xb4c95000 will be force unmaped!
ac @ 0x1fefbd0] get_buffer() MMB LEAK(pid=1314): 0x91FF8000, 65536 bytes, 'AO(0,0) CirBuf'
failed
decode error
[aac @ mmz_userdev_release: mmb<0x91FF8000> mapped to userspace 0xb4c85000 will be force unmaped!
0x1fefbd0] get_buffer() faileMMB LEAK(pid=1314): 0x9201C000, 86016 bytes, 'AENC(0)StrmBuf'
d
decode error
[aac @ 0x1femmz_userdev_release: mmb<0x9201C000> mapped to userspace 0xb1c5c000 will be force unmaped!
fbd0] get_buffer() failed
MB LEAK(pid=1314): 0x50229000, 32768 bytes, 'AENC(0) CirBuf'
0mdecode error
[aac @ 0x1fefbd0]mmz_userdev_release: mmb<0x50229000> mapped to userspace 0xb1c54000 will be force unmaped!
 get_buffer() failed
decMMB LEAK(pid=1314): 0x92031000, 86016 bytes, 'AENC(1)StrmBuf'
ode error
[aac @ 0x1fefbd0] mmz_userdev_release: mmb<0x92031000> mapped to userspace 0xb143f000 will be force unmaped!
get_buffer() failed
decode eMMB LEAK(pid=1314): 0x92046000, 32768 bytes, 'AENC(1) CirBuf'
rror
[aac @ 0x1fefbd0] mz_userdev_release: mmb<0x92046000> mapped to userspace 0xb1437000 will be force unmaped!
1mget_buffer() failed
decode error
[aac @ 0x1fefbd0] get_buffer() failed
decode error
[aac @ 0x1fefbd0] get_buffer() failed
decode error
[aac @ 0x1fefbd0] get_buffer() failed
decode error
[aac @ 0x1fefbd0] get_buffer() failed
decode error
[aac @ 0x1fefbd0] get_buffer() failed
decode error
[aac @ 0x1fefbd0] get_buffer() failed
decode error
[aac @ 0x1fefbd0] get_buffer() failed
decode error
[aac @ 0x1fefbd0] get_buffer() failed
decode error
[aac @ 0x1fefbd0] get_buffer() failed
decode error
[aac @ 0x1fefbd0] get_buffer() failed
decode error
[aac @ 0x1fefbd0] Error decoding AAC frame header.


[NULL @ 0x2af4ec0] SPS unavailable in decode_picture_timing
[NULL @ 0x2af4ec0] non-existing PPS 0 referenced
[h264 @ 0x2af4ec0] SPS unavailable in decode_picture_timing
[h264 @ 0x2af4ec0] non-existing PPS 0 referenced
[h264 @ 0x2af4ec0] decode_slice_header error
[h264 @ 0x2af4ec0] no frame!
[rtsp @ 0x2af5ce0] Stream #0: not enough frames to estimate rate; consider increasing probesize
[rtsp @ 0x2af5ce0] decoding for stream 0 failed
[rtsp @ 0x2af5ce0] Could not find codec parameters for stream 0 (Video: h264 ([27][0][0][0] / 0x001B), none): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[rtsp @ 0x2af5ce0] Could not find codec parameters for stream 1 (Audio: aac ([15][0][0][0] / 0x000F), 0 channels): unspecified sample format
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, rtsp, from 'rtsp://192.168.13.180:554/HN20200113_191814.ts':
  Metadata:
    title           : MPEG Transport Stream, streamed by the LIVE555 Media Server
    comment         : HN20200113_191814.ts
  Duration: N/A, start: 0.000000, bitrate: N/A
  Program 1 
    Metadata:
      service_name    : 
      service_provider: 
    Stream #0:0: Video: h264 ([27][0][0][0] / 0x001B), none, 90k tbr, 90k tbn
    Stream #0:1: Audio: aac ([15][0][0][0] / 0x000F), 0 channels
[SWR @ 0x2afa100] Input channel count and layout are unset
url=rtsp://192.168.13.180:554/HN20200113_191814.ts,video codec_id=0x1b, audio codec_id=0x15002 m_videoType=96 audioindex=1 proto=tcp transport proto=rtsp

[aac @ 0x2a91e70] get_buffer() failed
decode error
MB LEAK(pid=1384): 0x50218000, 65536 bytes, 'AO(1,0) CirBuf'
1;31mget_buffer() failed
decode errmmz_userdev_release: mmb<0x50218000> mapped to userspace 0xb4bfb000 will be force unmaped!
or
[aac @ 0x2a91e70] MMB LEAK(pid=1384): 0x91FDC000, 65536 bytes, 'AO(2,0) CirBuf'
get_buffer() failed
decode error
mz_userdev_release: mmb<0x91FDC000> mapped to userspace 0xb4beb000 will be force unmaped!
[0;36m[aac @ 0x2a91e70] get_bMMB LEAK(pid=1384): 0x91FF8000, 65536 bytes, 'AO(0,0) CirBuf'
uffer() failed
decode error
mz_userdev_release: mmb<0x91FF8000> mapped to userspace 0xb4bdb000 will be force unmaped!
m[aac @ 0x2a91e70] get_bufferMMB LEAK(pid=1384): 0x9201C000, 86016 bytes, 'AENC(0)StrmBuf'
() failed
decode error
[aacmmz_userdev_release: mmb<0x9201C000> mapped to userspace 0xb1bb2000 will be force unmaped!
 @ 0x2a91e70] get_buffer() faMMB LEAK(pid=1384): 0x50229000, 32768 bytes, 'AENC(0) CirBuf'
iled
decode error
[aac @ 0xmmz_userdev_release: mmb<0x50229000> mapped to userspace 0xb1baa000 will be force unmaped!
MMB LEAK(pid=1384): 0x92031000, 86016 bytes, 'AENC(1)StrmBuf'

decode error
[aac @ 0x2a91emmz_userdev_release: mmb<0x92031000> mapped to userspace 0xb1395000 will be force unmaped!
70] get_buffer() failed
MMB LEAK(pid=1384): 0x92046000, 32768 bytes, 'AENC(1) CirBuf'
decode error
[aac @ 0x2a91e70] mz_userdev_release: mmb<0x92046000> mapped to userspace 0xb138d000 will be force unmaped!
[0mError decoding AAC frame header.
decode error

StreamThreadCB<158>: 开始线程(0.1475): rtsp://192.168.13.180:554/CCTV220200113_191530.ts
[aac @ 0x2a83a00] Multiple frames in a packet.
[NULL @ 0x2a9fbe0] SPS unavailable in decode_picture_timing
[NULL @ 0x2a9fbe0] non-existing PPS 0 referenced
[h264 @ 0x2a9fbe0] SPS unavailable in decode_picture_timing
[h264 @ 0x2a9fbe0] non-existing PPS 0 referenced
[h264 @ 0x2a9fbe0] decode_slice_header error
[h264 @ 0x2a9fbe0] no frame!
[rtsp @ 0x2a5e2d0] Stream #1: not enough frames to estimate rate; consider increasing probesize
[rtsp @ 0x2a5e2d0] decoding for stream 1 failed
[rtsp @ 0x2a5e2d0] Could not find codec parameters for stream 1 (Video: h264 ([27][0][0][0] / 0x001B), none): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, rtsp, from 'rtsp://192.168.13.180:554/CCTV220200113_191530.ts':
  Metadata:
    title           : MPEG Transport Stream, streamed by the LIVE555 Media Server
    comment         : CCTV220200113_191530.ts
  Duration: N/A, start: 32093.114011, bitrate: N/A
  Program 1 
    Stream #0:1: Video: h264 ([27][0][0][0] / 0x001B), none, 90k tbr, 90k tbn
    Stream #0:0: Audio: aac (LC), 48000 Hz, stereo, fltp
url=rtsp://192.168.13.180:554/CCTV220200113_191530.ts,video codec_id=0x1b, audio codec_id=0x15002 m_videoType=96 audioindex=0 proto=tcp transport proto=rtsp

[aac @ 0x2a83660] Multiple frames in a packet.
CRx::SendStream<4033>: [5]更新解码器 96,1,5 >> 96,1,5
[NULL @ 0x2a9fbe0] SPS unavailable in decode_picture_timing
[NULL @ 0x2a9fbe0] non-existing PPS 0 referenced
[NULL @ 0x2a9fbe0] SPS unavailable in decode_picture_timing
[NULL @ 0x2a9fbe0] non-existing PPS 0 referenced
[NULL @ 0x2a9fbe0] SPS unavailable in decode_picture_timing
[NULL @ 0x2a9fbe0] non-existing PPS 0 referenced
[NULL @ 0x2a9fbe0] SPS unavailable in decode_picture_timing
[NULL @ 0x2a9fbe0] non-existing PPS 0 referenced
[NULL @ 0x2a9fbe0] SPS unavailable in decode_picture_timing
[NULL @ 0x2a9fbe0] non-existing PPS 0 referenced
[NULL @ 0x2a9fbe0] SPS unavailable in decode_picture_timing
[NULL @ 0x2a9fbe0] non-existing PPS 0 referenced
[NULL @ 0x2a9fbe0] SPS unavailable in decode_picture_timing
[NULL @ 0x2a9fbe0] non-existing PPS 0 referenced
[NULL @ 0x2a9fbe0] SPS unavailable in decode_picture_timing
[NULL @ 0x2a9fbe0] non-existing PPS 0 referenced
[NULL @ 0x2a9fbe0] SPS unavailable in decode_picture_timing
[NULL @ 0x2a9fbe0] non-existing PPS 0 referenced
[NULL @ 0x2a9fbe0] SPS unavailable in decode_picture_timing
[NULL @ 0x2a9fbe0] non-existing PPS 0 referenced
[NULL @ 0x2a9fbe0] SPS unavailable in decode_picture_timing
[NULL @ 0x2a9fbe0] non-existing PPS 0 referenced
[NULL @ 0x2a9fbe0] SPS unavailable in decode_picture_timing
[NULL @ 0x2a9fbe0] non-existing PPS 0 referenced
[NULL @ 0x2a9fbe0] SPS unavailable in decode_picture_timing
[NULL @ 0x2a9fbe0] non-existing PPS 0 referenced
[NULL @ 0x2a9fbe0] SPS unavailable in decode_picture_timing
[NULL @ 0x2a9fbe0] non-existing PPS 0 referenced
[NULL @ 0x2a9fbe0] SPS unavailable in decode_picture_timing
[NULL @ 0x2a9fbe0] non-existing PPS 0 referenced
[NULL @ 0x2a9fbe0] SPS unavailable in decode_picture_timing
[NULL @ 0x2a9fbe0] non-existing PPS 0 referenced
[NULL @ 0x2a9fbe0] SPS unavailable in decode_picture_timing
[NULL @ 0x2a9fbe0] non-existing PPS 0 referenced
[NULL @ 0x2a9fbe0] SPS unavailable in decode_picture_timing
[NULL @ 0x2a9fbe0] non-existing PPS 0 referenced
[NULL @ 0x2a9fbe0] SPS unavailable in decode_picture_timing
[NULL @ 0x2a9fbe0] non-existing PPS 0 referenced
[NULL @ 0x2a9fbe0] SPS unavailable in decode_picture_timing
[NULL @ 0x2a9fbe0] non-existing PPS 0 referenced
[NULL @ 0x2a9fbe0] SPS unavailable in decode_picture_timing
[NULL @ 0x2a9fbe0] non-existing PPS 0 referenced

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 4
    评论
要在 MFC 框架下读取 AAC 音频文件并进行解码,可以使用开源的解码库如 FFMPEG 或者 OpenAL,这些库都提供了相应的 API 接口,可以在 MFC 中调用。 以下是一个简单的示例代码,使用 FFMPEG 库实现读取 AAC 音频文件解码: ```c++ #include <iostream> #include <string> #include <vector> #include <fstream> #include <sstream> // FFmpeg 头文件 extern "C" { #include <libavcodec/avcodec.h> #include <libavformat/avformat.h> #include <libswresample/swresample.h> } int main() { const char* input_filename = "test.aac"; // AAC 音频文件路径 const char* output_filename = "output.pcm"; // 输出解码后的 PCM 数据路径 // 1. 初始化 FFmpeg 库 av_register_all(); avcodec_register_all(); // 2. 打开输入音频文件 AVFormatContext* format_ctx = nullptr; if (avformat_open_input(&format_ctx, input_filename, nullptr, nullptr) != 0) { std::cerr << "Error: could not open input file " << input_filename << std::endl; return -1; } // 3. 获取音频流信息 if (avformat_find_stream_info(format_ctx, nullptr) < 0) { std::cerr << "Error: could not find stream information" << std::endl; avformat_close_input(&format_ctx); return -1; } // 4. 查找音频流 int audio_stream_index = -1; for (unsigned int i = 0; i < format_ctx->nb_streams; i++) { if (format_ctx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) { audio_stream_index = i; break; } } if (audio_stream_index == -1) { std::cerr << "Error: could not find audio stream" << std::endl; avformat_close_input(&format_ctx); return -1; } // 5. 获取音频解码器 AVCodecParameters* codecpar = format_ctx->streams[audio_stream_index]->codecpar; AVCodec* codec = avcodec_find_decoder(codecpar->codec_id); if (codec == nullptr) { std::cerr << "Error: could not find decoder for codec ID " << codecpar->codec_id << std::endl; avformat_close_input(&format_ctx); return -1; } // 6. 打开音频解码器 AVCodecContext* codec_ctx = avcodec_alloc_context3(codec); if (avcodec_parameters_to_context(codec_ctx, codecpar) < 0) { std::cerr << "Error: could not copy codec parameters to decoder context" << std::endl; avcodec_free_context(&codec_ctx); avformat_close_input(&format_ctx); return -1; } if (avcodec_open2(codec_ctx, codec, nullptr) < 0) { std::cerr << "Error: could not open decoder" << std::endl; avcodec_free_context(&codec_ctx); avformat_close_input(&format_ctx); return -1; } // 7. 初始化音频重采样器 SwrContext* swr_ctx = swr_alloc_set_opts(nullptr, codec_ctx->channel_layout, AV_SAMPLE_FMT_S16, codec_ctx->sample_rate, codec_ctx->channel_layout, codec_ctx->sample_fmt, codec_ctx->sample_rate, 0, nullptr); if (swr_ctx == nullptr) { std::cerr << "Error: could not allocate resampler context" << std::endl; avcodec_close(codec_ctx); avcodec_free_context(&codec_ctx); avformat_close_input(&format_ctx); return -1; } if (swr_init(swr_ctx) < 0) { std::cerr << "Error: could not initialize resampler context" << std::endl; swr_free(&swr_ctx); avcodec_close(codec_ctx); avcodec_free_context(&codec_ctx); avformat_close_input(&format_ctx); return -1; } // 8. 打开输出文件 std::ofstream output_file(output_filename, std::ios::binary); if (!output_file.is_open()) { std::cerr << "Error: could not open output file " << output_filename << std::endl; swr_free(&swr_ctx); avcodec_close(codec_ctx); avcodec_free_context(&codec_ctx); avformat_close_input(&format_ctx); return -1; } // 9. 解码音频数据 AVPacket packet; av_init_packet(&packet); packet.data = nullptr; packet.size = 0; AVFrame* frame = av_frame_alloc(); while (av_read_frame(format_ctx, &packet) >= 0) { if (packet.stream_index == audio_stream_index) { if (avcodec_send_packet(codec_ctx, &packet) == 0) { while (avcodec_receive_frame(codec_ctx, frame) == 0) { // 重采样音频数据 std::vector<uint8_t> buffer(codec_ctx->channels * frame->nb_samples * av_get_bytes_per_sample(AV_SAMPLE_FMT_S16)); uint8_t* output_data[1] = { buffer.data() }; int output_samples = swr_convert(swr_ctx, output_data, frame->nb_samples, (const uint8_t**)frame->extended_data, frame->nb_samples); if (output_samples > 0) { output_file.write((char*)buffer.data(), output_samples * codec_ctx->channels * av_get_bytes_per_sample(AV_SAMPLE_FMT_S16)); } } } } av_packet_unref(&packet); } // 10. 释放资源 av_frame_free(&frame); swr_free(&swr_ctx); avcodec_close(codec_ctx); avcodec_free_context(&codec_ctx); avformat_close_input(&format_ctx); return 0; } ``` 该示例程序把读取的 AAC 音频文件解码并重采样成 16 位 PCM 数据,然后保存到输出文件中。你可以根据需要修改代码,以满足你的具体需求。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

一水遮夏211

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值