1、opencore-amr源码下载

https://sourceforge.net/projects/opencore-amr/files/opencore-amr/

2、opencore-amr编译

交叉编译到arm平台

./configure --host=arm-linux-gnueabihf --prefix='/home/dong/pocdemo/opencore-amr-0.1.3/arm'

make

make install

3、opencore-amr的应用

1) opencore-amr静态库的使用
arm-linux-gnueabihf-g++ -o demo demo.c -I ./opencore-amr/include/opencore-amrnb libpoc.a ./opencore-amr/lib/libopencore-amrnb.a -lpthread

2) opencore-amr动态库的使用
arm-linux-gnueabihf-g++ -o demo demo.c -I ./opencore-amr/include/opencore-amrnb -L ./ -lpoc -L ./opencore-amr/lib -lopencore-amrnb -lpthread

3) opencore-amr静态库动态库混合的使用
arm-linux-gnueabihf-g++ -o demo demo.c -I ./opencore-amr/include/opencore-amrnb -L ./ -lpoc ./opencore-amr/lib/libopencore-amrnb.a -lpthread

4、源码包里的 opencore-amr/test/amrnb-enc-sine.c

编码一段正玄波

  1. /* ------------------------------------------------------------------
  2. * Copyright (C) 2009 Martin Storsjo
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
  13. * express or implied.
  14. * See the License for the specific language governing permissions
  15. * and limitations under the License.
  16. * -------------------------------------------------------------------
  17. */
  18.  
  19. #include <stdio.h>
  20. #include <stdint.h>
  21. #include <math.h>
  22. #include <interf_enc.h>
  23.  
  24. int main(int argc, char *argv[]) {
  25. int i, j;
  26. void* amr;
  27. FILE* out;
  28. int sample_pos = ;
  29.  
  30. if (argc < ) {
  31. fprintf(stderr, "%s out.amr\n", argv[]);
  32. return ;
  33. }
  34.  
  35. amr = Encoder_Interface_init();
  36. out = fopen(argv[], "wb");
  37. if (!out) {
  38. perror(argv[]);
  39. return ;
  40. }
  41.  
  42. fwrite("#!AMR\n", , , out);
  43. for (i = ; i < ; i++) {
  44. short buf[];
  45. uint8_t outbuf[];
  46. int n;
  47. for (j = ; j < ; j++) {
  48. buf[j] = *sin(**3.141592654*sample_pos/);
  49. sample_pos++;
  50. }
  51. n = Encoder_Interface_Encode(amr, MR475, buf, outbuf, );
  52. fwrite(outbuf, , n, out);
  53. }
  54. fclose(out);
  55. Encoder_Interface_exit(amr);
  56.  
  57. return ;
  58. }

arm-linux-gnueabihf-gcc -o amrnb-enc-sine amrnb-enc-sine.c -I ./opencore-amr/include/opencore-amrnb ./opencore-amr/lib/libopencore-amrnb.a

5、PCM与AMR互转

https://github.com/gansidui/pcm_amr_codec

dong@ubuntu:~/amr/example$ tree
.
├── build_example_amr2pcm_arm.sh
├── build_example_pcm2amr_x86.sh
├── codec
│   ├── amrnb.c
│   ├── amrnb.h
│   ├── audio_format_convert.c
│   ├── audio_format_convert.h
│   └── bs.h
├── dec
├── example_amr2pcm.c
├── example_pcm2amr.c
├── libopencore-amrnb.so.0
├── opencore-amr
│   ├── include
│   │   ├── opencore-amrnb
│   │   │   ├── interf_dec.h
│   │   │   └── interf_enc.h
│   │   └── opencore-amrwb
│   │       ├── dec_if.h
│   │       └── if_rom.h
│   └── lib
│       ├── libopencore-amrnb.a
│       ├── libopencore-amrnb.la
│       ├── libopencore-amrnb.so -> libopencore-amrnb.so.0.0.3
│       ├── libopencore-amrnb.so.0 -> libopencore-amrnb.so.0.0.3
│       ├── libopencore-amrnb.so.0.0.3
│       ├── libopencore-amrwb.a
│       ├── libopencore-amrwb.la
│       ├── libopencore-amrwb.so -> libopencore-amrwb.so.0.0.3
│       ├── libopencore-amrwb.so.0 -> libopencore-amrwb.so.0.0.3
│       ├── libopencore-amrwb.so.0.0.3
│       └── pkgconfig
│           ├── opencore-amrnb.pc
│           └── opencore-amrwb.pc
├── run_dec.sh
├── run_enc.sh
├── test.amr
└── test.amr.pcm

1) gcc可以直接编译

#arm-linux-gnueabihf-gcc example_amr2pcm.c ./codec/audio_format_convert.c ./codec/amrnb.c ./codec/bs.h -o dec -I'./opencore-amr/include/opencore-amrnb' -I'./opencore-amr/include/opencore-amrwb' -I'./codec' ./opencore-amr/lib/libopencore-amrnb.a ./opencore-amr/lib/libopencore-amrwb.a

2) g++和gcc编译需要一点小改动

更改audio_format_convert.h

//#ifdef __cplusplus
//extern "C" {
//#endif

...

...

//#ifdef __cplusplus
//}
//#endif

amrnb.c的第294和368行

int ret = Encoder_Interface_Encode(amrnb_enc, MR475, &samples[offset / sizeof (int16_t)], tmp, amrnb_dtx);

参数mode改成MR475

arm-linux-gnueabihf-g++ example_amr2pcm.c ./codec/audio_format_convert.c ./codec/amrnb.c ./codec/bs.h -o dec -I'./opencore-amr/include/opencore-amrnb' -I'./opencore-amr/include/opencore-amrwb' -I'./codec' ./opencore-amr/lib/libopencore-amrnb.a ./opencore-amr/lib/libopencore-amrwb.a

我的项目整理下编译指令 build.sh

arm-linux-gnueabihf-g++ -o poc_client \
poc_client.c \
./codec/audio_format_convert.c \
./codec/amrnb.c \
./codec/bs.h \
./fifo/app_fifo.c \
./fifo/app_fifo.h \
./list/list.c \
./list/list.h \
-I'./opencore-amr/include/opencore-amrnb' \
-I'./opencore-amr/include/opencore-amrwb' \
-I'./codec' \
./opencore-amr/lib/libopencore-amrnb.a \
./opencore-amr/lib/libopencore-amrwb.a \
./poc/libpoc.a \
-I ./alsa/include -L ./alsa/lib -lasound \
-lpthread

6、alsa播放pcm音频

播放pcm文件

  1. /**alsa play test
  2. *ALSA用户空间编译,ALSA驱动的声卡在用户空间,不宜直接使用
  3. *文件接口中,而应使用alsa-lib
  4. *打开---->设置参数--->读写音频数据 ALSA全部使用alsa-lib中的API
  5. *交叉编译
  6. *export LD_LIBRARY_PATH=$PWD:$LD_LIBRARY_PATH
  7. *arm-linux-gcc -o alsa_play alsa_play_test.c -L. -lasound
  8. *需要交叉编译后的libasound.so库的支持
  9. *
  10. */
  11. #include <stdio.h>
  12. #include <stdlib.h>
  13. #include "alsa/asoundlib.h"
  14.  
  15. int main(int argc, char *argv[])
  16. {
  17. int i;
  18. int ret;
  19. int buf[];
  20. unsigned int val;
  21. int dir=;
  22. char *buffer;
  23. int size;
  24. snd_pcm_uframes_t frames;
  25. snd_pcm_uframes_t periodsize;
  26. snd_pcm_t *playback_handle;//PCM设备句柄pcm.h
  27. snd_pcm_hw_params_t *hw_params;//硬件信息和PCM流配置
  28. if (argc != ) {
  29. printf("error: alsa_play_test [music name]\n");
  30. exit();
  31. }
  32. printf("play song %s by wolf\n", argv[]);
  33. FILE *fp = fopen(argv[], "rb");
  34. if(fp == NULL)
  35. return ;
  36. fseek(fp, , SEEK_SET);
  37.  
  38. //1. 打开PCM,最后一个参数为0意味着标准配置
  39. ret = snd_pcm_open(&playback_handle, "default", SND_PCM_STREAM_PLAYBACK, );
  40. if (ret < ) {
  41. perror("snd_pcm_open");
  42. exit();
  43. }
  44.  
  45. //2. 分配snd_pcm_hw_params_t结构体
  46. ret = snd_pcm_hw_params_malloc(&hw_params);
  47. if (ret < ) {
  48. perror("snd_pcm_hw_params_malloc");
  49. exit();
  50. }
  51. //3. 初始化hw_params
  52. ret = snd_pcm_hw_params_any(playback_handle, hw_params);
  53. if (ret < ) {
  54. perror("snd_pcm_hw_params_any");
  55. exit();
  56. }
  57. //4. 初始化访问权限
  58. ret = snd_pcm_hw_params_set_access(playback_handle, hw_params, SND_PCM_ACCESS_RW_INTERLEAVED);
  59. if (ret < ) {
  60. perror("snd_pcm_hw_params_set_access");
  61. exit();
  62. }
  63. //5. 初始化采样格式SND_PCM_FORMAT_U8,8位
  64. ret = snd_pcm_hw_params_set_format(playback_handle, hw_params, SND_PCM_FORMAT_U8);
  65. if (ret < ) {
  66. perror("snd_pcm_hw_params_set_format");
  67. exit();
  68. }
  69. //6. 设置采样率,如果硬件不支持我们设置的采样率,将使用最接近的
  70. //val = 44100,有些录音采样频率固定为8KHz
  71.  
  72. val = ;
  73. ret = snd_pcm_hw_params_set_rate_near(playback_handle, hw_params, &val, &dir);
  74. if (ret < ) {
  75. perror("snd_pcm_hw_params_set_rate_near");
  76. exit();
  77. }
  78. //7. 设置通道数量
  79. ret = snd_pcm_hw_params_set_channels(playback_handle, hw_params, );
  80. if (ret < ) {
  81. perror("snd_pcm_hw_params_set_channels");
  82. exit();
  83. }
  84.  
  85. /* Set period size to 32 frames. */
  86. frames = ;
  87. periodsize = frames * ;
  88. ret = snd_pcm_hw_params_set_buffer_size_near(playback_handle, hw_params, &periodsize);
  89. if (ret < )
  90. {
  91. printf("Unable to set buffer size %li : %s\n", frames * , snd_strerror(ret));
  92.  
  93. }
  94. periodsize /= ;
  95.  
  96. ret = snd_pcm_hw_params_set_period_size_near(playback_handle, hw_params, &periodsize, );
  97. if (ret < )
  98. {
  99. printf("Unable to set period size %li : %s\n", periodsize, snd_strerror(ret));
  100. }
  101.  
  102. //8. 设置hw_params
  103. ret = snd_pcm_hw_params(playback_handle, hw_params);
  104. if (ret < ) {
  105. perror("snd_pcm_hw_params");
  106. exit();
  107. }
  108.  
  109. /* Use a buffer large enough to hold one period */
  110. snd_pcm_hw_params_get_period_size(hw_params, &frames, &dir);
  111.  
  112. size = frames * ; /* 2 bytes/sample, 2 channels */
  113. buffer = (char *) malloc(size);
  114. fprintf(stderr,
  115. "size = %d\n",
  116. size);
  117.  
  118. while ()
  119. {
  120. ret = fread(buffer, , size, fp);
  121. if(ret == )
  122. {
  123. fprintf(stderr, "end of file on input\n");
  124. break;
  125. }
  126. else if (ret != size)
  127. {
  128. }
  129. //9. 写音频数据到PCM设备
  130. while(ret = snd_pcm_writei(playback_handle, buffer, frames)<)
  131. {
  132. usleep();
  133. if (ret == -EPIPE)
  134. {
  135. /* EPIPE means underrun */
  136. fprintf(stderr, "underrun occurred\n");
  137. //完成硬件参数设置,使设备准备好
  138. snd_pcm_prepare(playback_handle);
  139. }
  140. else if (ret < )
  141. {
  142. fprintf(stderr,
  143. "error from writei: %s\n",
  144. snd_strerror(ret));
  145. }
  146. }
  147.  
  148. }
  149. //10. 关闭PCM设备句柄
  150. snd_pcm_close(playback_handle);
  151.  
  152. return ;
  153. }

arm-linux-gnueabihf-gcc -o test test.c -I ./alsa/include -L ./alsa/lib -lasound -lpthread

./test file.pcm

播放pcm缓存

  1. #include <alsa/asoundlib.h>
  2.  
  3. int main()
  4. {
  5. int ret;
  6. snd_pcm_t *pcm_handle;
  7. snd_pcm_stream_t stream = SND_PCM_STREAM_PLAYBACK;
  8. snd_pcm_hw_params_t *hwparams;
  9. char *pcm_name;
  10.  
  11. pcm_name = strdup("plughw:0,0");
  12.  
  13. snd_pcm_hw_params_alloca(&hwparams);
  14.  
  15. ret = snd_pcm_open(&pcm_handle, pcm_name, stream, );
  16. if (ret < ) {
  17. printf("snd_pcm_open failed\n");
  18. return(-);
  19. }
  20.  
  21. ret = snd_pcm_hw_params_any(pcm_handle, hwparams);
  22. if (ret < ) {
  23. printf("snd_pcm_hw_params_any failed\n");
  24. return(-);
  25. }
  26.  
  27. int rate = ;
  28. int exact_rate;
  29. int dir;
  30. int periods = ;
  31. snd_pcm_uframes_t periodsize = ;
  32.  
  33. ret = snd_pcm_hw_params_set_access(pcm_handle, hwparams,
  34. SND_PCM_ACCESS_RW_INTERLEAVED);
  35. if (ret < ) {
  36. printf("snd_pcm_hw_params_set_access failed\n");
  37. return(-);
  38. }
  39.  
  40. ret = snd_pcm_hw_params_set_format(pcm_handle, hwparams,
  41. SND_PCM_FORMAT_S16_LE);
  42. if (ret < ) {
  43. printf("snd_pcm_hw_params_set_format failed\n");
  44. return(-);
  45. }
  46.  
  47. exact_rate = rate;
  48. ret = snd_pcm_hw_params_set_rate_near(pcm_handle, hwparams,
  49. &exact_rate, );
  50. if (ret < ) {
  51. printf("snd_pcm_hw_params_set_rate_near failed\n");
  52. return(-);
  53. }
  54. if (rate != exact_rate) {
  55. printf("The rate %d Hz is not supported by your hardware\n"
  56. "==> Using %d Hz instead\n", rate, exact_rate);
  57. }
  58.  
  59. ret = snd_pcm_hw_params_set_channels(pcm_handle, hwparams, );
  60. if (ret < ) {
  61. printf("snd_pcm_hw_params_set_channels failed\n");
  62. return(-);
  63. }
  64. /*
  65. ret = snd_pcm_hw_params_set_periods(pcm_handle, hwparams, periods, 0);
  66. if (ret < 0) {
  67. printf("snd_pcm_hw_params_set_periods failed\n");
  68. return(-1);
  69. }
  70. */
  71. ret = snd_pcm_hw_params_set_buffer_size(pcm_handle, hwparams,
  72. (periodsize * periods) >> );
  73. if (ret < ) {
  74. printf("snd_pcm_hw_params_set_buffer_size failed\n");
  75. return(-);
  76. }
  77.  
  78. ret = snd_pcm_hw_params(pcm_handle, hwparams);
  79. if (ret < ) {
  80. printf("snd_pcm_hw_params failed\n");
  81. return(-);
  82. }
  83.  
  84. unsigned char *data;
  85. int l1, l2;
  86. short s1, s2;
  87. int frames;
  88.  
  89. data = malloc(periodsize);
  90. frames = periodsize >> ;
  91.  
  92. for (l1 = ; l1 < ; l1++) {
  93. for (l2 = ; l2 < frames; l2++) {
  94. s1 = (l2 % ) * - ;
  95. s2 = (l2 % ) * - ;
  96. data[*l2] = (unsigned char)s1;
  97. data[*l2+] = s1 >> ;
  98. data[*l2+] = (unsigned char)s2;
  99. data[*l2+] = s2 >> ;
  100. }
  101. while ((ret = snd_pcm_writei(pcm_handle, data, frames)) < ) {
  102. snd_pcm_prepare(pcm_handle);
  103. printf("<<<<<<<<<<<<<<Buffer Underrun>>>>>>>>>>>>\n");
  104. }
  105. }
  106.  
  107. snd_pcm_drop(pcm_handle);
  108. snd_pcm_drain(pcm_handle);
  109.  
  110. return ;
  111. }

arm-linux-gnueabihf-gcc -o test test.c -I ./alsa/include -L ./alsa/lib -lasound -lpthread

./test

7、alsa采集pcm音频

采集pcm到缓存/文件

  1. /*
  2. read from the default PCM device and writes to standard output for 5 seconds of data
  3. */
  4.  
  5. #define ALSA_PCM_NEW_HW_PARAMS_API
  6.  
  7. #include <alsa/asoundlib.h>
  8.  
  9. snd_pcm_t * handle;
  10. snd_pcm_hw_params_t * params;
  11. snd_pcm_uframes_t frames;
  12. char * buffer;
  13. unsigned int val;
  14.  
  15. int alsa_capture_init()
  16. {
  17. int dir;
  18. int rc;
  19.  
  20. /* open PCM device for recording (capture). */
  21. rc = snd_pcm_open(&handle, "default",SND_PCM_STREAM_CAPTURE,);
  22. if( rc < )
  23. {
  24. return -;
  25. }
  26. /* allocate a hardware parameters object */
  27. snd_pcm_hw_params_alloca(&params);
  28. /* fill it with default values. */
  29. snd_pcm_hw_params_any(handle,params);
  30. /* set the desired hardware parameters */
  31. snd_pcm_hw_params_set_access(handle,params,
  32. SND_PCM_ACCESS_RW_INTERLEAVED);
  33. /* signed 16-bit little-endian format */
  34. snd_pcm_hw_params_set_format(handle,params,
  35. SND_PCM_FORMAT_S16_LE);
  36. /* two channels(stereo) */
  37. snd_pcm_hw_params_set_channels(handle,params,);
  38. /* sampling rate */
  39. val = ;
  40. snd_pcm_hw_params_set_rate_near(handle,params,&val,&dir);
  41. /* set period size */
  42. frames = ;
  43. snd_pcm_hw_params_set_period_size_near(handle,params,&frames,&dir);
  44. /* write parameters to the driver */
  45. rc = snd_pcm_hw_params(handle,params);
  46. if ( rc < )
  47. {
  48. return -;
  49. }
  50. /* use a buffer large enough to hold one period */
  51. snd_pcm_hw_params_get_period_size(params,&frames,&dir);
  52.  
  53. /* loop for 5 seconds */
  54. snd_pcm_hw_params_get_period_time(params, &val, &dir);
  55.  
  56. return ;
  57. }
  58.  
  59. int main()
  60. {
  61. long loops;
  62. int ret;
  63. int size;
  64. FILE * out_fd;
  65. out_fd = fopen("out_pcm.raw","wb+");
  66.  
  67. alsa_capture_init();
  68. loops = / val;
  69.  
  70. /* 2 bytes/sample, 1 channels */
  71. size = frames * ;
  72. buffer = ( char * ) malloc(size);
  73.  
  74. while( loops > )
  75. {
  76. loops--;
  77. ret = snd_pcm_readi(handle,buffer,frames);
  78. if ( ret == -EPIPE )
  79. {
  80. /* EPIPE means overrun */
  81. fprintf(stderr,"overrun occured\n");
  82. snd_pcm_prepare(handle);
  83. }
  84. else if ( ret < )
  85. {
  86. fprintf(stderr,"error from read: %s\n",
  87. snd_strerror(ret));
  88. }
  89. else if ( ret != (int)frames)
  90. {
  91. fprintf(stderr,"short read, read %d frames\n",ret);
  92. }
  93.  
  94. ret = fwrite(buffer, , size, out_fd);
  95. // ret = write(1, buffer, size);
  96. if ( ret != size )
  97. {
  98. fprintf(stderr,"short write: wrote %d bytes\n",ret);
  99. }
  100. }
  101. snd_pcm_drain(handle);
  102. snd_pcm_close(handle);
  103. free(buffer);
  104. fclose(out_fd);
  105. }

arm-linux-gnueabihf-gcc -o test test.c -I ./alsa/include -L ./alsa/lib -lasound -lpthread

./test

8、综合应用实例

采集一段PCM格式语音数据 ,转码成AMR格式然后发送至rtp网络

  1. #if 1
  2. int i;
  3. char outbuf[PCM_DATA_LENGTH];
  4.  
  5. for (i = ; i < *; i++) {
  6. ret = snd_pcm_readi(handle,buffer,frames);
  7. if ( ret == -EPIPE )
  8. {
  9. printf("overrun occured\n");
  10. snd_pcm_prepare(handle);
  11. }
  12.  
  13. buffer_pcm2amr_encode((char*)buffer, PCM_DATA_LENGTH, outbuf);
  14.  
  15. //n = Encoder_Interface_Encode(amr, MR795, buf, outbuf, 0);
  16. amrFrame->m_nFrameLen = ;
  17. amrFrame->m_nFrameCount = ;
  18. amrFrame->m_pFrame = outbuf;
  19. NxZDPttAccess_AmrFrame(snCurCallSessionId, amrFrame);
  20. }
  21.  
  22. #else
  23. //------------------------------------
  24. //sin data test
  25. int i, j;
  26. int sample_pos = ;
  27.  
  28. for (i = ; i < ; i++) {
  29. short buf[];
  30. char outbuf[];
  31. int n;
  32. for (j = ; j < ; j++) {
  33. buf[j] = *sin(**3.141592654*sample_pos/);
  34. sample_pos++;
  35. }
  36. buffer_pcm2amr_encode((char*)buf, , outbuf);
  37.  
  38. //n = Encoder_Interface_Encode(amr, MR515, buf, outbuf, 0);
  39. amrFrame->m_nFrameLen = ;
  40. amrFrame->m_nFrameCount = ;
  41. amrFrame->m_pFrame = outbuf;
  42. NxZDPttAccess_AmrFrame(snCurCallSessionId, amrFrame);
  43. }
  44. //-------------------------------------
  45. #endif

接收一段AMR格式语音数据,转码成PCM格式,然后写入声卡播放

  1. #if 1
  2. int i;
  3. for (i = ; i < pAmrFrame->m_nFrameCount; i++) {
  4. int ret = buffer_amr2pcm_decode(pAmrFrame->m_pFrame + i*pAmrFrame->m_nFrameLen, pAmrFrame->m_nFrameLen, pcm_data_buf);
  5. if(ret > ){
  6. if((ret = snd_pcm_writei(pcm_handle, pcm_data_buf, PCM_DATA_LENGTH/)) < ) {
  7. snd_pcm_prepare(pcm_handle);
  8. printf("<<<<<<<<<<<<<<Buffer Underrun>>>>>>>>>>>>\n");
  9. }
  10. }
  11. }
  12.  
  13. #else
  14. unsigned char *data;
  15. int l1, l2;
  16. short s1, s2;
  17. int frames;
  18. int periodsize = ;
  19. data = (unsigned char*)malloc(periodsize);
  20. frames = periodsize >> ;
  21.  
  22. for (l1 = ; l1 < ; l1++) {
  23. for (l2 = ; l2 < frames; l2++) {
  24. s1 = (l2 % ) * - ;
  25. s2 = (l2 % ) * - ;
  26. data[*l2] = (unsigned char)s1;
  27. data[*l2+] = s1 >> ;
  28. data[*l2+] = (unsigned char)s2;
  29. data[*l2+] = s2 >> ;
  30. }
  31. if((ret = snd_pcm_writei(pcm_handle, data, frames)) < ) {
  32. snd_pcm_prepare(pcm_handle);
  33. printf("<<<<<<<<<<<<<<Buffer Underrun>>>>>>>>>>>>\n");
  34. }
  35. }
  36. #endif

9、拓展

tinyalsa做了很多琐事,省了不少时间,感谢作者。

https://github.com/tinyalsa/tinyalsa

generation-sine-wave

https://github.com/ichgw/generation-sine-wave

https://github.com/moutend/getSineWave

https://github.com/munnellg/SineWave

AMR格式语音采集/编码/转码/解码/播放的更多相关文章

  1. G711格式语音采集/编码/转码/解码/播放

    2019-05-01 语音g711格式和AMR格式类似,应用很简单,很多人已经整理过了,收录于此,以备不时之需,用别人现成的足矣,我们的时间应该用来干更有意义的事. 1.PCM to G711 Fas ...

  2. 如何将微信上传AMR格式语音转化为MP3格式

    1. 服务器安装ffmpeg 2. 执行命令 ffmpeg -i {amr_file_path} -f mp3 -acodec libmp3lame -y {mp3_file_path} public ...

  3. 在java中使用ffmpeg将amr格式的语音转为mp3格式

    ffmpeg是一个非常强大的音视频处理工具,官网是:http://ffmpeg.org/. 由于ffmpeg在windows上和linux系统上的执行文件不一样(Windows上不需要安装ffmpeg ...

  4. 使用X264编码yuv格式的视频帧使用ffmpeg解码h264视频帧

    前面一篇博客介绍在centos上搭建点击打开链接ffmpeg及x264开发环境.以下就来问个样例: 1.利用x264库将YUV格式视频文件编码为h264格式视频文件 2.利用ffmpeh库将h264格 ...

  5. 通过javascript 直接播放amr格式的语言

    前段时间做了个功能(有2.3个月了,突然想起来了,就记录一下),语言播放.一开始觉得很简单~~~ 计划应用的是H5的audio标签,但因为这个标签不支持amr格式的语言,但是手机端传到后台的录音却都是 ...

  6. C# Window Form解决播放amr格式音乐问题

    最近搞一个项目,需要获取微信端语音文件,下载之后发现是AMR格式的录音文件,这下把我搞晕了,C#中的4种播放模式不支持播放AMR,想到都觉得头痛,如何是好?最后找到的方案,其实也简单:windows ...

  7. WebRTC VideoEngine超详细教程(三)——集成X264编码和ffmpeg解码

    转自:http://blog.csdn.net/nonmarking/article/details/47958395 本系列目前共三篇文章,后续还会更新 WebRTC VideoEngine超详细教 ...

  8. 特殊字符url编码以后再解码后出现错误(&not , &cent, &curren, &pound)

    Url编码的原内容是 “&notify_url=xxxx”  经过url编码以后再解码回来  “&not”的部分就变成了“¬” 解决方案:把原文里面待url编码的&符号先替换成 ...

  9. JavaScript中url 传递参数(特殊字符)解决方法及转码解码的介绍

    有些符号在URL中是不能直接传递的,如果要在URL中传递这些特殊符号,那么就要使用他们的编码了.下表中列出了一些URL特殊符号及编码   十六进制值 1. + URL 中+号表示空格 %2B 2. 空 ...

随机推荐

  1. iptables 指令语法

    iptables 指令 语法: iptables [-t table] command [match] [-j target/jump] -t 参数用来指定规则表,内建的规则表有三个,分别是:nat. ...

  2. PowerDesigner 同步Name到Comment 及 同步 Comment 到Name

    PowerDesigner中使用方法为:     PowerDesigner->Tools->Execute Commands->Edit/Run Scripts 代码一:将Name ...

  3. Objective-c官方文档 怎么使用对象

    版权声明:原创作品,谢绝转载!否则将追究法律责任.   对象发送和接受消息 尽管有不同的方法来发送消息在对象之间,到目前位置是想中括号那样[obj doSomeThing]:左边是接受消息的接收器,右 ...

  4. Android英文文档翻译系列(6)——LocalBroadcastManager

    public class LocalBroadcastManager extends Object java.lang.Object    ↳ android.support.v4.content.L ...

  5. WP8.1学习系列(第十六章)——交互UX之命令模式

    命令模式   在本文中 命令类型 命令放置 相关主题 你可以在应用商店应用的几个曲面中放置命令和控件,包括应用画布.弹出窗口.对话框和应用栏.在正确的时间选择合适的曲面可能就是易于使用的应用和很难使用 ...

  6. 【Spring源码分析系列】搭建Spring实现容器的基本实现

    前言 bean是Spring中最核心的东西,因为Spring就像一个大水桶,而bean就像是容器中的水,先新建一个小例子来看一下: 一.使用eclipse构建项目,项目结构如下 二.类文件内容 < ...

  7. HTTP协议剖析 (附HttpWatch工具监控网络请求)

    工具:HttpWatch Prov7.2.13破解版(带正版key) HTTP协议概述   思考2个要点: 第一:浏览器和服务器是通过什么连接的 第二:这种连接方式是怎么实现的   通过Interne ...

  8. selenium中javascript调试

    之前写了使用js输入长文件的文章,有同事在使用时,发现竟然无法输入,也不知道是什么原因,且用的还是id方式. 在参考网文后,才发现是js写的有问题,现总结一下 javascript调试,在firefo ...

  9. 解决远程登陆Linux误按ctrl+s锁屏

      很多刚从windows转移到linux上来工作的朋友,在用vi/vim编辑文件时,常常会习惯性的按下Ctrl+s来保存文件内容.殊不知这样按下去后面会造成整个终端不响应了,ssh连接还好说,直接关 ...

  10. Mongodb 副本集 数据同步简单测试

    副本集的搭建,请见  CENTOS6.5 虚拟机MONGODB创建副本集 接下来将简单说明下副本集之间的数据同步. 1.首先,进入primary节点 MOGO_PATH/bin/mongo  -por ...