summary refs log tree commit diff
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2015-01-10 06:10:18 +0100
committerPhilipp Hagemeister <phihag@phihag.de>2015-01-10 06:10:18 +0100
commit43bc88903d0665c42f205bddd0a2f5017581e8be (patch)
tree97f76d7250f6945979e4091a4b63cd84a93de180
parent6ef9f88299e1595bbe467fb527ada9b003ae5779 (diff)
parent0cd64bd077fb378ae3afc5b2a8e091e4f50df9c2 (diff)
downloadyoutube-dl-43bc88903d0665c42f205bddd0a2f5017581e8be.tar.gz
youtube-dl-43bc88903d0665c42f205bddd0a2f5017581e8be.tar.xz
youtube-dl-43bc88903d0665c42f205bddd0a2f5017581e8be.zip
Merge remote-tracking branch 'ivan/muxed-mtime'
-rw-r--r--youtube_dl/postprocessor/ffmpeg.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/youtube_dl/postprocessor/ffmpeg.py b/youtube_dl/postprocessor/ffmpeg.py
index 6e9194fa6..8bf5bebc3 100644
--- a/youtube_dl/postprocessor/ffmpeg.py
+++ b/youtube_dl/postprocessor/ffmpeg.py
@@ -82,12 +82,14 @@ class FFmpegPostProcessor(PostProcessor):
     def run_ffmpeg_multiple_files(self, input_paths, out_path, opts):
         self.check_version()
 
+        oldest_mtime = min(os.stat(path).st_mtime for path in input_paths)
+
         files_cmd = []
         for path in input_paths:
             files_cmd.extend([encodeArgument('-i'), encodeFilename(path, True)])
         cmd = ([encodeFilename(self._executable, True), encodeArgument('-y')] +
-               files_cmd
-               + [encodeArgument(o) for o in opts] +
+               files_cmd +
+               [encodeArgument(o) for o in opts] +
                [encodeFilename(self._ffmpeg_filename_argument(out_path), True)])
 
         if self._downloader.params.get('verbose', False):
@@ -98,6 +100,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)