剪视频剪出一个贪心算法
Info
已完成网站教程、网站习题、配套插件中所有多语言代码的校准,解决了之前 chatGPT 翻译可能出错的问题~
读完本文,你不仅学会了算法套路,还可以顺便解决如下题目:
LeetCode | Difficulty |
---|---|
1024. Video Stitching | 🟠 |
I've posted a few videos before, which can be considered as getting started with video editing. For non-professional editors like me, who don't create grand special effects or movie scenes, but just make tutorial videos, it's actually not that difficult. The main task is to make the video flow smoothly, so the most frequently used feature is the cutting function, followed by deleting and concatenating video clips.
Readers who have never edited videos might not know that in commonly used editing software, after a video is cut into several clips, each clip can be restored to the original video.
For example, a 10-second video cut in the middle becomes two 5-second videos. Each of these 5-second videos can be restored to the original 10-second video. It's like a worm: cutting itself into 4 segments can make a handful, and cutting into 11 segments can form a soccer team.
When editing videos, each video clip can be abstracted as an interval, with time as the endpoints of the interval. Some of these intervals overlap, while others do not...
Suppose the editing software does not support restoring video clips to the original video. How would I reconstruct the original video from several video clips?