Python implements multiple slices of a single video and merges them in order. Operations with an interface can generate slices multiple times and merge them multiple times

start

It took two or three days to write a little bit of code, and the problems were messed up, so I had to modify them. . Finally wrote it out. .
There must be ffmpeg, and its environment variables must be configured. Not much to say, the comments are very detailed

main function

  1. The interface provides a button to select a video, click this button to select a video file, and display the file in the input box;
  2. Provide an input box for the user to input the number n to be sliced;
  3. Next, according to the number of slices to be sliced, generate n sets of start and end time input boxes and a start button for the user to input the start and end time of each slice;
  4. After entering all the content, click the start button——
    1. Call ffmpeg to realize video cutting, and intercept the video clips required by the user
    2. At the same time, the fragmented video is spliced ​​into a new overall video
    3. After the video splicing is completed, all fragmented videos will be deleted to realize video cutting and merging

Other functions

  1. The dynamically generated n sets of start and end time input boxes are in the scroll area, if n is too large, you can scroll to view;
  2. The default value of start and end box time is 00:00:00
  3. After merging once, the operation will not be closed, and clicking the input again will clear the original start and stop boxes and start buttons in the scrolling area, and generate new n groups of start and stop boxes and a start button according to the new n;
  4. After 3 minutes of no operation on the interface, it will automatically shut down and run

Notice

As follows, some file paths or others can be modified by yourself

  1. The default path for opening files is the current folder
  2. The save location is in the same folder as the source video file
  3. Cutting and merging the same video multiple times will overwrite the merged video by default (because the generated files all have the same name)

exhibit

insert image description here

the code

https://github.com/CJCchester/code-memory/blob/small-tools/one_video_cut_and_concat.py

Supongo que te gusta

Origin blog.csdn.net/weixin_50624398/article/details/128638428
Recomendado
Clasificación