In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Before starting the body of this article, you must first install the ffmpeg program (x264 encoding must also be installed under Linux). Install directly with brew under Mac:
Brew install ffmpeg-with-faac-with-fdk-aac-with-ffplay-with-fontconfig-with-freetype-with-libass with-libbluray with-libcaca with-libsoxr with-libquvi with-frei0r with-libvidstab with-libvorbis with-libvpx with-opencore-amr with-openjpeg with-openssl with-opus with-rtmpdump with-schroedinger with-speex with-theroa with-tools with-x265
Once installed, you can use the ffmpeg command to suppress the MP4 file:
Ffmpeg-I MVI_7274.MOV-vcodec libx264-preset fast-crf 20-y-vf "scale=1920:-1"-acodec libmp3lame-ab 128k a.mp4
The parameters are explained as follows (referenced here, modified: https://vistb.net/2012/02/x264-video-compress-intro/):
-preset: specifies the configuration of the encoding. X264 coding algorithm has many parameters to configure, different parameter values will lead to different coding speed, and may even affect the quality. In order to avoid the trouble for users to understand the algorithm and then configure the parameters manually. X264 provides some preset values, which can be specified through preset. These presets include: ultrafast,superfast,veryfast,faster,fast,medium,slow,slower,veryslow and placebo. Ultrafast encodes the fastest, but the compression ratio is low, and the resulting file is larger, while placebo is the opposite. The default value for x264 is medium. It should be noted that preset mainly affects the speed of coding, and will not greatly affect the quality of the encoded results. When compressing high-definition movies, I usually use slow or slower, and you can also use veryslow when your machine has good performance, but it usually doesn't bring much benefit.
-crf: this is the most important option to specify the quality of the output video. The value range is 0-51, and the default is 23. The smaller the number, the higher the quality of the output video. This option will directly affect the bit rate of the output video. Generally speaking, I will use about 20 to suppress 480p and 720p to suppress 1080p. I have never tried it. Personally, there is no need to be less than 16 in general. The best way is for everyone to try a few more values, each for a few minutes, to see the final output quality and file size, and then choose as needed.
There are actually parameters like-b 1024k, but I found that-b doesn't work when-crf is set. According to my own simple attempt, suppressing an 18-second 1920x1080 video shot by 5D2 (natural light in the afternoon, simple image, large white wall, only a black door) crf and the size of the pressed file are as follows:
Crf file size 1654M1839M2025M2217M2411M267.3M285.0M303.6M322.7M defaults to 14m (crf is 23)
After comparing the video quality of crf at 20,28,32, it is found that 32 can still see a decline in video quality. 20 is indeed very fine, but the difference between 28 and 20 is not that big. It is better to set the CRF value between 26 and 28. If there is a requirement for size, set nothing, use the default (maybe 31).
In addition, preset,slow and fast are only related to running time. Slow runs a lot longer than fast. The mp4 file from slow will be smaller (12m) and the file from fast will be larger (14m), but the video quality gap is not obvious.
If you reduce the original video size from 1920x1080 to 960x540, the video size becomes:
Crf file size 1611M186.7M204.4M223.0M242.1M261.6M281.3M301.1M32893K defaults to 2.5m (crf is 23)
To sum up, when the requirement for quality is high, choose less than 22; when the requirement for size is very high, choose 26 (but the quality is indeed a little worse), otherwise the performance-to-price ratio of 24 is relatively high (or the default 23 is fine). If the requirement for size is really very high, then more than 28.
Postscript supplement (from @ gghyoo)
You can use-threads n to implement multithreaded operations and make full use of multi-core cpu
Examples are as follows:
Ffmpeg-threads 2-crf 20-y-I ML-02.avi-strict experimental ML-02.mp4
Summary
The above is the whole content of this article, I hope that the content of this article has a certain reference and learning value for your study or work, if you have any questions, you can leave a message and exchange, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 249
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.