Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize video matting on FFmpeg command line

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

FFmpeg command line how to achieve video matting, in view of this problem, this article introduces the corresponding analysis and solutions in detail, hoping to help more partners who want to solve this problem to find a more simple and easy way.

How to use the FFmpeg command line to achieve video matting! Talk less, and then let's get down to business.

I. Preface

When it comes to matting, the first thing you may think of is the picture and the powerful PS (Photoshop). For video, you can also achieve matting, which can be achieved using the FFmpeg command line.

II. Orders

Ffmpeg-I in_1.mp4-I in_3.mp4-shortest-filter_complex "[1 out v] chromakey=red:0.3:0.9 [ckout]; [0 in_3.mp4 v] [ckout] overlay [out]"-map "[out]" output.mp4

III. Parameter interpretation

-I: specify the name of the input video file. Note that matting requires two video files.

-shortest: indicates encoding within the shortest input

-filter_complex: indicates the use of complex filters

Chromakey=red:0.3:0.9: chromakey is the core filter used in matting. The following parameters are used for matting. Interested friends can learn more chromakey chromaticity filters by themselves.

Overlay: the video of matting is combined with the destination video using overlay filter.

A description of the use of tags in the same grid.

IV. Material preparation

Two video files, one is used as the target video overlaid after matting, and the other has a more obvious background color, we matting in this video. The video used for matting measured by the author is made of two portrait photos with a red background in order to demonstrate a more intuitive effect. As shown below:

Target Video (in_1.mp4)

For matting video (in_3.mp4)

V. actual combat video

6. the effect of matting after merging.

All right, that's it for this issue, the old rule, go down and practice hard!

This is the answer to the question about how to achieve video matting on the FFmpeg command line. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel to learn more about it.

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: 0

*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.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report