From white Wolf Stack: Check out the original

Many friends commented privately that they had not been exposed to audio and video before and were still confused about what FFMPEG could do.

Today let’s take a look at what we can do with FFMPEG.

Many of you may have played Douyin. When you were “shooting the same video”, have you ever noticed the prompt “in the process of composing”? The longer the video is, the longer it takes to compose it, sometimes in seconds or even tens of seconds.

Making users wait so long feels like a bad experience. Can the server compose? The answer is yes.

But in fact, FFMPEG coding, very eat CPU and memory, especially CPU, server CPU100 % is common. So why don’t we just increase the CPU? We will actually test the 8-core 8G and 16-core 16G machines later and find that they still explode, so it is a bottomless pit and can’t afford to consume.

So can Tiktok get the server to do it? Definitely not. The number of users is large, the app can be done locally, and the most important thing is free users.

Therefore, considering the cost of technology, this is why many of the effects on Douyin are short videos, some of which are as short as 10 seconds. At least this way, users won’t have to wait too long.

Before we learn about audio and video, let’s briefly look at two application scenarios. If you happen to have some background in audio and video, you can practice your skills.

Scenario 1: The company has a lot of original videos and wants to better present them to users in a certain way (such as television)

The desired effect is shown in the figure

The material is difficult to find, the picture is from Baidu, the video display part in the middle of the TV has been ps processing, slightly rough; The video was downloaded by Douyin, and the original video was partially blurred.

Believe that every company has a good UI, the current case is only as a learning.

Points to note:

  1. Video can be cropped, scaled, and not deformed
  2. Notice that the four corners of the inside screen are round
  3. The original video only took the middle part, no Gaussian blur background
  4. The part at the end of the original video that contained Tiktok was also cut

The material has been uploaded to Github, please click the link to get it.

Download image material

Download video material

Download compositing effect

Scene 2. The company has a lot of videos and corresponding titles and subtitles, and wants to open them for users to dub and synthesize their own works

The desired effect is shown in the figure

The material also comes from Douyin. The video on the left is the user’s video, the middle part of the video on the right is the video material, and the gaussian blur video of this material is at the bottom. In addition, the title, subtitles and fonts are all prepared in advance.

The material has been uploaded to Github, please click the link to get it.

Download the left user video

Download the video on the right

Download subtitle file 1, subtitle file 2 on the right

Download the font

The final composite video effect

The same effect can be done in many different ways, so if it took you a while to get it all done, congratulations.

To reduce server resources and composition time, think about how these two video effects could be done with one command each.

If you’re new to audio and video, you might be surprised by this combination. By the end of the basics of FFMPEG, you should be able to solve these and more complex audio and video needs with at least one command.