1、faac

example

./configure --prefix=$(pwd)/_install

make

make install

/* aac_encode.c */
#include <stdio.h>
#include <faac.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h> int main (int argc, char **argv)
{
unsigned long sampleRate = 8000;
unsigned int numChannels = 1;
unsigned long inputSample = 0;
unsigned long maxOutputBytes = 0;
faacEncHandle encoder;
faacEncConfigurationPtr config;
FILE *rfile = NULL;
FILE *wfile = NULL;
int16_t *pcm_input = NULL;
uint8_t *aac_output = NULL;
int readcount = 0;
int writecount = 0; encoder = faacEncOpen(sampleRate, numChannels, &inputSample, &maxOutputBytes);
config = faacEncGetCurrentConfiguration(encoder);
config->aacObjectType = MAIN;
config->mpegVersion = MPEG4;
config->useLfe = 0;
config->useTns = 1;
config->allowMidside = 1;
/*RAW_STREAM=0, ADTS_STREAM=1*/
config->outputFormat = 1;
config->bitRate = sampleRate;
config->inputFormat = FAAC_INPUT_16BIT;
faacEncSetConfiguration(encoder, config); printf("sampleRate:%ld, numChannels:%d, inputSample:%ld, maxOutputBytes:%ld\n",
sampleRate, numChannels, inputSample, maxOutputBytes); if (argv[1]) {
rfile = fopen(argv[1], "rb");
} else {
printf("try to open input.pcm\n");
rfile = fopen("input.pcm", "rb");
} if (!rfile) {
printf("open error\n");
goto end;
} if (argv[2]) {
wfile = fopen(argv[2], "wb");
} else {
printf("try to open output.aac\n");
wfile = fopen("output.aac", "wb");
} if (!wfile) {
printf("open error\n");
goto end;
} pcm_input = (int16_t *)malloc(inputSample * sizeof(int16_t));
aac_output = (uint8_t *)malloc(maxOutputBytes * sizeof(uint8_t)); /* encode */
while (1) {
int readlen = 0;
int ret = 0; readlen = fread(pcm_input, sizeof(int16_t), inputSample, rfile); ret = faacEncEncode(encoder, (int32_t *)pcm_input, readlen, aac_output, maxOutputBytes); if (ret > 0) {
fwrite(aac_output, sizeof(uint8_t), ret, wfile);
} else if (ret < 0) {
printf("encode error\n");
break;
} readcount += readlen * 2;
writecount += ret; if (!readlen && !ret) {
printf("encode complete, from %d bytes to %d bytes\n", readcount, writecount);
break;
}
} free(pcm_input);
free(aac_output); end:
if (wfile) fclose(wfile);
if (rfile) fclose(rfile);
faacEncClose(encoder);
return 0;
}

Makefile

APP = main

INCLUDE = \
-I ./faac/include

LIB = \
-L ./faac/lib/

SRC  = main.c

CFLAGS =

LDFLAGS = -lfaac

out:
    gcc $(SRC) -o $(APP) $(LIB) $(INCLUDE) $(CFLAGS) $(LDFLAGS)

clean:
    rm -rf *o *.out $(APP)

2、faac/faad <--- > pcm

https://www.audiocoding.com/downloads.html

3、g711 <---> pcm

https://github.com/phoenixZZZ/G711_EncodecAndDecodec

https://github.com/Wenstery/G711AudioStream

https://github.com/escrichov/G711

codec-for-audio-in-G72X-G711-G723-G726-G729

https://github.com/twstx1/codec-for-audio-in-G72X-G711-G723-G726-G729/blob/master/G711_G721_G723/encode.c

非常好的实例,已经用在产品里了,感谢作者!

An ANSI C library for encoding/decoding using the A-law and u-Law.

https://github.com/dystopiancode/pcm-g711

https://blog.csdn.net/szfhy/article/details/52448906

html读写excle文档的更多相关文章

  1. 使导出excle文档实现ALT+Enter的效果()

    JAVA中输入什么转义字符,使导出excle文档实现ALT+Enter的效果?或者有没有其他方法可以实现. 20 JAVA中输入什么转义字符,使导出excle文档实现ALT+Enter的效果?或者有没 ...

  2. C#操作Xml:通过XmlDocument读写Xml文档

    什么是Xml? Xml是扩展标记语言的简写,是一种开发的文本格式.关于它的更多情况可以通过w3组织了解http://www.w3.org/TR/1998/REC-xml-19980210.如果你不知道 ...

  3. dom4j读写XML文档

    dom4j 最常用最简单的用法(转) 要使用dom4j读写XML文档,需要先下载dom4j包,dom4j官方网站在 http://www.dom4j.org/目前最新dom4j包下载地址:http:/ ...

  4. python+selenium自动化软件测试(第12章):Python读写XML文档

    XML 即可扩展标记语言,它可以用来标记数据.定义数据类型,是一种允许用户对自己的标记语言进 行定义的源语言.xml 有如下特征: 首先,它是有标签对组成:<aa></aa> ...

  5. Docx组件读写Word文档介绍

    Docx介绍 官方原文:DocX is a .NET library that allows developers to manipulate Word 2007/2010/2013 files, i ...

  6. BCB 读写Word文档

    void __fastcall TForm1::btn1Click(TObject *Sender) { Variant WordApp,WordDocs,WordDoc; Variant word_ ...

  7. 读写XML文档时,去掉新增加节点的“空命名空间”(xmlns=””)

    在做对ReprotViewer编程时,想做一个用户可以更改显示/打印列的功能,大致看了下,只需要通过对rdlc文件中改变其<Hidden>节点值为false/true,即可实现对应某列的显 ...

  8. 通过XmlDocument读写Xml文档参考地址

    /// <summary> /// 获取一个报表的参数 http://blog.csdn.net/hdhai9451/article/details/12170069 /// </s ...

  9. $用python-docx模块读写word文档

    工作中会遇到需要读取一个有几百页的word文档并从中整理出一些信息的需求,比如产品的API文档一般是word格式的.几百页的文档,如果手工一个个去处理,几乎是不可能的事情.这时就要找一个库写脚本去实现 ...

随机推荐

  1. 树链剖分 + 后缀数组 - E. Misha and LCP on Tree

    E. Misha and LCP on Tree Problem's Link Mean: 给出一棵树,每个结点上有一个字母.每个询问给出两个路径,问这两个路径的串的最长公共前缀. analyse: ...

  2. phpstrom xdebug wamp调试配置文档

    下载并安装phpstorm,下载地址如下 http://download-cf.jetbrains.com/webide/PhpStorm-9.0.2.exe 安装完成后,完成注册,注册方法如下   ...

  3. pychram最新注册码

    2016年的激活码只能用到2017.2.25,于昨日已经过期了. 现提供最新激活码: BIG3CLIK6F-eyJsaWNlbnNlSWQiOiJCSUczQ0xJSzZGIiwibGljZW5zZW ...

  4. Apache里的httpd-vhosts.conf详解

    首先看下面的配置: <VirtualHost *:80> ServerAdmin webmaster@dummy-host.example.com DocumentRoot "D ...

  5. requirejs源码分析,使用注意要点

    本文将深度剖析require.js代码,为了是大家更高效.正确的去使用它,本文不会介绍require的基本使用! 概要 先来一个流程图来概要一下大概流程 在require中,根据AMD(Asynchr ...

  6. JAVA增删改查XML文件

    最近总是需要进行xml的相关操作. 不免的要进行xml的读取修改等,于是上网搜索,加上自己的小改动,整合了下xml的常用操作. 读取XML配置文件 首先我们需要通过DocumentBuilderFac ...

  7. UE4读取配置文件里面的key-value

    在MyProject/Config/DefaultGame.ini配置文件中添加 [RamaUDP]listenPort=2017PrintLog=false C++代码读取 int32 listen ...

  8. 使用HTML5 WebStorage API构建与.NET对应的会话机制

    HTML5的Web Storage API,我们也称为DOMStarage API,用于在Web请求之间持久化数据.在Web Starage API 出现之前,我们都是将客户端和服务端之间的交互数据存 ...

  9. phpredis 中文手册和redis 教程

    phpredis 中文手册  :   http://www.cnblogs.com/zcy_soft/archive/2012/09/21/2697006.html 手册: http://www.cn ...

  10. Android FragmentActivity 给Fragment传值

    1.Fragment给Activity传值 定义一个在fragment 中 定义interface 监听器,让activity实现,并将activity的引用传递给fragment.即setListe ...