FFmpeg conversion parameters and Analysis of conversion of several video formats

Source: Internet
Author: User

When converting videos in multiple formats into FLV formats, we focus on the quality and size of converted FLV videos. Next I will share with you my practical experience, mainly for the analysis of AVI, 3GP, MP4 and WMV formats. When using FFMPEG for video conversion, we usually use the following main parameters to control audio and video:
-AB bitrate: Set the audio bit rate.
-Acodec codec uses codec encoding/Decoding
-AC channels: Specifies the channel. The default value is 1.
-Ar freq: Set the audio Sampling Rate
-R fps: Specifies the frame rate. The default value is 25.
-B bitrate: bit rate. The default value is kb/s.
-Qscale 6 or 4 uses Dynamic Bit Rate Settings
It is easy to understand other parameters such as-I,-y, and-s. The first four parameters we mentioned above are mainly used to set the audio, and the last three parameters are mainly used to set the video. The AR (sampling rate) of the audio can be set to 22050, 24000, 44100, or 48000. Generally, the latter two are more common. For the AB (bit rate) of the audio) generally, 32, 64, 96, or 128 are selected. acodec for audio specifies the encoding method, which can be libmp 3lame or AAC, these two types refer to audio in MP3 and AAC formats respectively. During the actual test, I found that when using MP3 for Audio Encoding, specifying AB as 64 or higher and specifying Ar as 22050 or higher has no significant impact on the actual video quality, see the following test results.

The r of the video is used to specify the frame rate, which is generally set to 29.97. For video B (video bit rate), you can specify numbers such as 128 and 314, which has no effect on videos over 1500; the video qscale is a dynamic bit rate. It can be set to 4 or 6, and the quality of 4 is 6. During the test, I found that setting the-B parameter does not significantly change the video quality (the values of the specified size and size are similar or the same), while setting the qscale parameter is completely different, if we want to obtain high-quality data, we should use dynamic bit rate instead of the-B parameter. Of course, the disadvantage of Dynamic Bit Rate is that the video size increases. When using dynamic bit rate, the effect of 6 is similar to that of 4, but the volume is reduced. Therefore, we recommend that you use 6 to set the dynamic bit rate.

The configuration parameters of audio and video during the conversion process are described above. The Common commands for conversion are as follows:
High quality: FFMPEG-I infile-AB 128-acodec libmp 3lame-Ac 1-ar 22050-r 29.97-qscale 6-y OUTFILE
Low Quality: FFMPEG-I infile-AB 128-acodec libmp 3lame-Ac 1-ar 22050-r 29.97-B 512-y OUTFILE

You can use these two commands to test the video results of the four formats as follows. During the test, the corresponding parameters are changed for testing. The information of the four videos is as follows:
AVI format: Test. Avi 14.1 m
3GP: test.3gp 4.30 m
In MP4 format: test.mp4 16.4 m
WMV Format: test. wmv 15.0 m

1. The test results using high-quality scripts are as follows:
After AVI format conversion:-qscale 6 result = avi_01.flv 6.61 m-qscale 4 result = avi_02.flv 9.30 m
After 3GP format conversion:-qscale 6 result = 3gp_01.flv 4.21 M-qscale 4 result = 3gp_02.flv 5.30 m
After MP4 format conversion:-qscale 6 result = mp4_01.flv 13.1 M-qscale 4 result = mp4_02.flv 17.5 m
After WMV format conversion:-qscale 6 result = wmv_01.flv 15.9 M-qscale 4 result = wmv_02.flv 22.3 m

2. Test results using low-quality scripts are as follows:
After AVI format conversion:-B 512 result = avi_03.flv 2.87 M-B 1000 result = avi_04.flv 2.87 m
After 3GP format conversion:-B 512 result = 3gp_03.flv 1.73 M-B 1000 result = 3gp_04.flv 1.73 m
After MP4 format conversion:-B 512 result = mp4_03.flv 5.84 M-B 1000 result = mp4_04.flv 5.84 m
After WMV format conversion:-B 512 result = wmv_03.flv 6.17 m-B 1000 result = wmv_04.flv 6.17 m

3. compression ratio comparison:
After AVI format conversion:-qscale 6 result = 53.12%-qscale 4 result = 34.04%-B 512/1000 result = 79.65%
After 3GP format conversion:-qscale 6 result = 2.093%-qscale 4 result = 123.1%-B 512/1000 result = 59.77%
After MP4 format conversion:-qscale 6 result = 20.12%-qscale 4 result = 106.7%-B 512/1000 result = 64.39%
After WMV format conversion:-qscale 6 result = 106.0%-qscale 4 result = 148.7%-B 512/1000 result = 58.87%

By comparing the pre-and post-compression sizes, we can see the huge difference between high-quality conversion and low-quality conversion while keeping the audio consistent, at the same time, videos of different formats may be significantly different during conversion. Of course, this data does not necessarily mean that all videos in these formats are like this. The specific content depends on your application. However, we can determine that the compression ratio of an AVI video is the largest after it is converted to the FLV format, but the AVI results of different encodings are not necessarily the same. At the same time, we can also see that the size of videos in some formats is larger than the original one after conversion, so we need to pay attention to this during application.

The RM and rmvb formats are not tested here, because FFMPEG cannot directly convert the videos in these two formats. Next time I will use mencoder to test the analysis of converting the RM and rmvb formats to FLV. The following are the screenshots taken before and after conversion. For more information, see.

1. Before capturing the AVI format, use-qscale 6 and-B 512 as follows:

Before the 2.3gp format is intercepted, use-qscale 6 and-B 512 as follows:

3. Before MP4 format truncation, use-qscale 6 and-B 512 as follows:

4. Before the WMV format is intercepted, use-qscale 6 and-B 512 as follows:

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.