Convert Video: Circles Shape Background with Smooth Transition using FFmpeg
This article will guide you through the process of converting a video with a circles shape background and a smooth transition using the powerful FFmpeg tool. The article will cover the key concepts, including subtitles, and provide you with detailed instructions and code snippets.
What is FFmpeg?
FFmpeg is a free and open-source project consisting of a vast software suite of libraries and programs for handling video, audio, and other multimedia files and streams. It is widely used for format transcoding, stream switching, video editing, and more.
Prerequisites
Before you begin, make sure you have FFmpeg installed on your system. You can download it from the official website: https://www.ffmpeg.org/download.html.
Converting the Video
To convert a video with a circles shape background and a smooth transition, you will use the FFmpeg command-line tool. Here's an example command:
ffmpeg -i input.mp4 -vf "drawbox=t=fill:w=100:h=100:x=W-w-10:y=H-h-10:[email protected]:a=1,format=yuva444p,drawcircle=c=white:r=50:x=W-w/2:y=H-h/2:start_angle=0:end_angle=360:spawn=20:lines=1, fade=t=out:st=5:d=1:alpha=1, fade=t=in:st=6:d=1:alpha=1" -codec:a copy output.mp4
Let's break down this command:
-i input.mp4: Specifies the input video file.-vf: Stands for "video filter". This option allows you to apply various filters to the video."drawbox=t=fill:w=100:h=100:x=W-w-10:y=H-h-10:[email protected]:a=1": Draws a box with a semi-transparent black background at the bottom right corner of the video.format=yuva444p: Converts the video to the YUV color space with an alpha channel for transparency.drawcircle=c=white:r=50:x=W-w/2:y=H-h/2:start_angle=0:end_angle=360:spawn=20:lines=1: Draws a white circle in the center of the box.fade=t=out:st=5:d=1:alpha=1: Fades out the circle from 5 to 6 seconds.fade=t=in:st=6:d=1:alpha=1: Fades in the circle from 6 to 7 seconds.-codec:a copy: Copies the audio stream from the input to the output without re-encoding.output.mp4: Specifies the output video file.
Adding Subtitles
To add subtitles to the video, you can use the following command:
ffmpeg -i output.mp4 -vf "subtitles=subtitle.srt" -codec:a copy final_output.mp4
Replace subtitle.srt with the path to your subtitle file.
In this article, you learned how to convert a video with a circles shape background and a smooth transition using FFmpeg. You also discovered how to add subtitles to the converted video.