diff --git a/cms/settings.py b/cms/settings.py index e0c0b5220..1c69706d8 100644 --- a/cms/settings.py +++ b/cms/settings.py @@ -479,3 +479,6 @@ r'/accounts/logout/$', r'/accounts/signup/$', ] + +# if True, only show original, don't perform any action on videos +DO_NOT_TRANSCODE_VIDEO = False diff --git a/files/models.py b/files/models.py index 3339d4d4e..1992da7f9 100644 --- a/files/models.py +++ b/files/models.py @@ -431,8 +431,14 @@ def media_init(self): self.set_media_type() if self.media_type == "video": self.set_thumbnail(force=True) - self.produce_sprite_from_video() - self.encode() + if settings.DO_NOT_TRANSCODE_VIDEO: + self.encoding_status = "success" + if self.state == "public" and self.encoding_status == "success" and self.is_reviewed is True: + self.listable = True + self.save(update_fields=['encoding_status', 'listable']) + else: + self.produce_sprite_from_video() + self.encode() elif self.media_type == "image": self.set_thumbnail(force=True) return True @@ -661,6 +667,11 @@ def encodings_info(self, full=False): return ret for key in ENCODE_RESOLUTIONS_KEYS: ret[key] = {} + + if settings.DO_NOT_TRANSCODE_VIDEO: + ret['720'] = {"h264": {"url": helpers.url_from_path(self.media_file.path), "status": "success", "progress": 100}} + return ret + for encoding in self.encodings.select_related("profile").filter(chunk=False): if encoding.profile.extension == "gif": continue