From 0f9b9c6248fdb2958c22e33a38e9955dfcc1f3bd Mon Sep 17 00:00:00 2001 From: Daniel Nitsikopoulos Date: Thu, 29 Feb 2024 20:30:06 +1100 Subject: [PATCH] Adjust mp4 encoding --- slices/micropub/commands/media/upload.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/slices/micropub/commands/media/upload.rb b/slices/micropub/commands/media/upload.rb index 38e7245..94bd450 100644 --- a/slices/micropub/commands/media/upload.rb +++ b/slices/micropub/commands/media/upload.rb @@ -59,9 +59,9 @@ module Micropub when "image/gif" Open3.popen3("ffmpeg -i #{file[:tempfile].path} -movflags faststart -pix_fmt yuv420p -vf 'scale=trunc(iw/2)*2:trunc(ih/2)*2' #{File.join(dirname, fullsize_filename)}") when "video/mp4" - Open3.popen3("ffmpeg -i #{file[:tempfile].path} -c:v h264 -profile:v main -vf format=yuv420p -c:a aac -movflags +faststart #{File.join(dirname, fullsize_filename)}") + Open3.popen3("ffmpeg -i #{file[:tempfile].path} -c:v libx265 -preset fast -crf 28 -tag:v hvc1 -c:a eac3 -b:a 224k #{File.join(dirname, fullsize_filename)}") when "video/mov" - Open3.popen3("ffmpeg -i #{file[:tempfile].path} -c:v h264 -profile:v main -vf format=yuv420p -c:a aac -movflags +faststart #{File.join(dirname, fullsize_filename)}") + Open3.popen3("ffmpeg -i #{file[:tempfile].path} -c:v libx265 -preset fast -crf 28 -tag:v hvc1 -c:a eac3 -b:a 224k #{File.join(dirname, fullsize_filename)}") end rescue Errno::ENOENT, NoMethodError => e return Failure(e.message)