summary refs log tree commit diff
diff options
context:
space:
mode:
authorIvan Kozik <ivan@ludios.org>2014-11-20 06:25:12 +0000
committerIvan Kozik <ivan@ludios.org>2014-11-20 06:39:07 +0000
commit0cd64bd077fb378ae3afc5b2a8e091e4f50df9c2 (patch)
tree778ed48a98e10ffb3af624d12d733677c4b6de2a
parent07e378fa18b1c6b8becd46f6cf2d476e29a70a59 (diff)
downloadyoutube-dl-0cd64bd077fb378ae3afc5b2a8e091e4f50df9c2.tar.gz
youtube-dl-0cd64bd077fb378ae3afc5b2a8e091e4f50df9c2.tar.xz
youtube-dl-0cd64bd077fb378ae3afc5b2a8e091e4f50df9c2.zip
Copy the mtime from the oldest source file to the file created by ffmpeg
Fixes #4245
-rw-r--r--youtube_dl/postprocessor/ffmpeg.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/youtube_dl/postprocessor/ffmpeg.py b/youtube_dl/postprocessor/ffmpeg.py
index f3f2743c0..d44de84cf 100644
--- a/youtube_dl/postprocessor/ffmpeg.py
+++ b/youtube_dl/postprocessor/ffmpeg.py
@@ -79,6 +79,7 @@ class FFmpegPostProcessor(PostProcessor):
         files_cmd = []
         for path in input_paths:
             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
                + [encodeArgument(o) for o in opts] +
                [encodeFilename(self._ffmpeg_filename_argument(out_path), True)])
@@ -91,6 +92,7 @@ class FFmpegPostProcessor(PostProcessor):
             stderr = stderr.decode('utf-8', 'replace')
             msg = stderr.strip().split('\n')[-1]
             raise FFmpegPostProcessorError(msg)
+        os.utime(out_path, (oldest_mtime, oldest_mtime))
         if self._deletetempfiles:
             for ipath in input_paths:
                 os.remove(ipath)