basic functions online

This commit is contained in:
K4YT3X
2018-02-24 16:13:27 -05:00
parent 3929259d36
commit 57733d602b
4 changed files with 81 additions and 19 deletions

View File

@@ -17,17 +17,18 @@ import os
class FFMPEG:
def __init__(self):
pass
def __init__(self, ffmpeg_path, outfile):
self.ffmpeg_path = ffmpeg_path
self.outfile = outfile
def strip_frames(self, videoin, outpath):
os.system("ffmpeg -i {} -r 1/1 {}/extracted_%0d.png".format(videoin, outpath))
os.system("{} -i {} {}/extracted_%0d.png -y".format(self.ffmpeg_path, videoin, outpath))
def extract_audio(self, videoin, outpath):
os.system("ffmpeg -i {} -vn -acodec copy {}/output-audio.aac".format(videoin, outpath))
os.system("{} -i {} -vn -acodec copy {}/output-audio.aac -y".format(self.ffmpeg_path, videoin, outpath))
def to_vid(self, framerate, resolution, folder):
os.system("ffmpeg -r {} -f image2 -s {} -i {}/extracted_%d.png -vcodec libx264 -crf 25 -pix_fmt yuv420p output.mp4".format(framerate, resolution, folder))
os.system("{} -r {} -f image2 -s {} -i {}/extracted_%d.png -vcodec libx264 -crf 25 -pix_fmt yuv420p output.mp4 -y".format(self.ffmpeg_path, framerate, resolution, folder))
def pressin_audio(self, videoin):
os.system("ffmpeg -i {} -i audio.mp3 -codec copy -shortest output.mp4")
def pressin_audio(self, videoin, outpath):
os.system("{} -i {} -i {}/output-audio.aac -codec copy -shortest {} -y".format(self.ffmpeg_path, videoin, outpath, self.outfile))