diff options
author | ThibG <thib@sitedethib.com> | 2020-03-09 23:15:59 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-09 23:15:59 +0100 |
commit | abd839488054b6de2dec9e7ec095d79e4a106573 (patch) | |
tree | 5fb6e304461827fa3fe684a0cd5639b317f81394 /app | |
parent | 57d98b20f29650d7e8bcaa42b824ce4d794cbcbb (diff) |
Fix MP4 (H264 + AAC) video files being needlessly re-encoded (#13239)
Diffstat (limited to 'app')
-rw-r--r-- | app/models/media_attachment.rb | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/app/models/media_attachment.rb b/app/models/media_attachment.rb index 7c9b4b909..9ca0a6cda 100644 --- a/app/models/media_attachment.rb +++ b/app/models/media_attachment.rb @@ -77,6 +77,22 @@ class MediaAttachment < ApplicationRecord }, }.freeze + VIDEO_PASSTHROUGH_OPTIONS = { + video_codec_whitelist: ['h264'], + audio_codec_whitelist: ['aac', nil], + options: { + format: 'mp4', + convert_options: { + output: { + 'loglevel' => 'fatal', + 'map_metadata' => '-1', + 'c:v' => 'copy', + 'c:a' => 'copy', + }, + }, + }, + }.freeze + VIDEO_STYLES = { small: { convert_options: { @@ -91,7 +107,7 @@ class MediaAttachment < ApplicationRecord blurhash: BLURHASH_OPTIONS, }, - original: VIDEO_FORMAT, + original: VIDEO_FORMAT.merge(passthrough_options: VIDEO_PASSTHROUGH_OPTIONS), }.freeze AUDIO_STYLES = { |