|
|
@ -57,6 +57,26 @@ class MediaAttachment < ApplicationRecord |
|
|
|
}, |
|
|
|
}, |
|
|
|
}.freeze |
|
|
|
}.freeze |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
VIDEO_FORMAT = { |
|
|
|
|
|
|
|
format: 'mp4', |
|
|
|
|
|
|
|
content_type: 'video/mp4', |
|
|
|
|
|
|
|
convert_options: { |
|
|
|
|
|
|
|
output: { |
|
|
|
|
|
|
|
'loglevel' => 'fatal', |
|
|
|
|
|
|
|
'movflags' => 'faststart', |
|
|
|
|
|
|
|
'pix_fmt' => 'yuv420p', |
|
|
|
|
|
|
|
'vf' => 'scale=\'trunc(iw/2)*2:trunc(ih/2)*2\'', |
|
|
|
|
|
|
|
'vsync' => 'cfr', |
|
|
|
|
|
|
|
'c:v' => 'h264', |
|
|
|
|
|
|
|
'maxrate' => '1300K', |
|
|
|
|
|
|
|
'bufsize' => '1300K', |
|
|
|
|
|
|
|
'frames:v' => 60 * 60 * 3, |
|
|
|
|
|
|
|
'crf' => 18, |
|
|
|
|
|
|
|
'map_metadata' => '-1', |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}.freeze |
|
|
|
|
|
|
|
|
|
|
|
VIDEO_STYLES = { |
|
|
|
VIDEO_STYLES = { |
|
|
|
small: { |
|
|
|
small: { |
|
|
|
convert_options: { |
|
|
|
convert_options: { |
|
|
@ -71,17 +91,7 @@ class MediaAttachment < ApplicationRecord |
|
|
|
blurhash: BLURHASH_OPTIONS, |
|
|
|
blurhash: BLURHASH_OPTIONS, |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
original: { |
|
|
|
original: VIDEO_FORMAT, |
|
|
|
keep_same_format: true, |
|
|
|
|
|
|
|
convert_options: { |
|
|
|
|
|
|
|
output: { |
|
|
|
|
|
|
|
'loglevel' => 'fatal', |
|
|
|
|
|
|
|
'map_metadata' => '-1', |
|
|
|
|
|
|
|
'c:v' => 'copy', |
|
|
|
|
|
|
|
'c:a' => 'copy', |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}.freeze |
|
|
|
}.freeze |
|
|
|
|
|
|
|
|
|
|
|
AUDIO_STYLES = { |
|
|
|
AUDIO_STYLES = { |
|
|
@ -98,26 +108,6 @@ class MediaAttachment < ApplicationRecord |
|
|
|
}, |
|
|
|
}, |
|
|
|
}.freeze |
|
|
|
}.freeze |
|
|
|
|
|
|
|
|
|
|
|
VIDEO_FORMAT = { |
|
|
|
|
|
|
|
format: 'mp4', |
|
|
|
|
|
|
|
content_type: 'video/mp4', |
|
|
|
|
|
|
|
convert_options: { |
|
|
|
|
|
|
|
output: { |
|
|
|
|
|
|
|
'loglevel' => 'fatal', |
|
|
|
|
|
|
|
'movflags' => 'faststart', |
|
|
|
|
|
|
|
'pix_fmt' => 'yuv420p', |
|
|
|
|
|
|
|
'vf' => 'scale=\'trunc(iw/2)*2:trunc(ih/2)*2\'', |
|
|
|
|
|
|
|
'vsync' => 'cfr', |
|
|
|
|
|
|
|
'c:v' => 'h264', |
|
|
|
|
|
|
|
'maxrate' => '1300K', |
|
|
|
|
|
|
|
'bufsize' => '1300K', |
|
|
|
|
|
|
|
'frames:v' => 60 * 60 * 3, |
|
|
|
|
|
|
|
'crf' => 18, |
|
|
|
|
|
|
|
'map_metadata' => '-1', |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}.freeze |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
VIDEO_CONVERTED_STYLES = { |
|
|
|
VIDEO_CONVERTED_STYLES = { |
|
|
|
small: VIDEO_STYLES[:small], |
|
|
|
small: VIDEO_STYLES[:small], |
|
|
|
original: VIDEO_FORMAT, |
|
|
|
original: VIDEO_FORMAT, |
|
|
|