ehbrs-tools 0.39.0 → 0.39.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +40 -39
- data/lib/ehbrs/tools/runner/music/lyrics.rb +2 -2
- data/lib/ehbrs/tools/runner/music/lyrics_book.rb +1 -1
- data/lib/ehbrs/tools/runner/videos/extract.rb +2 -2
- data/lib/ehbrs/tools/runner/videos/languages/file_runner.rb +1 -1
- data/lib/ehbrs/tools/runner/videos/languages.rb +1 -1
- data/lib/ehbrs/tools/runner/videos/probe.rb +2 -2
- data/lib/ehbrs/tools/runner/videos/unsupported.rb +7 -7
- data/lib/ehbrs/tools/version.rb +1 -1
- metadata +4 -34
- data/lib/ehbrs/videos/convert_job.rb +0 -99
- data/lib/ehbrs/videos/extract/package.rb +0 -75
- data/lib/ehbrs/videos/extract/package_file.rb +0 -53
- data/lib/ehbrs/videos/extract.rb +0 -11
- data/lib/ehbrs/videos/file.rb +0 -67
- data/lib/ehbrs/videos/profiles/base.rb +0 -35
- data/lib/ehbrs/videos/profiles/same_quality.rb +0 -21
- data/lib/ehbrs/videos/track.rb +0 -20
- data/lib/ehbrs/videos/unsupported/check_result.rb +0 -24
- data/lib/ehbrs/videos/unsupported/check_set.rb +0 -43
- data/lib/ehbrs/videos/unsupported/check_support.rb +0 -71
- data/lib/ehbrs/videos/unsupported/checks/codec_extra_unlisted.rb +0 -29
- data/lib/ehbrs/videos/unsupported/checks/codec_extra_unsupported.rb +0 -28
- data/lib/ehbrs/videos/unsupported/checks/codec_unlisted.rb +0 -25
- data/lib/ehbrs/videos/unsupported/checks/codec_unsupported.rb +0 -27
- data/lib/ehbrs/videos/unsupported/checks/invalid_extension.rb +0 -27
- data/lib/ehbrs/videos/unsupported/checks.rb +0 -13
- data/lib/ehbrs/videos/unsupported/file/fix.rb +0 -45
- data/lib/ehbrs/videos/unsupported/file.rb +0 -50
- data/lib/ehbrs/videos/unsupported/fix_profile.rb +0 -44
- data/lib/ehbrs/videos/unsupported/fixes/supported_codec.rb +0 -36
- data/lib/ehbrs/videos/unsupported/fixes/supported_container.rb +0 -17
- data/lib/ehbrs/videos/unsupported/profiles/aoc.rb +0 -27
- data/lib/ehbrs/videos/unsupported/profiles/base.rb +0 -116
- data/lib/ehbrs/videos/unsupported/profiles/philco.rb +0 -28
- data/lib/ehbrs/videos/unsupported/profiles/samsung.rb +0 -33
- data/lib/ehbrs/videos/unsupported/profiles.rb +0 -13
- data/lib/ehbrs/videos/unsupported/search.rb +0 -75
- data/lib/ehbrs/videos/unsupported/track.rb +0 -32
- data/lib/ehbrs/videos.rb +0 -9
data/lib/ehbrs/videos/file.rb
DELETED
@@ -1,67 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'eac_ruby_utils/core_ext'
|
4
|
-
require 'ehbrs/videos/track'
|
5
|
-
require 'ehbrs_ruby_utils/executables'
|
6
|
-
require 'ehbrs_ruby_utils/videos/container'
|
7
|
-
|
8
|
-
module Ehbrs
|
9
|
-
module Videos
|
10
|
-
class File < ::EhbrsRubyUtils::Videos::Container
|
11
|
-
enable_simple_cache
|
12
|
-
|
13
|
-
TIME_PATTERN = /(\d+):(\d{2}):(\d{2})(?:\.(\d+))/.freeze
|
14
|
-
|
15
|
-
class << self
|
16
|
-
def seconds_to_time(seconds)
|
17
|
-
t = seconds.floor
|
18
|
-
hmsf_to_time((t / 3600), ((t / 60) % 60), (t % 60), (seconds - t).round(3))
|
19
|
-
end
|
20
|
-
|
21
|
-
def time_to_seconds(time)
|
22
|
-
m = TIME_PATTERN.match(time)
|
23
|
-
raise "Time pattern not find in \"#{time}\"" unless m
|
24
|
-
|
25
|
-
hmsf_to_seconds(m[1], m[2], m[3], m[4])
|
26
|
-
end
|
27
|
-
|
28
|
-
private
|
29
|
-
|
30
|
-
def hmsf_to_time(hour, minute, second, float_part)
|
31
|
-
r = [hour, minute, second].map { |y| y.to_s.rjust(2, '0') }
|
32
|
-
r += float_part > 0.0 ? ".#{float_part.to_s.gsub(/\A(0|[^\d])+/, '')}" : '.0'
|
33
|
-
r
|
34
|
-
end
|
35
|
-
|
36
|
-
def hmsf_to_seconds(hour, minute, second, float_part)
|
37
|
-
r = (hour.to_f * 3600) + (minute.to_f * 60) + second.to_f
|
38
|
-
r += float_part.to_f / (10**float_part.length) if float_part
|
39
|
-
r
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
private
|
44
|
-
|
45
|
-
def tracks_uncached
|
46
|
-
streams.map { |stream| ::Ehbrs::Videos::Track.new(stream) }.reject do |t|
|
47
|
-
t.codec_type == ::EhbrsRubyUtils::Videos::Stream::CODEC_TYPE_DATA
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
def content_uncached
|
52
|
-
::EhbrsRubyUtils::Executables.ffprobe.command(path).execute!(output: :stderr).scrub
|
53
|
-
end
|
54
|
-
|
55
|
-
def duration_uncached
|
56
|
-
m = /Duration:\s*(#{TIME_PATTERN})/.match(content)
|
57
|
-
raise 'Duration pattern not find in content' unless m
|
58
|
-
|
59
|
-
self.class.time_to_seconds(m[1])
|
60
|
-
end
|
61
|
-
|
62
|
-
def duration_s_uncached
|
63
|
-
self.class.seconds_to_time(duration)
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Ehbrs
|
4
|
-
module Videos
|
5
|
-
module Profiles
|
6
|
-
module Base
|
7
|
-
extend ::ActiveSupport::Concern
|
8
|
-
|
9
|
-
attr_reader :convert_job
|
10
|
-
|
11
|
-
included do
|
12
|
-
include ActiveSupport::Callbacks
|
13
|
-
define_callbacks :convert, :swap
|
14
|
-
end
|
15
|
-
|
16
|
-
def ffmpeg_args
|
17
|
-
[]
|
18
|
-
end
|
19
|
-
|
20
|
-
def on_convert_job
|
21
|
-
old_value = convert_job
|
22
|
-
begin
|
23
|
-
yield
|
24
|
-
ensure
|
25
|
-
self.convert_job = old_value
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
private
|
30
|
-
|
31
|
-
attr_writer :convert_job
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'ehbrs/videos/profiles/base'
|
4
|
-
|
5
|
-
module Ehbrs
|
6
|
-
module Videos
|
7
|
-
module Profiles
|
8
|
-
module SameQuality
|
9
|
-
extend ::ActiveSupport::Concern
|
10
|
-
|
11
|
-
included do
|
12
|
-
include ::Ehbrs::Videos::Profiles::Base
|
13
|
-
end
|
14
|
-
|
15
|
-
def ffmpeg_args
|
16
|
-
super + ['-q:a', '0', '-q:v', '0']
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
data/lib/ehbrs/videos/track.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'eac_ruby_utils/core_ext'
|
4
|
-
require 'ehbrs_ruby_utils/videos/stream'
|
5
|
-
|
6
|
-
module Ehbrs
|
7
|
-
module Videos
|
8
|
-
class Track < ::SimpleDelegator
|
9
|
-
def extra
|
10
|
-
ffprobe_data.fetch(:codec_tag_string).to_s
|
11
|
-
end
|
12
|
-
|
13
|
-
def to_s
|
14
|
-
"[#{codec_type}(#{index}): #{codec_name}/#{language || '-'}#{extra.if_present('') do |v|
|
15
|
-
" | #{v}"
|
16
|
-
end}]"
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
@@ -1,24 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'eac_ruby_utils/core_ext'
|
4
|
-
|
5
|
-
module Ehbrs
|
6
|
-
module Videos
|
7
|
-
module Unsupported
|
8
|
-
class CheckResult
|
9
|
-
enable_simple_cache
|
10
|
-
common_constructor :source, :check
|
11
|
-
|
12
|
-
def passed?
|
13
|
-
message.blank?
|
14
|
-
end
|
15
|
-
|
16
|
-
private
|
17
|
-
|
18
|
-
def message_uncached
|
19
|
-
check.check(source)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
@@ -1,43 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'ehbrs/videos/unsupported/checks'
|
4
|
-
|
5
|
-
module Ehbrs
|
6
|
-
module Videos
|
7
|
-
module Unsupported
|
8
|
-
class CheckSet
|
9
|
-
enable_simple_cache
|
10
|
-
common_constructor :checks
|
11
|
-
|
12
|
-
class << self
|
13
|
-
# type: "file" or "track"
|
14
|
-
def build(profiles, type)
|
15
|
-
r = {}
|
16
|
-
profiles.each do |profile|
|
17
|
-
profile.send("#{type}_checks").each do |check|
|
18
|
-
r[check] ||= CheckWithProfiles.new(check)
|
19
|
-
r[check].add_profile(profile)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
new(r.values)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
class CheckWithProfiles < ::SimpleDelegator
|
27
|
-
def initialize(check)
|
28
|
-
super(check)
|
29
|
-
@profiles = []
|
30
|
-
end
|
31
|
-
|
32
|
-
def check_name
|
33
|
-
__getobj__.class.name.demodulize
|
34
|
-
end
|
35
|
-
|
36
|
-
def add_profile(profile)
|
37
|
-
@profiles << profile
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
@@ -1,71 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'eac_ruby_utils/core_ext'
|
4
|
-
require 'ehbrs/videos/unsupported/check_result'
|
5
|
-
|
6
|
-
module Ehbrs
|
7
|
-
module Videos
|
8
|
-
module Unsupported
|
9
|
-
module CheckSupport
|
10
|
-
common_concern do
|
11
|
-
enable_simple_cache
|
12
|
-
enable_speaker
|
13
|
-
end
|
14
|
-
|
15
|
-
def aggressions_banner(title)
|
16
|
-
return if passed?
|
17
|
-
|
18
|
-
info title
|
19
|
-
pad_speaker do
|
20
|
-
unpassed_checks.each do |u|
|
21
|
-
info "* #{u.message}"
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
def ffmpeg_fix_args
|
27
|
-
unpassed_checks.flat_map do |check|
|
28
|
-
check.check.fix.if_present([]) { |v| v.ffmpeg_args(self) }
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
def passed?
|
33
|
-
unpassed_checks.none?
|
34
|
-
end
|
35
|
-
|
36
|
-
private
|
37
|
-
|
38
|
-
def unpassed_checks_uncached
|
39
|
-
checks.reject(&:passed?)
|
40
|
-
end
|
41
|
-
|
42
|
-
def checks_uncached
|
43
|
-
options.fetch(check_set_key).checks.map do |check|
|
44
|
-
::Ehbrs::Videos::Unsupported::CheckResult.new(self, check)
|
45
|
-
end
|
46
|
-
rescue StandardError => e
|
47
|
-
raise "#{e.message} (Source: #{self})"
|
48
|
-
end
|
49
|
-
|
50
|
-
def fix_blocks_uncached
|
51
|
-
checks.reject(&:passed?).select { |c| c.check.fix.blank? }
|
52
|
-
end
|
53
|
-
|
54
|
-
def fixes_uncached
|
55
|
-
checks.reject(&:passed?).map { |c| c.check.fix }.compact_blank
|
56
|
-
end
|
57
|
-
|
58
|
-
def pad_speaker(&block)
|
59
|
-
::EacRubyUtils::Speaker.context.on(::EacCli::Speaker.new(err_line_prefix: ' '), &block)
|
60
|
-
end
|
61
|
-
|
62
|
-
def new_padded_cli_speaker
|
63
|
-
::EacCli::Speaker.new(
|
64
|
-
err_line_prefix("#{::EacRubyUtils::Speaker.context.optional_current
|
65
|
-
.if_present('') { |v| v.is_a?(::EacCli::Speaker) ? v.err_line_prefix : '' }} ")
|
66
|
-
)
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Ehbrs
|
4
|
-
module Videos
|
5
|
-
module Unsupported
|
6
|
-
module Checks
|
7
|
-
class CodecExtraUnlisted
|
8
|
-
TYPE = :stream
|
9
|
-
|
10
|
-
common_constructor :codec, :listed_extras
|
11
|
-
|
12
|
-
def check(track)
|
13
|
-
return nil unless track.codec_name == codec
|
14
|
-
return nil if listed_extras.any? do |extra|
|
15
|
-
track.extra.downcase.include?(extra.downcase)
|
16
|
-
end
|
17
|
-
|
18
|
-
"Not listed extra for codec \"#{codec}\" (Track: #{track}" \
|
19
|
-
", listed extra: #{listed_extras})"
|
20
|
-
end
|
21
|
-
|
22
|
-
def fix
|
23
|
-
nil
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'ehbrs/videos/unsupported/fixes/supported_codec'
|
4
|
-
|
5
|
-
module Ehbrs
|
6
|
-
module Videos
|
7
|
-
module Unsupported
|
8
|
-
module Checks
|
9
|
-
class CodecExtraUnsupported
|
10
|
-
TYPE = :stream
|
11
|
-
|
12
|
-
common_constructor :codec, :extra
|
13
|
-
|
14
|
-
def check(track)
|
15
|
-
return nil unless track.codec_name == codec
|
16
|
-
return nil unless track.extra.downcase.include?(extra.downcase)
|
17
|
-
|
18
|
-
"Unsupported extra \"#{extra}\" for codec \"#{codec}\" and track #{track}"
|
19
|
-
end
|
20
|
-
|
21
|
-
def fix
|
22
|
-
::Ehbrs::Videos::Unsupported::Fixes::SupportedCodec.new
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Ehbrs
|
4
|
-
module Videos
|
5
|
-
module Unsupported
|
6
|
-
module Checks
|
7
|
-
class CodecUnlisted
|
8
|
-
TYPE = :stream
|
9
|
-
|
10
|
-
common_constructor :listed_codecs
|
11
|
-
|
12
|
-
def check(track)
|
13
|
-
return nil if listed_codecs.include?(track.codec_name)
|
14
|
-
|
15
|
-
"Not listed codec \"#{track.codec_name}\" (Track: #{track}, listed: #{listed_codecs})"
|
16
|
-
end
|
17
|
-
|
18
|
-
def fix
|
19
|
-
nil
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'ehbrs/videos/unsupported/fixes/supported_codec'
|
4
|
-
|
5
|
-
module Ehbrs
|
6
|
-
module Videos
|
7
|
-
module Unsupported
|
8
|
-
module Checks
|
9
|
-
class CodecUnsupported
|
10
|
-
TYPE = :stream
|
11
|
-
|
12
|
-
common_constructor :codec
|
13
|
-
|
14
|
-
def check(track)
|
15
|
-
return nil unless track.codec_name == codec
|
16
|
-
|
17
|
-
"Unsupported codec \"#{codec}\" for track #{track}"
|
18
|
-
end
|
19
|
-
|
20
|
-
def fix
|
21
|
-
::Ehbrs::Videos::Unsupported::Fixes::SupportedCodec.new
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'ehbrs/videos/unsupported/fixes/supported_container'
|
4
|
-
|
5
|
-
module Ehbrs
|
6
|
-
module Videos
|
7
|
-
module Unsupported
|
8
|
-
module Checks
|
9
|
-
class InvalidExtension
|
10
|
-
TYPE = :container
|
11
|
-
|
12
|
-
common_constructor :extension
|
13
|
-
|
14
|
-
def check(video)
|
15
|
-
return nil unless ::File.extname(video.path) == extension
|
16
|
-
|
17
|
-
"File has invalid extension: #{extension}"
|
18
|
-
end
|
19
|
-
|
20
|
-
def fix
|
21
|
-
::Ehbrs::Videos::Unsupported::Fixes::SupportedContainer.new
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
@@ -1,45 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'ehbrs/videos/convert_job'
|
4
|
-
require 'ehbrs/videos/file'
|
5
|
-
require 'ehbrs/videos/unsupported/fix_profile'
|
6
|
-
|
7
|
-
module Ehbrs
|
8
|
-
module Videos
|
9
|
-
module Unsupported
|
10
|
-
class File < ::Ehbrs::Videos::File
|
11
|
-
module Fix
|
12
|
-
def check_fix
|
13
|
-
return unless options.fetch(:fix)
|
14
|
-
|
15
|
-
if fix_blocks.any?
|
16
|
-
infom ' * Cannot fix:'
|
17
|
-
fix_blocks.each do |fb|
|
18
|
-
infom " * #{fb.check.check_name}"
|
19
|
-
end
|
20
|
-
else
|
21
|
-
infom ' * Fixing...'
|
22
|
-
infom " * Fixed in: \"#{fix}\""
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
private
|
27
|
-
|
28
|
-
def all_fix_blocks_uncached
|
29
|
-
fix_blocks + tracks.flat_map(&:fix_blocks)
|
30
|
-
end
|
31
|
-
|
32
|
-
def fix_profile_uncached
|
33
|
-
::Ehbrs::Videos::Unsupported::FixProfile.new(self)
|
34
|
-
end
|
35
|
-
|
36
|
-
def fix
|
37
|
-
job = ::Ehbrs::Videos::ConvertJob.new(path, fix_profile)
|
38
|
-
job.run
|
39
|
-
job.target
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
@@ -1,50 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'ehbrs/videos/file'
|
4
|
-
require 'ehbrs/videos/unsupported/file/fix'
|
5
|
-
require 'ehbrs/videos/unsupported/check_support'
|
6
|
-
require 'ehbrs/videos/unsupported/track'
|
7
|
-
|
8
|
-
module Ehbrs
|
9
|
-
module Videos
|
10
|
-
module Unsupported
|
11
|
-
class File < ::Ehbrs::Videos::File
|
12
|
-
include ::Ehbrs::Videos::Unsupported::CheckSupport
|
13
|
-
include ::Ehbrs::Videos::Unsupported::File::Fix
|
14
|
-
|
15
|
-
attr_reader :options
|
16
|
-
|
17
|
-
def initialize(file, options)
|
18
|
-
super file
|
19
|
-
@options = options
|
20
|
-
end
|
21
|
-
|
22
|
-
def banner
|
23
|
-
infov 'File', path
|
24
|
-
pad_speaker do
|
25
|
-
aggressions_banner('Self')
|
26
|
-
tracks.each(&:banner)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
def all_passed?
|
31
|
-
passed? && tracks.all?(&:passed?)
|
32
|
-
end
|
33
|
-
|
34
|
-
def all_fixes
|
35
|
-
fixes + tracks.flat_map(&:fixes)
|
36
|
-
end
|
37
|
-
|
38
|
-
def check_set_key
|
39
|
-
:file_check_set
|
40
|
-
end
|
41
|
-
|
42
|
-
private
|
43
|
-
|
44
|
-
def tracks_uncached
|
45
|
-
super.map { |t| ::Ehbrs::Videos::Unsupported::Track.new(self, t) }
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
@@ -1,44 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'ehbrs/videos/profiles/same_quality'
|
4
|
-
require 'ehbrs/videos/unsupported/fixes/supported_container'
|
5
|
-
|
6
|
-
module Ehbrs
|
7
|
-
module Videos
|
8
|
-
module Unsupported
|
9
|
-
class FixProfile
|
10
|
-
include ::Ehbrs::Videos::Profiles::SameQuality
|
11
|
-
|
12
|
-
common_constructor :video
|
13
|
-
set_callback :swap, :after do
|
14
|
-
video.all_fixes.each do |fix|
|
15
|
-
next unless fix.respond_to?(:after_swap)
|
16
|
-
|
17
|
-
fix.after_swap(self)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
def name
|
22
|
-
"fix_for_#{::File.basename(video.file)}"
|
23
|
-
end
|
24
|
-
|
25
|
-
def ffmpeg_args
|
26
|
-
r = fix_args
|
27
|
-
r += container_fix_args unless r.include?('-f')
|
28
|
-
r + super
|
29
|
-
end
|
30
|
-
|
31
|
-
private
|
32
|
-
|
33
|
-
def fix_args
|
34
|
-
['-c', 'copy'] + video.ffmpeg_fix_args +
|
35
|
-
video.tracks.flat_map(&:ffmpeg_fix_args)
|
36
|
-
end
|
37
|
-
|
38
|
-
def container_fix_args
|
39
|
-
['-f', ::Ehbrs::Videos::Unsupported::Fixes::SupportedContainer::FIX_FORMAT]
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
@@ -1,36 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Ehbrs
|
4
|
-
module Videos
|
5
|
-
module Unsupported
|
6
|
-
module Fixes
|
7
|
-
class SupportedCodec
|
8
|
-
TRACK_TYPE_OPTIONS = {
|
9
|
-
audio: '-acodec',
|
10
|
-
video: '-vcodec',
|
11
|
-
subtitle: '-scodec'
|
12
|
-
}.freeze
|
13
|
-
|
14
|
-
TRACK_TYPE_FIX_CODECS = {
|
15
|
-
audio: 'aac',
|
16
|
-
video: 'libx264',
|
17
|
-
subtitle: 'ass'
|
18
|
-
}.freeze
|
19
|
-
|
20
|
-
def ffmpeg_args(track)
|
21
|
-
["#{track_codec_option_by_type(track.codec_type)}:#{track.index}",
|
22
|
-
track_codec_fix_by_type(track.codec_type)]
|
23
|
-
end
|
24
|
-
|
25
|
-
def track_codec_option_by_type(track_type)
|
26
|
-
TRACK_TYPE_OPTIONS.fetch(track_type.to_s.underscore.to_sym)
|
27
|
-
end
|
28
|
-
|
29
|
-
def track_codec_fix_by_type(track_type)
|
30
|
-
TRACK_TYPE_FIX_CODECS.fetch(track_type.to_s.underscore.to_sym)
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'ehbrs/videos/unsupported/profiles/base'
|
4
|
-
|
5
|
-
module Ehbrs
|
6
|
-
module Videos
|
7
|
-
module Unsupported
|
8
|
-
module Profiles
|
9
|
-
class Aoc < ::Ehbrs::Videos::Unsupported::Profiles::Base
|
10
|
-
AUDIO_SUPPORTED_CODECS = %w[aac ac3 mp2 mp3].freeze
|
11
|
-
AUDIO_UNSUPPORTED_CODECS = %w[eac3 vorbis].freeze
|
12
|
-
|
13
|
-
VIDEO_SUPPORTED_CODECS = %w[h264 mpeg4].freeze
|
14
|
-
VIDEO_UNSUPPORTED_CODECS = %w[hevc].freeze
|
15
|
-
|
16
|
-
SUBTITLE_SUPPORTED_CODECS = %w[ass dvd_subtitle hdmv_pgs_subtitle subrip].freeze
|
17
|
-
SUBTITLE_UNSUPPORTED_CODECS = %w[mov_text].freeze
|
18
|
-
|
19
|
-
OTHER_SUPPORTED_CODECS = %w[].freeze
|
20
|
-
|
21
|
-
MPEG4_EXTRA_SUPPORTED = %w[xvid].freeze
|
22
|
-
MPEG4_EXTRA_UNSUPPORTED = %w[].freeze
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|