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+ ...
随机推荐
- Flex页面跳转的五种实现方式
Flex页面跳转有很多值得学习的地方,本文向大家介绍一下Flex页面跳转的几种方式,主要包括五种方式,这里为大家一一介绍. AD: 在学习Flex的过程中,你可能会遇到Flex页面跳转的概念,这里 ...
- windbg学习—-.ecxr
.ecxr 命令定位当前异常的上下文信息,并显示指定记录中的重要寄存器 0:000> .ecxr eax=10000000 ebx=7ffd9000 ecx=77386500 edx=002 ...
- Kubernetes dashboard集成heapster
图形化展示度量指标的实现需要集成k8s的另外一个Addons组件: Heapster . Heapster原生支持K8s(v1.0.6及以后版本)和 CoreOS ,并且支持多种存储后端,比如: In ...
- es6的模块化;js的模块化
现在感觉Java.Python.Js都是越来越工程花,模块化.懂得每个模块的功能和使用场景,你很快的就能搭起一个功能齐备的应用.至于应用的性能.稳定性等,还在于你对模块的理解深度以及组合的成熟度,就看 ...
- 一起來玩鳥 Starling Framework 簡介
開場 Starling Framework是一套Flash 2D遊戲開發"工具",是使用Flash最新的Stage3D API建構出來的一套Framework.最大優點在於使用GP ...
- Android实战简易教程-第十枪(画廊组件Gallery有用研究)
Gallery组件用于拖拽浏览图片,以下我们就来看一下怎样实现. 一.实现Gallery 1.布局文件非常easy: <?xml version="1.0" encoding ...
- RDD编程 下(Spark自学四)
3.5 常见的转化操作和行动操作 3.5.1 基本RDD 1. 针对各个元素的转化操作 两个最常用的转化操作是map()和filter().转化操作map()接受一个函数,把这个函数用于RDD中的每个 ...
- ParallelProgramming-多消费者,多生产者同时运行并行
在上一篇文章演示了并行的流水线操作(生产者和消费者并行同时执行),C#是通过BlockingCollection这个线程安全的对象作为Buffer,并且结合Task来实现的.但是上一篇文章有个缺陷,在 ...
- Mycat探索之旅(3)----Mycat的全局序列号
一.本地文件方式 原理:此方式MyCAT将sequence配置到文件中,当使用到sequence中的配置后,MyCAT会更下classpath中的sequence_conf.properties文件中 ...
- Django——如何使用Template以及如何向template传递变量
如何使用模板系统 在Python代码中使用Django模板的最基本方式如下: 可以用原始的模板代码字符串创建一个 Template 对象, Django同样支持用指定模板文件路径的方式来创建 Temp ...