[postprocessor/ffmpeg] changed the name of the output file if recoding is forced
This commit is contained in:
parent
f05d29c932
commit
5e925259eb
@ -357,16 +357,22 @@ class FFmpegVideoConvertorPP(FFmpegPostProcessor):
|
|||||||
|
|
||||||
def run(self, information):
|
def run(self, information):
|
||||||
path = information['filepath']
|
path = information['filepath']
|
||||||
if self._force_recode:
|
if information['ext'] == self._preferedformat:
|
||||||
self._downloader.to_screen('[ffmpeg] Forcing video file recoding as %s' % (self._preferedformat))
|
if self._force_recode:
|
||||||
if information['ext'] == self._preferedformat and not self._force_recode:
|
self._downloader.to_screen('[ffmpeg] Forcing video file recoding as %s' % (self._preferedformat))
|
||||||
self._downloader.to_screen('[ffmpeg] Not converting video file %s - already is in target format %s' % (path, self._preferedformat))
|
# ffmpeg cannot read and write to the same file, we add a suffix to write to a new one
|
||||||
return [], information
|
suffix = '.recoded'
|
||||||
|
else:
|
||||||
|
self._downloader.to_screen('[ffmpeg] Not converting video file %s - already is in target format %s' % (path, self._preferedformat))
|
||||||
|
return [], information
|
||||||
|
else:
|
||||||
|
# no need for a suffix if the output path is not the same
|
||||||
|
suffix = ''
|
||||||
options = []
|
options = []
|
||||||
if self._preferedformat == 'avi':
|
if self._preferedformat == 'avi':
|
||||||
options.extend(['-c:v', 'libxvid', '-vtag', 'XVID'])
|
options.extend(['-c:v', 'libxvid', '-vtag', 'XVID'])
|
||||||
prefix, sep, ext = path.rpartition('.')
|
prefix, sep, ext = path.rpartition('.')
|
||||||
outpath = prefix + sep + self._preferedformat
|
outpath = prefix + suffix + sep + self._preferedformat
|
||||||
self._downloader.to_screen('[ffmpeg] Converting video from %s to %s, Destination: ' % (information['ext'], self._preferedformat) + outpath)
|
self._downloader.to_screen('[ffmpeg] Converting video from %s to %s, Destination: ' % (information['ext'], self._preferedformat) + outpath)
|
||||||
self.run_ffmpeg(path, outpath, options)
|
self.run_ffmpeg(path, outpath, options)
|
||||||
information['filepath'] = outpath
|
information['filepath'] = outpath
|
||||||
|
Loading…
x
Reference in New Issue
Block a user