mirror of
https://github.com/xavier150/convert-video-for-Resolve
synced 2025-11-08 18:45:04 +01:00
Add script
This commit is contained in:
46
ConvertVideoForResolve.py
Normal file
46
ConvertVideoForResolve.py
Normal file
@@ -0,0 +1,46 @@
|
||||
print("start")
|
||||
|
||||
import os
|
||||
from os import listdir
|
||||
from os.path import isfile, join
|
||||
import time
|
||||
|
||||
def VerifiDirs(directory):
|
||||
# Check and create a folder if it does not exist
|
||||
|
||||
if not os.path.exists(directory):
|
||||
os.makedirs(directory)
|
||||
return True
|
||||
return False
|
||||
|
||||
source_path = os.path.join(os.path.dirname(os.path.realpath(__file__)),"Source")
|
||||
export_path = os.path.join(os.path.dirname(os.path.realpath(__file__)),"Export")
|
||||
VerifiDirs(source_path)
|
||||
VerifiDirs(export_path)
|
||||
|
||||
files = [f for f in listdir(source_path) if isfile(join(source_path, f))] #Get all files
|
||||
|
||||
def convert(fileName):
|
||||
|
||||
SourceFile = os.path.join(source_path, fileName)
|
||||
newFileName = fileName
|
||||
#newFileName = newFileName[32:] #Lenge of vlc-record-2019-12-31-03h03m48s-
|
||||
newFileName = newFileName[:-4]
|
||||
#newFileName = newFileName+str(time.time())
|
||||
newFileName = newFileName+".mov"
|
||||
ExportFile = os.path.join(export_path, newFileName)
|
||||
|
||||
com = "cmd /k 'ffmpeg -i \""+SourceFile+"\" -vcodec mjpeg -q:v 2 -acodec pcm_s16be -q:a 0 -f mov \""+ExportFile+"\"'"
|
||||
com = "cmd /c ffmpeg -i \""+SourceFile+"\" -vcodec mjpeg -q:v 2 -acodec pcm_s16be -q:a 0 -f mov \""+ExportFile+"\""
|
||||
#com = 'cmd /c "ffmpeg"'
|
||||
print(com)
|
||||
os.system(com)
|
||||
|
||||
#video = moviepy.VideoFileClip(SourceFile)
|
||||
#video.write_videofile(os.path.join(ExportFile),fps=24, codec='libx264', audio_codec='m4a')
|
||||
#video.audio.write_audiofile(os.path.join(os.path.join(export_path, "sound"+".m4a")))
|
||||
|
||||
|
||||
for file in files:
|
||||
print(file)
|
||||
convert(file)
|
||||
Reference in New Issue
Block a user