Use ffmpeg to convert mp3 files to wma files in linux

Source: Internet
Author: User
Tags server hosting
Now the network is growing faster and faster towards the broadband network, but the server hosting environment needs to change a lot of RMB, so saving one point is just one point. On the network, audio files are usually stored in mp3 format. The audio quality in mp3 format can be relatively good, but the volume is a little large, and it is hard to hear if the sound quality is lowered, and the pressure is not enough.

Now the network is growing faster and faster towards the broadband network, but the server hosting environment needs to change a lot of RMB, so saving one point is just one point. On the network, audio files are usually stored in mp3 format. The audio quality in mp3 format can be relatively good, but the volume is a little large, and it is hard to hear if the sound quality is lowered, and the pressure is not small enough. Wma files are much optimized compared with mp3 files. After testing, a 5 MB mp3 file can be compressed to a wma of about 1 MB at a 24 K bit rate. Although I have scored a winner in the audio quality, I still can hear it. If a friend wants to make a website with a record or a random recording, it would be appropriate to press the file into the wma format.

I searched dozens of pages on the Internet to show how to convert wma to mp3. There are several sporadic examples of converting mp3 to wma. Unfortunately, they are all windows versions, and some still need to spend money.

As a result, I believe ffmpeg has been used by many friends who process media files. It is very powerful and can not only process popular formats such as flv, I used to convert video formats (asf, 3gp,Rm......) To wMvSince wmv can be transferred, wma will certainly be!

After searching online for a while, I found the execution of converting ffmpeg to wma.Command:

Ffmpeg-y-AB 24-ar 22050-acodec wmav2-I test1_test.wma

The-y parameter directly overwrites the existing file without confirmation. The-AB parameter indicates the bit rate, the-ar parameter sampling rate, and-acodec indicatesCompressionFormat;-I refers to the input file, and finally the output file can be typed.

The most significant impact on the number of file bytes is the bit rate. The minimum bit rate of the wma file is 24 KB, which cannot be smaller. Alas, I still want to try it with 12 kb.

Therefore, running the command on the command line fails because the ffmpeg compiled two years ago does not support wma.

So I went to the ffpeg source code directory (hey, this source code directory exists for so many years) and forgot how to compile it? Run:

Ffmpeg | head

The original compilation parameters are retrieved. Is it necessary to add a parameter to support wma? Is it necessary to install an lame? Knock on

./Configure -- help |GrepWma

No results. I read help carefully and did not find anything.

In the source code directory, click:

Ss

Please allow me to think so fast. In fact, when I have no idea, I often think about it. ss configures the svn up shortcut on my machine.

The results of such a knock showed a magical phenomenon. This directory was actually a directory obtained by svn. In addition, after so many years, I can check something from this svn address, the svn Team has been able to maintain a svn address for so many years without interruption, which is a miracle.

Let's take a look at the legendary svn address:

Svn: // svn. mplayerhq. hu/ffmpeg/TrUnk

Friends can directly tap:

Svn co svn: // svn. mplayerhq. hu/ffmpeg/trunk

I can take all the east and west of ffmpeg. I do not know that ffmpegdoes not have a tar.gz package. In the past few years, I checkout it directly from this svn address.

I haven't updated it for many years, and svn up is still relatively long ......

After obtaining the latest source code, compile it directly to see that my compilation parameters are simple:

./Configure --Enable-Gpl -- disable-debug -- prefix =/data/ffmpeg -- enable-libmp3lame -- enable-pthreads -- enable-nonFree

I used ubuntu and had ffmpeg apt in ubuntu, but I found no sound after installing it. So I downloaded ffmpeg svn and installed lame on my own, then the sound is generated. Lame is installed with apt, which is not very troublesome:

Apt-get install lame liblame-dev

Be sure to install the liblame-dev Development Kit. Otherwise, mp3 is still not supported.

Then:

Make; make install

Boring Process.

After installation, you can perform a test. Well, this time it will be supported.


Conclusion (I am always impatient after writing ):

###############################
# The system is ubuntu6.

Apt-get install lame liblame-dev
Svn co svn: // svn. mplayerhq. hu/ffmpeg/trunk
CdTrunk
./Configure -- enable-gpl -- disable-debug -- prefix =/data/ffmpeg -- enable-libmp3lame -- enable-pthreads -- enable-nonfree
Make-j10; make install

###

Then you can use:

/Data/ffmpeg-y-AB 24-ar 22050-acodec wmav2-I test1_test.wma

I'm afraid I don't support the conversion of wmv. I also want to test it as follows:

Ffmpeg-y-acodec mp3-vcodec wmv2-I test. rm test. wmv
Ffmpeg-y-acodec wmav2-vcodec wmv2-I test. rm test. wmv

Yes.

Related Article

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.