前幾天下載了幾個(gè)視頻,但是有兩集是一個(gè)視頻的,偶爾找到了ffmpeg處理視頻的方法,它的功能非常強(qiáng)大。因此,分享一下,一起學(xué)習(xí)。
import subprocess,sys,os import re class CutSplicingVdeio(object): def __init__(self): pass #dercription CutSplicingVdeio this class function def instructions(self): dercription="vdeio and image transform,vdeio other opreation" return dercription def transcribeScreen(self,filePath): filePath=filePath.decode('utf-8') cmd=ffmpegPath + " -f gdigrab -framerate 60 -offset_x 0 -offset_y 0 -video_size 1366x768 -i desktop " + filePath cmd=cmd.encode(sys.getfilesystemencoding()) if "?" in cmd: cmd=cmd.replace("?","") print cmd subprocess.call(cmd , shell=True) vp=CutSplicingVdeio() vp.transcribeScreen(r"C:\Users\Administrator\Desktop\transcribe.avi") #according to give a video filepath (transcribe Screen)