1
0
mirror of https://github.com/l1ving/youtube-dl synced 2025-02-04 23:52:56 +08:00

Determine output extension based on input

ffmpeg might be able to handle some cases of differing extensions, so I figure just give it a shot and hope it works. What's the worst that could happen?
This commit is contained in:
AGSPhoenix 2014-04-19 02:03:47 -04:00
parent e523a89d97
commit ce9f19fd2b

View File

@ -491,7 +491,14 @@ class FFmpegConcatPP(FFmpegPostProcessor):
#Concat support requires that the IE return '_type' = 'playlist'
#Otherwise it silently fail
def run(self, info):
filename = info['title'] + u'.mp4' #What could possibly go wrong?
#Determine appropriate output extension
extlist = []
for input_filename in info['__files_to_append']:
extlist.append(os.path.splitext(input_filename)[-1])
if len(set(extlist)) != 1:
self._downloader.report_warning('Not all files are in the same format! Joining the files may fail.')
filename = info['title'] + extlist[0]
concatargs = ['-f', 'concat']
args = ['-c', 'copy']
self._downloader.to_screen(u'[ffmpeg] Appending files into "%s"' % filename)