bytestream_put_buffer(&p, "OpusHead", 8);
bytestream_put_byte(&p, 1); /* Version */
bytestream_put_byte(&p, channels);
bytestream_put_le16(&p, avctx->initial_padding); /* Lookahead samples at 48kHz */
bytestream_put_le32(&p, avctx->sample_rate); /* Original sample rate */
Data Fields
1 int OpusHead::version 1个字节
The Ogg Opus format version, in the range 0...255.
The top 4 bits represent a "major" version, and the bottom four bits represent
backwards-compatible "minor" revisions. The current specification describes version
1. This library will recognize versions up through 15 as backwards compatible with
the current specification. An earlier draft of the specification described a version 0, but
the only difference between version 1 and version 0 is that version 0 did not specify the
semantics for handling the version field.
2 int OpusHead::channel_count
The number of channels, in the range 1...255.
3 unsigned OpusHead::pre_skip =2字节
The number of samples that should be discarded丢弃 from the beginning of the stream.
4 opus uint32 OpusHead::input_sample_rate
The sampling rate of the original input.
All Opus audio is coded at 48 kHz, and should also be decoded at 48 kHz for playback
(unless the target hardware does not support this sampling rate). However, this field
may be used to resample the audio back to the original sampling rate, for example,
when saving the output to a file.
5 int OpusHead::output_gain
The gain to apply to the decoded output, in dB, as a Q8 value in the range.
-32768...32767. The decoder will automatically scale the output by pow(10,output_-
gain/(20.0256)).
6 int OpusHead::mapping_family
The channel mapping family, in the range 0...255.
Channel mapping family 0 covers mono or stereo in a single stream. Channel mapping
family 1 covers 1 to 8 channels in one or more streams, using the Vorbis speaker
assignments. Channel mapping family 255 covers 1 to 255 channels in one or more
streams, but without any defined speaker assignment.
7 int OpusHead::stream_count
The number of Opus streams in each Ogg packet, in the range 1...255.
8 int OpusHead::coupled_count
The number of coupled Opus streams in each Ogg packet, in the range 0...127.
This must satisfy 0 <= coupled_count <= stream_count and coupled-
_count + stream_count <= 255. The coupled streams appear first, before
all uncoupled streams, in an Ogg Opus packet.
9 unsigned char OpusHead::mapping[OPUS_CHANNEL_COUNT_MAX]
The mapping from coded stream channels to output channels.
Let index=mapping[k] be the value for channel k. If index<2coupled_-
count, then it refers to the left channel from stream (index/2) if even, and the
right channel from stream (index/2) if odd. Otherwise, it refers to the output of the
uncoupled stream (index-coupled_count).
opus_head_parse
ffmpeg的extradata
#define OPUS_HEAD_SIZE 19
Total: 19 ( 0x00000013 )
4F, 70, 75, 73, 48, 65, 61, 64, 01=version, 01=channels, (68, 00), 80, 3E, 00, 00,
(00, 00), 00, //OpusHead..h..>.....
bytestream_put_le16
解析通道数和采样率
int ch = audioCtx->extradata[9];
uint32_t hz=*(uint32_t*)&(audioCtx->extradata[12]);
aac 参数包大小4+11+2+2=19
opus=4+11+2+19=36
解析:
avc->channels = avc->extradata_size >= 10 ? avc->extradata[9] : (avc->channels == 1) ? 1 : 2;
参考:
opusfile_api-0.2(opus 规范).pdf
- argparse - 命令行选项与参数解析(转)
argparse - 命令行选项与参数解析(译)Mar 30, 2013 原文:argparse – Command line option and argument parsing 译者:young ...
- argparse - 命令行选项与参数解析
argparse模块作为optparse的一个替代被添加到Python2.7.argparse的实现支持一些不易于添加到optparse以及要求向后不兼容API变化的特性,因此以一个新模块添加到标准库 ...
- Python学习笔记之参数解析
python提供了两种方法进行命令行的参数解析,分别是getopt和optparse类中的模块OptionParser,下面分别详细了解这两个模块: 1.getopt模块 首先复习C语言的命令行解析: ...
- SpringMVC源码阅读:Controller中参数解析
1.前言 SpringMVC是目前J2EE平台的主流Web框架,不熟悉的园友可以看SpringMVC源码阅读入门,它交代了SpringMVC的基础知识和源码阅读的技巧 本文将通过源码(基于Spring ...
- Python内置的一个用于命令项选项与参数解析的模块argparse
一.argparse简单使用 我们先来看一个简单示例.主要有三个步骤: 创建 ArgumentParser() 对象 调用 add_argument() 方法添加参数 使用 parse_args() ...
- 写个C#命令行参数解析的小工具
最近测试工作做的比较多因此时常要创建一些控制台类型的应用程序.因为程序有不同的参数开关,需要在程序启动的时候通过命令行来给程序传递各种开关和参数.直接操作args有些不方便,所以就写了个解析参数的小工 ...
- Python--命令行参数解析Demo
写没有操作界面的程序时,最讨厌的就是参数解析问题,尤其是很多参数那种,下面是一个小Demo,拿出来与各位分享: # -*- coding:utf8 -*- import os import datet ...
- Node基础:url查询参数解析之querystring
模块概述 在nodejs中,提供了querystring这个模块,用来做url查询参数的解析,使用非常简单. 模块总共有四个方法,绝大部分时,我们只会用到 .parse(). .stringify() ...
- Zookeeper + Hadoop2.6 集群HA + spark1.6完整搭建与所有参数解析
废话就不多说了,直接开始啦~ 安装环境变量: 使用linx下的解压软件,解压找到里面的install 或者 ls 运行这个进行安装 yum install gcc yum install gcc-c+ ...
随机推荐
- sql server博客
SQLSERVER MSDN论坛 SQLSERVER 补丁博客 SQLSERVER中国研发中心 微软亚太区数据库技术支持组官方博客 PAUL的SQLSKILL网站 sqlsaturday网站 sqls ...
- java 的 CopyOnWriteArrayList类
初识CopyOnWriteArrayList 第一次见到CopyOnWriteArrayList,是在研究JDBC的时候,每一个数据库的Driver都是维护在一个CopyOnWriteArrayLis ...
- redis基本命令,配置参数
https://www.w3cschool.cn/redis/redis-pub-sub.html redis-server --maxclients 100000 客户端命令CLIENT LIST ...
- Linux GPRS模块问题
这是一个硬件问题,不过被我这个学软件的给遇到了.很尴尬,纠结了很久. GPRS模块如果没有插上sim卡,开机之后一切正常.一旦插上卡之后开机大约过十秒钟之后会自动关机.并在串口上面打印一下信息: II ...
- Snapdragon profiler连android手机
oppo11 晓龙660 找一根好用的usb数据线 去设置->开发者选项->usb调试 打开(十分钟会自动关,注意再开开) 去windows cmd ===adb devices 会列出这 ...
- 深入浅出 消息队列 ActiveMQ (转)
启动成功就可以访问管理员界面:http://localhost:8161/admin,默认用户名和密码admin/admin.如果你想修改用户名和密码的话,在conf/jetty-realm.prop ...
- 进程资源和进程状态 TASK_RUNNING TASK_INTERRUPTIBLE TASK_UNINTERRUPTIBLE
摘要:本文主要介绍进程资源和进程状态.进程资源由两部分组成:内核空间进程资源以及用户空间进程资源.进程状态,就绪/执行状态.等待状态(能够被中断打断).等待状态(不能够被中断打断).停止状态和僵死状态 ...
- Android自己定义button实现长按功能
Android自己定义button实现长按功能 通过自己定义BUTTON,写一个LongTouchBtn类,在按下的时候运行onTouchEvent事件,通过这个事件使用回调函数来实现长按功能! XM ...
- JUnit4.8.2源码分析-1 说明
阅读本系列文章时须要知道的: JUnit是由GOF 之中的一个的Erich Gamma和 Kent Beck 编写的一个开源的单元測试框架,分析JUnit源码的主要目的是学习当中对设计模式的运用.JU ...
- redislive
安装Redis Live监控服务 分类: redis 2014-06-25 20:24 436人阅读 评论(0) 收藏 举报 redis redis live为监控redis服务的软件,带有监控web ...