def run(self): cmd = '{ffmpeg} -y -i "{fn}" -c:v copy -af volume=0 "{o}"'.format( ffmpeg=get_ffmpeg_binary(), fn=self.input, o=self.output, ) return run_command(cmd)
def run(self): cmd = '{ffmpeg} -y -i "{fn}" -vcodec h264 -acodec aac "{o}"'.format( ffmpeg=get_ffmpeg_binary(), fn=self.input, o=self.output, ) return run_command(cmd)
def run(self): cmd = '{ffmpeg} -y -i "{fn}" -filter_complex "{filter}" -map "[v]" -map "[a]" "{o}"'.format( ffmpeg=get_ffmpeg_binary(), fn=self.input, filter=self.get_complex_filter(), o=self.output, ) return run_command(cmd)
def run(self): # '-vcodec libwebp -r 20 -lossless 0 -compression_level 2 -q:v 50 -loop 0 -preset photo -an -vsync 0 -vf scale=480:-1 ' # cmd = '{ffmpeg} -i "{fn}" -ss {s} -to {d} -vf scale=300:-1,fps=10 -an -vsync 0 "{o}"'.format( # ffmpeg=get_ffmpeg_binary(), # fn=self.input, # s=get_time_str(self.start_time), # d=get_time_str(self.end_time), # # re="" if self.reencode else "-c copy", # o=self.output, # ) # print(cmd) # return run_command(cmd) ''' 'http://www.unixlinux.online/unixlinux/linuxjc/linuxjc/201702/19148.html' 'http://ffmpeg.org/ffmpeg-filters.html#palettegen' 'https://ffmpeg.org/ffmpeg-scaler.html' ''' palette = os.path.join(os.path.dirname(self.input), "palette.png") filters = "fps=10,scale=%s:flags=bicubic" % make_scale(self.input, 300) palette_cmd = '{ffmpeg} -ss {s} -to {d} -i "{fn}" ' \ '-vf "{filters},palettegen" -y {palette}'.format( ffmpeg=get_ffmpeg_binary(), fn=self.input, s=get_time_str(self.start_time), d=get_time_str(self.end_time), filters=filters, palette=palette, ) print(palette_cmd) run_command(palette_cmd) cmd = '{ffmpeg} -ss {s} -to {d} -i "{fn}" -i "{palette}" ' \ '-lavfi "{filters} [x]; [x][1:v] paletteuse" -y "{o}"'.format( ffmpeg=get_ffmpeg_binary(), fn=self.input, s=get_time_str(self.start_time), d=get_time_str(self.end_time), filters=filters, palette=palette, o=self.output, ) print(cmd) run = run_command(cmd) if os.path.exists(palette): os.remove(palette) return run
def run(self): cmd = '{ffmpeg} -i "{fn}" -f image2 -ss {draction} -vframes 1 "{o}"'.format( ffmpeg=get_ffmpeg_binary(), fn=self.input, draction=get_time_str(self.p), o=self.output, ) print(cmd) return run_command(cmd)
def run(self): cmd = '{ffmpeg} -y -ss {s:.2f} -t {d:.2f} -i "{fn}" -async 1 {re} "{o}"'.format( ffmpeg=get_ffmpeg_binary(), fn=self.input, s=self.start_time / 1000, d=(self.end_time - self.start_time) / 1000, re="" if self.reencode else "-c copy", o=self.output, ) return run_command(cmd)
def run(self): cmd = '{ffmpeg} -i "{fn}" -vcodec libwebp -loop 0 ' \ '-vf scale={scale},fps={fps} -an -vsync 0 -y "{o}"'.\ format( ffmpeg=get_ffmpeg_binary(), fn=self.input, scale=make_scale(self.input, self.scale), fps=self.fps, o=self.output, ) print('导出webp:%s' % self.output) return run_command(cmd)
def run(self): # '-vcodec libwebp -r 20 -lossless 0 -compression_level 2 -q:v 50 -loop 0 -preset photo -an -vsync 0 -vf scale=480:-1 ' cmd = '{ffmpeg} -i "{fn}" -ss {s} -to {d} ' \ '-vcodec libwebp -lossless 0 -qscale 50 -preset default -loop 0 -vf scale={scale},fps=10 -an -vsync 0 ' \ '"{o}"'.format( ffmpeg=get_ffmpeg_binary(), fn=self.input, s=get_time_str(self.start_time), d=get_time_str(self.end_time), scale=make_scale(self.input), o=self.output, ) print(cmd) return run_command(cmd)
def join_video_list(list_file, output_file): cmd = '{ffmpeg} -y -safe 0 -f concat -i "{list_file}" "{o}"'.format( ffmpeg=get_ffmpeg_binary(), list_file=list_file, o=output_file) return run_command(cmd)