Forward from White Wolf Stack: See the original article

Many people commented privately that they had never seen audio or video before and were confused about what FFMPEG could do.

Today we’re going to look at what exactly can we do with FFMPEG?

Many of you may have played Douyin. When you are “shooting the same style”, have you ever paid attention to the prompt of “in process of synthesis”? The longer the video is, the longer the time for synthesis will be, sometimes a few seconds, sometimes tens of seconds, which is actually the local video synthesis by APP.

It’s a bad experience to keep users waiting for so long. Can the server be synthesized? The answer is yes.

But in fact FFMPEG in the coding time, very eat CPU and memory, especially CPU, server CPU100% is common. Then increase the CPU not to be finished? We will actually test the 8-core 8G and 16-core 16G machines later, and we will find that they will still explode, so this is a bottomless pit and can not afford to consume.

So can Douyin get the server to do it? Definitely not. With a large number of users, APP can be done locally. The most important thing is free users.

Therefore, considering the cost of technology, this is why many special effects on Douyin are short videos, some even only 10 seconds long. At least this will not make users wait too long.

Before we dive into audio and video, let’s take a quick look at two scenarios. If you happen to have some audio and video basics, you can practice your hands.

Scenario 1: The company has a lot of original videos and wants to better show them to users with certain effects (such as TV)

The desired effect is shown in the figure

The material is difficult to find, the picture is Baidu, the middle part of the TV show video has been PS processing, slightly rough; Video is Douyin download, the original video has also done local blur.

I believe every company has a good UI, and the current case is just a learning experience.

Points needing attention:

  1. Video can be cropped, it can be scaled, it can’t be deformed
  2. Notice that the four corners of the TV’s inner screen are rounded
  3. The original video only takes the middle part, without the Gaussian blur background
  4. The part at the end of the original video containing Douyin has also been cropped

The footage has been uploaded to GitHub, please click the link to get it.

Download Picture Materials

Download Video Materials

Download Composition Effects

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

The desired effect is shown in the figure

The material is also 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 the material is at the bottom. In addition, the title, subtitles and fonts are all prepared in preparation.

The footage has been uploaded to GitHub, please click the link to get it.

Download the user video on the left

Download the video of the material on the right

Download subtitle file 1 and subtitle file 2 on the right

Download the font

The resulting video effect

There can be many different ways to do the same effect, so if you took some time to get them all done, congratulations.

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

Those of you who are new to audio and video may be surprised by the effect, but by the time you have learned the basics of FFMPEG, you should be able to solve these and more complex audio and video requirements with at least one command.