From 57a0c3a032f0de8e2faa58dbf8d0ab64c4d0a196 Mon Sep 17 00:00:00 2001 From: j Date: Sat, 1 Feb 2025 16:03:06 +0530 Subject: [PATCH] some browsers / devices only support yuv420p --- content/models.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/content/models.py b/content/models.py index 93e5064..983fe2b 100644 --- a/content/models.py +++ b/content/models.py @@ -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):