admin 管理员组文章数量: 1184232
上传一刻相册,有30M大小限制。这个软件能免费剪裁视频而且支持手机的H.265格式,这个格式目前连potplayer都支持不好。但是配合FFmpeg可以检测并且能按大小(或时间)剪裁,并上传到一刻相册上播放。
下载FFmpeg的方法:打开网站
Download FFmpeg
然后选择Windows由gyan.dev构建,再将下载的压缩包解压为文件夹,将文件夹放到自己想放的位置,并在环境变量里添加其中bin文件夹的位置。
例如解压为ffmpeg文件夹放到C盘表面后,在环境变量Path里增加C:\ffmpeg\bin即可。
以下是批量剪裁python代码:
# coding=utf-8
import tkinter as tk
from tkinter import ttk, filedialog, messagebox
import subprocess
import os
import threading
import queue
import time
import json
class VideoSplitterApp:
def __init__(self, root):
self.root = root
self.root.title("视频分割工具")
self.root.geometry("500x400")
self.root.configure(bg='light yellow') # 设置背景为黄色
self.video_paths = []
self.split_method = tk.StringVar()
self.split_method.set("size") # 默认按大小分割
self.split_threads = []
self.output_dir = None
self.current_process = None
self.is_cancelled = False
self.progress_value = tk.DoubleVar()
self.current_video_index = 0
self.progress_queue = queue.Queue()
# 设置字体
self.font_style = ("FangSong", 12)
self.button_font_style = ("FangSong", 12, "bold")
# 糖果色按钮颜色
self.candy_colors = ['#FFB6C1', '#87CEFA', '#98FB98', '#DDA0DD', '#FFD700']
self.create_widgets()
# 定期检查进度队列
self.check_progress_queue()
# 检查FFmpeg是否可用
self.check_ffmpeg_available()
def check_ffmpeg_available(self):
"""检查系统是否安装了FFmpeg"""
try:
result = subprocess.run(['ffmpeg', '-version'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
if result.returncode != 0:
messagebox.showerror("错误", "未找到FFmpeg。请确保已正确安装FFmpeg并将其添加到系统PATH中。")
except FileNotFoundError:
messagebox.showerror("错误", "未找到FFmpeg。请确保已正确安装FFmpeg并将其添加到系统PATH中。")
def create_widgets(self):
# 文件选择部分
self.file_frame = tk.Frame(self.root, bg='light yellow')
self.file_frame.pack(pady=10, fill=tk.X, padx=10)
self.select_button = tk.Button(self.file_frame, text="选择视频文件",
command=self.select_video,
bg=self.candy_colors[0],
font=self.button_font_style,
relief=tk.RAISED, bd=2)
self.select_button.pack(side=tk.LEFT, padx=5)
self.file_label = tk.Label(self.file_frame, text="未选择文件",
wraplength=300, bg='light yellow',
font=self.font_style)
self.file_label.pack(side=tk.LEFT, padx=5, fill=tk.X, expand=True)
# 分割方式选择
self.method_frame = tk.Frame(self.root, bg='light yellow')
self.method_frame.pack(pady=10, fill=tk.X, padx=10)
self.time_radio = tk.Radiobutton(self.method_frame, text="按时间分割",
variable=self.split_method, value="time",
command=self.toggle_input,
bg='light yellow', font=self.font_style)
self.time_radio.pack(side=tk.LEFT, padx=5)
self.size_radio = tk.Radiobutton(self.method_frame, text="按大小分割",
variable=self.split_method, value="size",
command=self.toggle_input,
bg='light yellow', font=self.font_style)
self.size_radio.pack(side=tk.LEFT, padx=5)
# 输入框
self.input_frame = tk.Frame(self.root, bg='light yellow')
self.input_frame.pack(pady=10, fill=tk.X, padx=10)
self.time_label = tk.Label(self.input_frame, text="分割时间(秒):",
&nbs
版权声明:本文标题:win10(三)视频剪裁 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.roclinux.cn/b/1766219325a3445104.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论