Audio conversion:
1. Convert AMR to MP3:
Ffmpeg-i Shenhuxi.amr Amr2mp3.mp3
2. Convert AMR to WAV:
Ffmpeg-acodec libamr_nb-i shenhuxi.amr Amr2wav.wav
3. Convert mp3 to WAV:
Ffmpeg-i ding.mp3-f wav Test.wav
4. Convert WAV to AMR:
Ffmpeg-i test.wav-acodec libamr_nb-ab 12.2k-ar 8000-ac 1 wav2amr.amr
Ffmpeg.exe-i pa003.wav-ar 8000-ab 12.2k-ac 1 Target.amr This method validates the
Article from http://blog.csdn.net/tylz04/article/details/9041739
Test program Download: Http://files.cnblogs.com/xiaofengfeng/WavConvertAmr.zip has been tested to convert WAV to AMR format.
Http://ftp.pconline.com.cn/d56bb83a0a66440d54ef5473f548e4b9/pub/download/201010/ffmpeg-20131021.zip
5. Convert WAV to MP3:
Ffmpeg-i test.wav-f Mp3-acodec libmp3lame-y Wav2mp3.mp3
Video conversion:
1. Convert WMV to MP4:
Ffmpeg-i SAMPLE.WMV-VCODEC Libx264-acodec AAC Out.mp4
2. Crawl the H264 video stream:
Ffmpeg-i Sample.flv-vcodec COPY-VBSF H264_mp4toannexb-an out.h264
2.1 VBSF for the filtering method, will be the FLV provisions of the H264 organization way back to the H264 agreement, the byte stream format 2.2-an forbidden the audio in the source file, because out of the stream does not need audio 2.3 Vcodec copy this is inevitable
3. Convert the H264 video stream to MP4:
Ffmpeg-i sample.h264-f mp4 Haha.mp4
4. Receiving RTSP coexisting as a video file:
Ffmpeg-rtsp_transport tcp-i rtsp://streaming1.osu.edu/media2/ufsap/ufsap.mov-vcodec copy-acodec copy-t 30-f mp4 RTSP -out.mp4
4.1-rtsp_transport TCP: Indicates whether the transmission mode is TCP (or UDP)
4.2-t 30: Indicates I recorded 30 seconds
FFmpeg encode audio or video to AMR format audio
The Android-encoded MP4 audio format may be AMR, which can be used to extract AMR audio directly from the MP4 with the following command:
Ffmpeg-i test.mp4-c:a Copy Test.amr
To convert other formats of audio or video to AMR command:
New wording:
Ffmpeg-i test.mp4-c:a libopencore_amrnb-ac 1-ar 8000-b:a 12.20k-y test.amr
Old wording:
Ffmpeg-i test.mp4-acodec libopencore_amrnb-ac 1-ar 8000-ab 12.20k-y test.amr
System environment: Suse 64bit OS preparation: 1, download FFmpeg source code: http://ffmpeg.org/download.html, here choose version 0.11.1 2, download Opencore amr:http://sourceforge.net/projects/opencore-amr/, the version chosen here is 0.1.3.
and store the downloaded files with the/home/ffmpeg directory, log in to the system as the root user.
Specific steps:
1, compile and install OPENCORE-AMR, it is important to note that when executing the Configure command to add--enable-shared=no--enable-static=yes parameters, its main role is to prohibit the production of dynamic link library, allow the production of static libraries.
chmod 755 opencore-amr-0.1.3.tar.gz TAR-XZVF opencore-amr-0.1.3.tar.gz CD opencore-amr-0.1.3 ./configure--enable-shared=no--enable-static=yes Make Make install |
2, compile and install ffmpeg, note the parameters to be added after the Configure command, you can see the following parameters by executing the Configure--HELP command
CHOMD 755 ffmpeg-0.11.1.tar.gz TAR-XZVF ffmepg-0.11.1.tar.gz CD Ffempg ./configure--ENABLE-GPL--enable-version3--enable-nonfree--disable-ffplay--disable-ffprobe--disable-ffserver-- Enable-libopencore-amrnb--ENABLE-LIBOPENCORE-AMRWB--prefix=/home/ffmpeg/target Make Make install |
After successful execution, the above command will get the FFmpeg file in the bin directory under the/home/ffmpeg/target directory, which already contains the AMR decoder
3. Test:
chmod 755 FFmpeg ./ffmpeg-i Pa003.wav-ar 8000-ab 12.2k-ac 1 target.amr |
4. Precautions:
A) The above methods are compiled in the form of a static library, the benefit of compiling in the form of a static library is that the compiled executable ffmpeg can not rely on the AMR decoder, simply said that the executable file has been included in the AMR decoder.
b) FFmpeg at compile time will first look for the AMR decoder dynamic link library, if not found, the AMR decoder to find the static library. In the first step, if AMR is not prevented from generating a dynamic link library, the ffmpeg will be compiled with AMR's dynamic link library, with the disadvantage that the compiled executable ffmpeg will depend on the AMR dynamic link library If the system's dynamic link library search path ld_library_ Path does not contain the URL of the AMR dynamic link library, then the FFmpeg will error and not work properly.
c) AMR compilation installation is not recommended to add the Prefix=xxx parameter (./configure) to modify the AMR installation path so that FFmpeg will not find the AMR decoder when compiling the installation
FFmpeg Common Conversion command, support WAV to AMR