If we want to get parts from videos contained in a csv file that has this data:
001.mp4,1,10
002.mp4,2,10
003.mp4,3,10
004.mp4,5,10
005.mp4,1,10
Saved in text.csv,
You can use this code:
import os, glob from tkinter import filedialog import tkinter as tk def getpart(name, start, end): newname = name[:-4] + "_.mp4" os.system(f"ffmpeg -i {name} -ss {start} -t {end} -c copy {newname}") print(f"saved {name[:-4]}_.mp4") with open("movie.csv") as file: mlist = file.readlines() mlist = [x.strip() for x in mlist] print(mlist) for line in mlist: name, start, end = line.split(",") getpart(name, start, end)
How to get a video from another one telling where to start and where to end with Python and ffmpeg
Twitter: @pythonprogrammi - python_pygame