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+ ...
随机推荐
- IIS中使用Microsoft.Office.Interop.Excel 常见问题:RPC 服务器不可用。 (异常来自 HRESULT:0x800706BA) 的异常。等
IIS中使用Microsoft.Office.Interop.Excel 异常1: 检索 COM 类工厂中 CLSID 为 {00024500-0000-0000-C000-000000000046} ...
- Oracle TRCA 工具 说明 10046
本篇文章主要介绍了"Oracle TRCA 工具 说明 ",主要涉及到Oracle TRCA 工具 说明 方面的内容,对于Oracle TRCA 工具 说明 感兴趣的同学可以参考一 ...
- 解决sqlite删除数据后,文件大小不变问题 转载
原文地址:http://blog.csdn.net/yangchun1213/article/details/7656146 说了这么多,没进主题,我的主题是给Sqlite在删除数据后擦屁股. 大 ...
- canvas如何兼容IE8
大家都知道canvas是个非常好玩的东西,但是IE9以下的浏览器不支持,有时候业务需求必须用到canvas,且又要求兼容IE8浏览器,那怎么办呢? 1.添加对html5的支持:<!--[if I ...
- python安全编程
##入门 这将是第一个一系列关于python编程的博客文章.python是一门非常强大的语言,因为它有信息安全社区的支撑.这意味着很多工具都是由python编写并且可以在脚本中调用很多模块.使用模块的 ...
- 【招聘App】—— React/Nodejs/MongoDB全栈项目:信息完善&用户列表
前言:最近在学习Redux+react+Router+Nodejs全栈开发高级课程,这里对实践过程作个记录,方便自己和大家翻阅.最终成果github地址:https://github.com/66We ...
- iOS小技巧 - 如何生成范围随机数
生成[0, N-1]的随机数 NSUInteger r = arc4random_uniform(N); 生成[1, N]的随机数 NSUInteger r = arc4random_uniform( ...
- 深入浅出 消息队列 ActiveMQ (转)
启动成功就可以访问管理员界面:http://localhost:8161/admin,默认用户名和密码admin/admin.如果你想修改用户名和密码的话,在conf/jetty-realm.prop ...
- hibernate学习系列-----(9)hibernate对集合属性的操作之Map集合篇
照旧,先新建一个StudentMap.java实体类,将hobby属性使用map集合接口来存放: package com.joe.entity; import java.util.Map; publi ...
- js apply和call区别
<!DOCTYPE html> <html lang="zh"> <head> <meta charset="UTF-8&quo ...