The significance of batch image extraction is that we can obtain the composition elements and subtitles from the images, which provides strong reference value for creating comics, videos, stories, and other content. Using this information, we can feed it to GPT and make it our knowledge base, then use the knowledge base content to generate the content we want.
[baike]Download and Install FFmpeg[/baike]Installation steps: this process is very simple. Downloading takes about 1 minute, installation takes about 2 minutes, and reading the tutorial takes about 2 minutes. The whole installation takes about 5 minutes.
Open the official website address: https://ffmpeg.org/download.html#build-windows
Taking Windows as an example, click here to go to the download address.
Select: ffmpeg-master-latest-win64-gpl-shared.zip and download it to your computer.
After downloading, extract it, open the folder, find the bin folder inside, click into it, and then copy the current path. We need to add the exe files in this directory to the environment variables.
[baike]Configure Environment Variables[/baike]Open the search function at the bottom of the computer, type system environment, and open Edit the system environment variables.
Double-click Path.
Click New, paste the path you just copied, then confirm and save. At this point, FFmpeg is considered installed.
Next, open CMD to test whether the installation was successful. Click Start > Run > type cmd on the computer, or use the Windows+R shortcut, then type ffmpeg to see whether it works normally. If the version is displayed correctly, it is working normally.
[baike]Start Extracting Images from Video[/baike]Next, we provide a command to teach you how to convert a video into images. First open the folder where a video is located, then click the path above, replace it with cmd, press Enter, and a CMD window will pop up.
Command: ffmpeg -i 原视频名.mp4 -vf fps=1/10 文件夹名称/output%d.png
- -vf fps=1/10: Here, -vf refers to the video filter option; fps=1/10 means the frame rate is 1 frame every 10 seconds, that is, extract one frame every 10 seconds.
- output%d.png: The naming method for output files. output%d.png means the output image file names will have output as the prefix, followed by an incrementing number (for example, output1.png, output2.png), and be saved in .png format.
You need to modify the video name according to your content, enter the folder name (note that it must be created in advance), then adjust how many seconds per image to extract. By default, the folder can be placed in the same directory as the video.
The role of FFmpeg is not limited to this; it can also perform many video processing functions, such as clipping and merging. Friends who want to use it can ask ChatGPT. Here we only introduce content related to familiar analysis.
[baike]Create a Custom GPT Knowledge Base[/baike]We take ChatGPT as an example and use its knowledge base function to build our own content output machine. For a better demonstration effect, I will now find a movie video theme again.
|