0
0
Fork 0

Fix MP4 (H264 + AAC) video files being needlessly re-encoded (#13239)

This commit is contained in:
ThibG 2020-03-09 23:15:59 +01:00 committed by GitHub
parent 57d98b20f2
commit abd8394880
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 5 deletions

View file

@ -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 = {