Conversion of WAV and AMR to ffmpeg under Linux

Source: Internet
Author: User

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 
    • 1
    • 2
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       
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
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
    • 1
    • 2
    • 3
    • 4
    • 5

2.AMR Turn wav

//amr转wav./ffmpeg -i 1.amr 1.wav
    • 1
    • 2
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.