From 423e39370c97ec5677fe03a019e41c0ffa6986e1 Mon Sep 17 00:00:00 2001 From: Daniel Nitsikopoulos Date: Thu, 29 Feb 2024 20:20:53 +1100 Subject: [PATCH] Update video 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 595ca70..38e7245 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} -vcodec libx264 -crf 28 #{File.join(dirname, fullsize_filename)}") + 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)}") when "video/mov" - Open3.popen3("ffmpeg -i #{file[:tempfile].path} -vcodec libx264 -crf 28 #{File.join(dirname, fullsize_filename)}") + 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)}") end rescue Errno::ENOENT, NoMethodError => e return Failure(e.message)