Skip to content
Browse files

Default dimensions on settings so users can resize all videos automat…

…ically

Save command output on conversion when no file is generated (was saving a meaningless exception)
  • Loading branch information...
1 parent 7a90fab commit 8304681a6460c58a5ad1f14753f6ecb90dd93fdb @nmfm committed
Showing with 6 additions and 3 deletions.
  1. +3 −1 filer/models/videomodels.py
  2. +2 −0 filer/settings.py
  3. +1 −2 filer/utils/video.py
View
4 filer/models/videomodels.py
@@ -96,7 +96,9 @@ def convert(self):
(self.width, self.height) != (self.original_width, self.original_height)):
new_dimensions = "%sx%s" % (self.width, self.height)
else:
- new_dimensions = ""
+ new_dimensions = filer_settings.FFMPEG_TARGET_DIMENSIONS
+ if new_dimensions:
+ self.width, self.height = new_dimensions.split('x')
for extension in filer_settings.FILER_VIDEO_FORMATS:
res, out = convert_video(original_path, path, extension, new_dimensions)
error = error or res
View
2 filer/settings.py
@@ -120,6 +120,8 @@
FFMPEG_CHECK_CMD = "ffmpeg -i %(input_file)s"
# command line for video conversion
FFMPEG_CMD = "ffmpeg -i %(input_file)s -y -b 2326k -ar 44100 -ab 224k -ac 2 -f %(format)s %(dimensions)s %(target_file)s"
+# dimensions of the converted videos - leave blank to keep the original video size
+FFMPEG_TARGET_DIMENSIONS = "640x480"
# argument for setting the size in ffmpeg
FFMPEG_SIZE_ARGUMENT = "-s %(dimensions)s"
# command line for grabbing preview image from video
View
3 filer/utils/video.py
@@ -50,8 +50,7 @@ def execute_ffmpeg_command(com, targetfile):
os.remove(targetfile)
return True, "\n".join([com, ffmpegresult])
except:
- return True, traceback.format_exc()
- #return True, "\n".join([com, ffmpegresult])
+ return True, "\n".join([com, ffmpegresult])
except:
return True, traceback.format_exc()
return False, ffmpegresult

0 comments on commit 8304681

Please sign in to comment.
Something went wrong with that request. Please try again.