Reprint: http://blog.csdn.net/sanshipianyezi/article/details/78742621
Reprint: http://blog.csdn.net/szfhy/article/details/50441162
Under Linux for the conversion of WAV and AMR, if it is AMR to wav only need ffmpeg can but if WAV to AMR will need to rely on ffmpeg and Opencore_amrnb library.
Complete: http://download.csdn.net/download/sanshipianyezi/10149789
1.Linux under Installation FFmpeg
ffmpeg:https://www.johnvansickle.com/ffmpeg/
release:3.4 is also free to install version (just unzip) only need to download and put in the/usr/local/directory
//解压ffmpegtar -xvf ffmpeg-release-64bit-static.tar.xz
2. Installing OPENCORE-AMR
OPENCORE-AMR Library: https://sourceforge.net/projects/opencore-amr/
Put the downloaded opencore-amr-0.1.5.tar.gz in the/usr/local/directory
Compilation Method chmod755 Opencore-amr-0.1.5. tar.gz //Change file operation permissions tar -XZVF Opencore-amr-0.1.5.tar.gz // Unzip file CD Opencore-amr-0.1.5 //into Opencore-amr folder ./configure Span class= "Hljs-subst" >--enable-shared=no --enable-static=yes //configuration make //compile make install
3. Enter the FFmpeg to realize the WAV to AMR and AMR to wav
1.wav turn AMR
//wav转amr#pwd/usr/local/ffmpeg-3.4-64bit-static/[[email protected] ffmpeg-3.4-64bit-static]# ./ffmpeg -i hello1.wav -c:a libopencore_amrnb -ac 1 -ar 8000 -b:a 7.95k -y 1.amr
2.AMR Turn wav
//amr转wav./ffmpeg -i 1.amr 1.wav
4.java Call
Import java.io.IOException;/** * wav file to AMR tool class *@author Sanpianyezi * * * *PublicClassWav2amrutil {FFmpeg Execution DirectoryPrivateFinalstatic String Ffmpeg_path ="/usr/local/ffmpeg-3.4-64bit-static/ffmpeg";/** * Convert a WAV file to AMR file * *@param Wavpath *@param Amrpath *@throws IOException *@retuen Boolean */public static boolean wav2amr (String wavpath,string amrpath) throws ioexception {try{String shellcontent = ffmpeg_path + "-I "+ Wavpath + "-c:a libopencore_amrnb-ac 1-ar 8000-b:a 7.95k-y "+amrpath; System.out.println ( "WAV2AMR Execute command behavior:" +shellcontent); Runtime.getruntime (). exec (shellcontent); System.out.println (return true;} catch (Exception e) {System.out.println ( "Wav2amr execution failed:" + E.getmessage ()); return FALSE;} }
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21st
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
Exception description
I have configure:error:c++ compiler cannot create executables issue during the installation process
This later looked at the relevant information only to find that the GCC components are not fully loaded, I previously installed GCC is to notify the Yum way:
Yum Install gcc gcc++
In this case there are still components that are not fully installed. A second execution of this command will solve the problem.
Yum Install gcc gcc-c++ gcc-g77
There should be no problem with that.
Reference reference: http://blog.csdn.net/u010018421/article/details/71280099
Conversion of WAV and AMR to ffmpeg under Linux