From 4c652cf3ec29b1e283d112687121e7e0b050e5b7 Mon Sep 17 00:00:00 2001 From: evazion Date: Wed, 23 Feb 2022 02:34:13 -0600 Subject: [PATCH] ugoiras: increase quality of webm samples. Fix certain ugoiras having very low quality webm samples. This was because we had a target bitrate of 5 Mbps, but this wasn't enough for videos that were high resolution or that had choppy, hard-to-compress motion, such as post 5081776 (nsfw). --- app/logical/media_file/ugoira.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/logical/media_file/ugoira.rb b/app/logical/media_file/ugoira.rb index 743094e6b..88978de82 100644 --- a/app/logical/media_file/ugoira.rb +++ b/app/logical/media_file/ugoira.rb @@ -85,7 +85,7 @@ class MediaFile::Ugoira < MediaFile end ext = zipfile.first.name.match(/\.(\w{,4})$/)[1] - ffmpeg_out, status = Open3.capture2e("ffmpeg -i #{tmpdir}/images/%06d.#{ext} -codec:v libvpx -crf 4 -b:v 5000k -an #{tmpdir}/tmp.webm") + ffmpeg_out, status = Open3.capture2e("ffmpeg -i #{tmpdir}/images/%06d.#{ext} -codec:v libvpx -crf 12 -b:v 0 -an #{tmpdir}/tmp.webm") raise Error, "ffmpeg failed: #{ffmpeg_out}" unless status.success? mkvmerge_out, status = Open3.capture2e("mkvmerge -o #{output_file.path} --webm --timecodes 0:#{tmpdir}/timecodes.tc #{tmpdir}/tmp.webm")