[feature] ffmpeg concate

This commit is contained in:
Klesh Wong 2020-12-07 20:25:01 +08:00
parent 31e08fa2b2
commit 649400f4e5

View File

@ -170,3 +170,33 @@ class fzf_edit(Command):
if fzf.returncode == 0: if fzf.returncode == 0:
fzf_file = os.path.abspath(stdout.rstrip('\n')) fzf_file = os.path.abspath(stdout.rstrip('\n'))
self.fm.edit_file(fzf_file) self.fm.edit_file(fzf_file)
class fc(Command):
def execute(self):
""" Concatenate selected video """
cwd = self.fm.thisdir
marked_files = cwd.get_selection()
if not marked_files:
return
def refresh(_):
cwd = self.fm.get_directory(original_path)
cwd.load_content()
tmppath = '/tmp/concate-recording'
with open(tmppath, 'w') as f:
f.writelines("file {}".format(f.path) + '\n' for f in marked_files)
original_path = cwd.path
descr = "concatenating"
obj = CommandLoader(
args=['ffmpeg', '-f', 'concat', '-safe', '0', '-i', tmppath, '-c', 'copy', self.args[1]],
descr=descr,
read=True
)
obj.signal_bind('after', refresh)
self.fm.loader.add(obj)