import os
try:
import cPickle
except:
import pickle
from multiprocessing import Pool
rootpath = "E:/data/UCF101" # 存放视频的目录
outpath = "C:/data/UCF101" # 抽帧后存放目录
# f1 = open("qita_val.txt", "r") # 每行为label/视频名
# lines = [x.strip() for x in f1.readlines()] # 生成视频序列list。[001.mp4, 002.mp4, ....]
labelList = os.listdir(rootpath)
lines = []
for label in labelList:
videoList = os.listdir(os.path.join(rootpath, label))
for j in videoList:
lines.append(label+"/"+j)
def cut_video(entry):
name = entry.strip()
video_path = os.path.join(rootpath, name)
label = name.split("/")[0]
if not os.path.exists(os.path.join(outpath, label)):
os.makedirs(os.path.join(outpath, label))
vid = os.path.join(outpath, label, video_path.split('/')[-1].split(".")[0])
if os.path.exists(video_path):
if not os.path.exists
利用ffmpeg多线程抽帧
最新推荐文章于 2024-07-03 15:06:39 发布
本文介绍了如何使用ffmpeg命令进行视频抽帧和图片合成视频操作。在抽帧过程中,通过设置-q参数来控制质量,-r参数用于指定每秒抽取的帧数。在合成视频时,同样用-r设定帧率,-i参数指定了输入的图片路径,最后输出为out.mp4。
摘要由CSDN通过智能技术生成