mirror of
https://github.com/l1ving/youtube-dl
synced 2024-12-21 23:42:56 +08:00
Copy the mtime from the oldest source file to the file created by ffmpeg
Fixes #4245
This commit is contained in:
parent
07e378fa18
commit
0cd64bd077
@ -79,6 +79,7 @@ class FFmpegPostProcessor(PostProcessor):
|
|||||||
files_cmd = []
|
files_cmd = []
|
||||||
for path in input_paths:
|
for path in input_paths:
|
||||||
files_cmd.extend(['-i', encodeFilename(path, True)])
|
files_cmd.extend(['-i', encodeFilename(path, True)])
|
||||||
|
oldest_mtime = min(os.stat(path).st_mtime for path in input_paths)
|
||||||
cmd = ([self._executable, '-y'] + files_cmd
|
cmd = ([self._executable, '-y'] + files_cmd
|
||||||
+ [encodeArgument(o) for o in opts] +
|
+ [encodeArgument(o) for o in opts] +
|
||||||
[encodeFilename(self._ffmpeg_filename_argument(out_path), True)])
|
[encodeFilename(self._ffmpeg_filename_argument(out_path), True)])
|
||||||
@ -91,6 +92,7 @@ class FFmpegPostProcessor(PostProcessor):
|
|||||||
stderr = stderr.decode('utf-8', 'replace')
|
stderr = stderr.decode('utf-8', 'replace')
|
||||||
msg = stderr.strip().split('\n')[-1]
|
msg = stderr.strip().split('\n')[-1]
|
||||||
raise FFmpegPostProcessorError(msg)
|
raise FFmpegPostProcessorError(msg)
|
||||||
|
os.utime(out_path, (oldest_mtime, oldest_mtime))
|
||||||
if self._deletetempfiles:
|
if self._deletetempfiles:
|
||||||
for ipath in input_paths:
|
for ipath in input_paths:
|
||||||
os.remove(ipath)
|
os.remove(ipath)
|
||||||
|
Loading…
Reference in New Issue
Block a user