swr_convert函数介绍
来源:互联网 发布:linux查看集群 硬盘 编辑:程序博客网 时间:2024/06/16 08:18
转自http://blog.csdn.net/disadministrator/article/details/43966017
由于ffmpeg最新版本(从2.1开始貌似)使用avcodec_decode_audio4函数来解码音频,但解码得到的数据类型为float 4bit,而播放器播放的格式一般为S16(signed 16bit),就需要对解码得到的数据进行转换,然而,ffmpeg已经帮我们做好了,只需调用API就可以了,这个函数就是:swr_convert
以下为从ffmpeg官网的复制:
原型:int swr_convert(struct SwrContext * s, uint8_t ** out, int out_count, const uint8_t ** in, int in_count )
Convert audio.
in and in_count can be set to 0 to flush the last few samples out at the end.
If more input is provided than output space then the input will be buffered. You can avoid this buffering by providing more output space than input.
Convertion will run directly without copying whenever possible.
in和in_count可设置为0,把最后几个样本冲洗出来。
如果提供更多的输入比输出空间,则输入将被缓冲。您可以通过提供比输入更多的输出空间来避免这种缓冲.
转换将直接运行尽可能不复制。
- Parameters
- sallocated Swr context, with parameters setoutoutput buffers, only the first one need be set in case of packed audioout_countamount of space available for output in samples per channelininput buffers, only the first one need to be set in case of packed audioin_countnumber of input samples available in one channel
- S:分配的Swr context结构体(里面有参数的设置)
- out :输出缓冲区,只有第一个需要设置的情况下,包装音频
- out_count :每通道可用输出样本的数量
- in: 输入缓冲区,只有第一个需要设置的情况下,包装音频
- 解码后原始数据(对视频来说是YUV,RGB,对音频来说是PCM)
- in_count :每通道可用输入样本的数量(音频的一个AVFrame中可能包含多个音频帧,在此标记包含了几个)
- Returns
- number of samples output per channel, negative value on error
- 每个通道输出的样本数,负值是错误的
- swr_convert函数介绍
- swr_convert函数介绍
- FFmpeg学习—ffmpeg 利用 swr_convert 函数将AV_SAMPLE_FMT_S16 转 AV_SAMPLE_FMT_FLTP
- swr_convert音频重采样成AV_SAMPLE_FMT_FLTP
- 最新(2.44)FFmpeg音频播放 ----- 关键点swr_convert
- ffmpeg音频转码,采用swr_convert重取样
- ffmpeg音频转码,采用swr_convert重取样
- 最新(2.44)FFmpeg音频播放 ----- 关键点swr_convert
- ffmpeg avcodec_decode_audio4解码 swr_convert 转换为AV_SAMPLE_FMT_S16格式
- ffmpeg重采样中swr_convert和swr_get_out_samples的用法
- ffmpeg音频转码,采用swr_convert重取样
- FFmpeg swr_convert 音频重采样,编码的噪音问题
- 【算法函数介绍】Hash函数介绍
- wave函数介绍
- waveOutWrite函数介绍
- waveOutOpen函数介绍
- oracle 日期函数介绍
- GetLastError()函数的介绍
- React实战-深入源码了解Redux用法之Middleware
- 定时器中断
- PHP的运行机制与原理(底层)
- JSP解析JSON对象
- 决策树ID3算法-matlab实现
- swr_convert函数介绍
- OpenCV2.0.0移植到ARM9(一)(JZ2440----S3c2440)
- Python金融大数据分析-BSM、Term Struc、Ho-Lee 与Vasicek模型路径仿真
- 欢迎使用CSDN-markdown编辑器
- Lambda表达式详解
- javascript知识结构图
- 测试小故事11:登录与登陆
- C#编写的UDP收发数据 单独的接收数据程序可以用 但是写的接收和发送的不好使
- linux----查找文件 命令简述