aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/postprocessor/ffmpeg.py
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2015-01-10 05:45:51 +0100
committerPhilipp Hagemeister <phihag@phihag.de>2015-01-10 05:45:51 +0100
commit6271f1cad9331cbdb274906d8330736fb888bda2 (patch)
tree839365b1b4c6f04535098ba1aff55366914e11b3 /youtube_dl/postprocessor/ffmpeg.py
parentfb4b030aafee72801b47d4715391bd5822f80e13 (diff)
[youtube|ffmpeg] Automatically correct video with non-square pixels (Fixes #4674)
Diffstat (limited to 'youtube_dl/postprocessor/ffmpeg.py')
-rw-r--r--youtube_dl/postprocessor/ffmpeg.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/youtube_dl/postprocessor/ffmpeg.py b/youtube_dl/postprocessor/ffmpeg.py
index d1b342c7a..6e9194fa6 100644
--- a/youtube_dl/postprocessor/ffmpeg.py
+++ b/youtube_dl/postprocessor/ffmpeg.py
@@ -51,6 +51,10 @@ class FFmpegPostProcessor(PostProcessor):
return dict((p, get_exe_version(p, args=['-version'])) for p in programs)
@property
+ def available(self):
+ return self._executable is not None
+
+ @property
def _executable(self):
if self._downloader.params.get('prefer_ffmpeg', False):
prefs = ('ffmpeg', 'avconv')
@@ -540,3 +544,22 @@ class FFmpegAudioFixPP(FFmpegPostProcessor):
os.rename(encodeFilename(temp_filename), encodeFilename(filename))
return True, info
+
+
+class FFmpegFixupStretchedPP(FFmpegPostProcessor):
+ def run(self, info):
+ stretched_ratio = info.get('stretched_ratio')
+ if stretched_ratio is None or stretched_ratio == 1:
+ return
+
+ filename = info['filepath']
+ temp_filename = prepend_extension(filename, 'temp')
+
+ options = ['-c', 'copy', '-aspect', '%f' % stretched_ratio]
+ self._downloader.to_screen('[ffmpeg] Fixing aspect ratio in "%s"' % filename)
+ self.run_ffmpeg(filename, temp_filename, options)
+
+ os.remove(encodeFilename(filename))
+ os.rename(encodeFilename(temp_filename), encodeFilename(filename))
+
+ return True, info