some browsers / devices only support yuv420p

This commit is contained in:
j 2025-02-01 16:03:06 +05:30
parent 56fa0986be
commit 57a0c3a032

View File

@ -202,10 +202,16 @@ class Content(models.Model):
video_path = self.photo.image.path.replace('.gif', '.mp4')
image_path = self.photo.image.path.replace('.gif', '.jpg')
if not os.path.exists(video_path):
height = self.photo.image.height
if height % 2:
height += 1
cmd = [
'ffmpeg',
'-hide_banner', '-nostats', '-loglevel', 'error',
'-i', self.photo.image.path, video_path
'-i', self.photo.image.path,
'-vf', 'scale=-2:%s' % height,
'-pix_fmt', 'yuv420p',
video_path
]
subprocess.call(cmd)
if not os.path.exists(image_path):