Reorder for better merging
This commit is contained in:
parent
b01fa6bdbc
commit
e664c6a8e6
@ -583,6 +583,30 @@ class FFmpegMetadataPP(FFmpegPostProcessor):
|
|||||||
return True, info
|
return True, info
|
||||||
|
|
||||||
|
|
||||||
|
class FFmpegJoinVideosPP(FFmpegPostProcessor):
|
||||||
|
def run(self, information):
|
||||||
|
filename = information['filepath']
|
||||||
|
parts = information.get('parts')
|
||||||
|
if parts is None or len(parts) == 1:
|
||||||
|
return (True, information)
|
||||||
|
parts_files = [build_part_filename(filename, i) for (i, _) in enumerate(parts)]
|
||||||
|
files_file = u'%s.videos' % filename
|
||||||
|
with io.open(encodeFilename(files_file), 'w', encoding='utf-8') as f:
|
||||||
|
for video in parts_files:
|
||||||
|
f.write(u'file \'%s\'\n' % video)
|
||||||
|
self._downloader.to_screen(u'[ffmpeg] Joining video parts, destination: %s' % filename)
|
||||||
|
try:
|
||||||
|
self.run_ffmpeg(files_file, filename, ['-c', 'copy'], ['-f', 'concat'])
|
||||||
|
except FFmpegPostProcessorError:
|
||||||
|
return False, information
|
||||||
|
os.remove(encodeFilename(files_file))
|
||||||
|
# We have to manually remove the parts if requested
|
||||||
|
if not self._downloader.params.get('keepvideo', False):
|
||||||
|
for part_file in parts_files:
|
||||||
|
os.remove(encodeFilename(part_file))
|
||||||
|
return (True, information)
|
||||||
|
|
||||||
|
|
||||||
class FFmpegMergerPP(FFmpegPostProcessor):
|
class FFmpegMergerPP(FFmpegPostProcessor):
|
||||||
def run(self, info):
|
def run(self, info):
|
||||||
filename = info['filepath']
|
filename = info['filepath']
|
||||||
@ -642,27 +666,3 @@ class FFmpegFixupM4aPP(FFmpegPostProcessor):
|
|||||||
os.rename(encodeFilename(temp_filename), encodeFilename(filename))
|
os.rename(encodeFilename(temp_filename), encodeFilename(filename))
|
||||||
|
|
||||||
return True, info
|
return True, info
|
||||||
|
|
||||||
|
|
||||||
class FFmpegJoinVideosPP(FFmpegPostProcessor):
|
|
||||||
def run(self, information):
|
|
||||||
filename = information['filepath']
|
|
||||||
parts = information.get('parts')
|
|
||||||
if parts is None or len(parts) == 1:
|
|
||||||
return (True, information)
|
|
||||||
parts_files = [build_part_filename(filename, i) for (i, _) in enumerate(parts)]
|
|
||||||
files_file = u'%s.videos' % filename
|
|
||||||
with io.open(encodeFilename(files_file), 'w', encoding='utf-8') as f:
|
|
||||||
for video in parts_files:
|
|
||||||
f.write(u'file \'%s\'\n' % video)
|
|
||||||
self._downloader.to_screen(u'[ffmpeg] Joining video parts, destination: %s' % filename)
|
|
||||||
try:
|
|
||||||
self.run_ffmpeg(files_file, filename, ['-c', 'copy'], ['-f', 'concat'])
|
|
||||||
except FFmpegPostProcessorError:
|
|
||||||
return False, information
|
|
||||||
os.remove(encodeFilename(files_file))
|
|
||||||
# We have to manually remove the parts if requested
|
|
||||||
if not self._downloader.params.get('keepvideo', False):
|
|
||||||
for part_file in parts_files:
|
|
||||||
os.remove(encodeFilename(part_file))
|
|
||||||
return (True, information)
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user