当前位置:网站首页>ffmpeg音频解码使用遇到问题总结
ffmpeg音频解码使用遇到问题总结
2022-04-22 21:22:00 【霍宏鹏】
wav音频channel_layout为0
在使用ffmpeg解码wav数据的时候,通道数是正确的,但是stream->codecpar->channel_layout为0,如果此时
swr_alloc_set_opts(struct SwrContext *s,
int64_t out_ch_layout, enum AVSampleFormat out_sample_fmt, int out_sample_rate,
int64_t in_ch_layout, enum AVSampleFormat in_sample_fmt, int in_sample_rate,
int log_offset, void *log_ctx);
进行音频数据转换的时候,需要通道布局的参数。如果直接将解码器的channel_layout做参数给swr_alloc_set_opts()肯定会出错。所以可以通过stream->codecpar->channels通道个数进行判断,如果channels通道个数为1,那么强制通道布局为AV_CH_LAYOUT_MONO,如果channels通道个数为2,那么强制通道布局为AV_CH_LAYOUT_STEREO。
格式工厂转换的mp3文件帧数
通过格式工厂转换的mp3解码第一package数据只包含47个音频帧(一般都是包含1152个数据帧),而且最后一个package解出的音频帧个数也是不固定的,所以向alsa设备中填入数据的时候注意音频对齐。否则大概率会在结束的时候产生噪声。数据对齐可以参考:
版权声明
本文为[霍宏鹏]所创,转载请带上原文链接,感谢
https://huohongpeng.blog.csdn.net/article/details/119670171
边栏推荐
- Comprehensive comparison of the most complete software testing tools and packet capturing tools
- Solution Sudoku [pre DS hash structure + component DFS | pre-hash-1-9 feature -- binary state compression + DFS]
- 【工具配置篇】Visual Studio 中由 designer 生成的. ui 文件未能及時更新問題的解决方案
- OpenVX 的 立即模式(immediate mode)和图模式(graph mode)和示例讲解
- TensorFlow基础知识
- Analysis of tourism products: travel around
- Pytoch note58 CNN visualization
- [browser] the translation provided by Google browser is invalid
- QTP11.5/UFT含中文汉化包
- Redis master-slave replication
猜你喜欢

MySQL specifies field sorting and user-defined sorting location

Basic design of character animation based on paogd
![[IPTV]华为悦盒EC6108V9A刷机](/img/96/40eed4fddf627c3749d0f3bb3fc8f6.png)
[IPTV]华为悦盒EC6108V9A刷机

News Express I mobtech passed the "special safety evaluation" of China Academy of information and communications

Knowledge of machine vision

JMeter data and software

Redis publish and subscribe

The latest version of watermark + takeout CPS applet source code
![[browser] the translation provided by Google browser is invalid](/img/12/b6213c9c8bf097d4260461535a1329.png)
[browser] the translation provided by Google browser is invalid
![[data cleaning and drawing] simple application of dataframe](/img/4b/aa119ada8d3267d180735fc2216bb9.png)
[data cleaning and drawing] simple application of dataframe
随机推荐
cuda10.2安装torch1.9
Function and principle of join in thread
毕业五年,如何从月薪5K涨到年薪50W+,需要掌握哪些核心技能?
Basic design of character animation based on paogd
C randomly obtains one from list or string
Tensorflow Basics
Thread中join的作用和原理
简单介绍常用数据库引擎
Big talk jmeter4 | can different concurrent numbers be used for automatic pressure measurement?
.bashrc . bash_ profile . bash_ logout . bash_ history
最新版去水印+外卖cps小程序源码
All paths of 344 leetcode binary tree
Mapping configuration files to classes in. Net core
Freemodbus Quick Start Guide
M5增强版双系统套餐包含哪些重要配件,该怎么选?
Leetcode-209-subarray with the smallest length
Adobe series error code solutions summary
HDLBits(十 一)学习笔记——有限状态机(FSM onehot - Fsm serialdp)
Solving SCP command secret free login in shell script
Summary of software testing knowledge points | JMeter implementation Interface Association