dvdvrconv 1.1.1 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0bf1dfd9c27d75f1664127479eaf4480b30a2a9647c0552af036b05a95fe557d
4
- data.tar.gz: 5ef2ab78adcdf97048764088ec49905d3cfac14ff7dadf1ece60c66bf54860a4
3
+ metadata.gz: 74bc4490abb3e80d289162b91a05912e2075421531f888205f10051a7930c22d
4
+ data.tar.gz: fa54458ff8f4bb490aaaaa0bb87e5690831b28ed198ef1538df385d51528323c
5
5
  SHA512:
6
- metadata.gz: 1a1de9101fb6bb101ed1190b854bde53442541a2b4eae24d4de663bc73fcf7ef3debc2c1df547d569968fcf1ba9093b1a4e23acbb5cccc52913dfe716220f953
7
- data.tar.gz: e065e1429ce5b36b30c0247ee1d56409b804f36f52255b593303389bf896da5c5093c826e3ad70ed3aedb47c95ff6587c74e00bf4e27ec3819fbc0369be0987f
6
+ metadata.gz: 94ae2207fdf720be7625ba638c2a1a800f43ece291a0129fec40acb7746c1a8619cf438909aba2c67f8d81d4cc7bbfc60071c6e075131d72c71b4b9e4ab29b38
7
+ data.tar.gz: 0fbe5892000ca58a9a977d9637cd03ad3ce6106424027c6e54397142ddf3b3ab917e5102b3ef221d5b4d1aa3c1681ad77f9ab415c688f31e05cedde5fdc99eaf
data/.gitignore CHANGED
@@ -1,13 +1,13 @@
1
- /.bundle/
2
- /.yardoc
3
- /_yardoc/
4
- /coverage/
5
- /doc/
6
- /pkg/
7
- /spec/reports/
8
- /tmp/
9
- /Gemfile.lock
10
- /.vscode/
11
- /debug.log
12
- /*.vob
13
- /*.mp4
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ /Gemfile.lock
10
+ /.vscode/
11
+ /debug.log
12
+ /*.vob
13
+ /*.mp4
data/.travis.yml CHANGED
@@ -1,6 +1,6 @@
1
- ---
2
- language: ruby
3
- cache: bundler
4
- rvm:
5
- - 2.7.1
6
- before_install: gem install bundler -v 2.1.4
1
+ ---
2
+ language: ruby
3
+ cache: bundler
4
+ rvm:
5
+ - 2.7.1
6
+ before_install: gem install bundler -v 2.1.4
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in dvdvrconv.gemspec
4
- gemspec
5
-
6
- gem 'rake', '~> 12.0'
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in dvdvrconv.gemspec
4
+ gemspec
5
+
6
+ gem 'rake', '~> 12.0'
data/LICENSE.txt CHANGED
@@ -1,21 +1,21 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2020 icm7216
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020 icm7216
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md CHANGED
@@ -6,12 +6,12 @@ dvdvrconv is also a wrapper for [pixelb/dvd-vr](https://github.com/pixelb/dvd-vr
6
6
 
7
7
  For Windows users, I attached `dvd-vr.exe` for cygwin environment.
8
8
 
9
- ## dependent libraries
9
+ # dependent libraries
10
10
 
11
11
  * [dvd-vr](https://github.com/pixelb/dvd-vr/)
12
12
  * [FFmpeg](https://www.ffmpeg.org/)
13
13
 
14
- ## Installation
14
+ # Installation
15
15
 
16
16
  Add this line to your application's Gemfile:
17
17
 
@@ -29,7 +29,7 @@ $ gem install dvdvrconv
29
29
  ```
30
30
 
31
31
 
32
- ## Usage
32
+ # Usage
33
33
 
34
34
  View video information from dvd-ram disc in dvd-vr format.
35
35
 
@@ -75,7 +75,6 @@ Execute the VRO file to mp4 conversion.
75
75
  Command options
76
76
  ```
77
77
  >dvdvrconv -h
78
- [ dvd_vr_cmd ] does not exist in default_dvdvrconv.yml file.
79
78
  Usage: dvdvrconv [options]
80
79
  -v, --version Show version
81
80
  -i, --info Show file information
@@ -83,7 +82,7 @@ Usage: dvdvrconv [options]
83
82
  -e, --exec Execute the VRO file to mp4 conversion.
84
83
  ```
85
84
 
86
- ### Configure dvdvrconv
85
+ # Configure dvdvrconv
87
86
 
88
87
  dvdvrconv reads `default_dvdvrconv.yml` in the current working directory as dvdvrconv's configuration file. It can contain the following settings:
89
88
 
@@ -94,7 +93,7 @@ dvdvrconv reads `default_dvdvrconv.yml` in the current working directory as dvdv
94
93
  * base_dst_name
95
94
  * number_list
96
95
 
97
- #### vr_mangr_ifo, vr_movie_vro
96
+ ## vr_mangr_ifo, vr_movie_vro
98
97
 
99
98
  `vr_mangr_ifo` and `vr_movie_vro` specify the path to the dvd-ram disc.
100
99
  Drive D is assumed, if different you need to write its path.
@@ -111,14 +110,14 @@ vr_mangr_ifo: "/mnt/d/DVD_RTAV/VR_MANGR.IFO"
111
110
  vr_movie_vro: "/mnt/d/DVD_RTAV/VR_MOVIE.VRO"
112
111
  ```
113
112
 
114
- #### dvd_vr_cmd
113
+ ## dvd_vr_cmd
115
114
 
116
115
  On Windows, you can use the included dvd-vr command.
117
116
 
118
117
  On WSL(ubuntu), you can use the dvd-vr command that you have compiled yourself.
119
118
  * See the section below, "install dependent libraries for WSL(ubuntu)"
120
119
 
121
- #### use_customize_title, base_dst_name, number_list
120
+ ## use_customize_title, base_dst_name, number_list
122
121
 
123
122
  customize the title name of vob files.
124
123
 
@@ -157,10 +156,31 @@ base_dst_name: []
157
156
  number_list: []
158
157
  ```
159
158
 
159
+ ## concat mode
160
160
 
161
- ## Install dependent libraries for WSL(ubuntu)
161
+ Allow users to choose to concatenate or not concatenate titles with the same name.
162
162
 
163
- ### dvd-vr
163
+ When editing a title on a dvd-vr recorder (e.g., partial cut editing.), the title is split into multiple files.
164
+
165
+ Enabling "concat_mode" allows you to concatenate multiple split files into one.
166
+
167
+ If this option is not specified, the default setting is to concatenate titles of the same name.
168
+ ```
169
+ concat_mode: true
170
+ ```
171
+
172
+ On the other hand, you may not want to concatenate multiple titles with the same name on a dvd-vr disc.
173
+ In this case, "concat_mode" can be disabled.
174
+ ```
175
+ concat_mode: false
176
+ ```
177
+
178
+
179
+
180
+
181
+ # Install dependent libraries for WSL(ubuntu)
182
+
183
+ ## dvd-vr
164
184
 
165
185
  * [pixelb/dvd-vr](https://github.com/pixelb/dvd-vr/)
166
186
 
@@ -200,15 +220,15 @@ extracted to the current directory or to stdout.
200
220
  ```
201
221
 
202
222
 
203
- ### FFmpeg
223
+ ## FFmpeg
204
224
 
205
225
  ```
206
226
  sudo apt install ffmpeg
207
227
  ```
208
228
 
209
- ## Install dependent libraries for Windows
229
+ # Install dependent libraries for Windows
210
230
 
211
- ### dvd-vr
231
+ ## dvd-vr
212
232
 
213
233
  Compile dvd-vr command in Cygwin environment.
214
234
 
@@ -260,7 +280,7 @@ After compile success, you will get the following files.
260
280
  * cygiconv-2.dll (c:\cygwin64\bin)
261
281
 
262
282
 
263
- ### FFmpeg
283
+ ## FFmpeg
264
284
 
265
285
  * [FFmpeg](https://www.ffmpeg.org/download.html)
266
286
  From the Windows EXE Files link above, select the following website.
@@ -270,7 +290,7 @@ As an example, download Auto-Build 2021-09-28 12:22.
270
290
  * [ffmpeg-N-103899-g855014ff83-win64-gpl.zip 100MB](https://github.com/BtbN/FFmpeg-Builds/releases/download/autobuild-2021-09-28-12-22/ffmpeg-N-103899-g855014ff83-win64-gpl.zip)
271
291
 
272
292
 
273
- ## Development
293
+ # Development
274
294
 
275
295
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
276
296
 
@@ -278,7 +298,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
278
298
 
279
299
 
280
300
 
281
- ## License
301
+ # License
282
302
 
283
303
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
284
304
 
data/Rakefile CHANGED
@@ -1,11 +1,11 @@
1
- require "bundler/gem_tasks"
2
- require "rake/testtask"
3
-
4
- Rake::TestTask.new(:test) do |t|
5
- t.libs << "test"
6
- t.libs << "lib"
7
- t.test_files = FileList["test/**/*_test.rb"]
8
- t.options = "-v"
9
- end
10
-
11
- task :default => :test
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList["test/**/*_test.rb"]
8
+ t.options = "-v"
9
+ end
10
+
11
+ task :default => :test
data/bin/console CHANGED
@@ -1,14 +1,14 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "dvdvrconv"
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
- require "irb"
14
- IRB.start(__FILE__)
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "dvdvrconv"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup CHANGED
@@ -1,8 +1,8 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/dvdvrconv.gemspec CHANGED
@@ -1,26 +1,26 @@
1
- require_relative "lib/dvdvrconv/version"
2
-
3
- Gem::Specification.new do |spec|
4
- spec.name = "dvdvrconv"
5
- spec.version = Dvdvrconv::VERSION
6
- spec.authors = ["icm7216"]
7
- spec.email = ["icm7216d@gmail.com"]
8
-
9
- spec.summary = %q{DVD-VR utility}
10
- spec.description = %q{This tool converts "vro" file on DVD-VR format disc to "mp4" files.}
11
- spec.homepage = "https://github.com/icm7216/dvdvrconv"
12
- spec.license = "MIT"
13
- spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
14
-
15
- # Specify which files should be added to the gem when it is released.
16
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
17
- spec.files = Dir.chdir(File.expand_path("..", __FILE__)) do
18
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
19
- end
20
- spec.bindir = "exe"
21
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
- spec.require_paths = ["lib"]
23
-
24
- spec.add_development_dependency "test-unit"
25
- spec.add_development_dependency "test-unit-rr"
26
- end
1
+ require_relative "lib/dvdvrconv/version"
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "dvdvrconv"
5
+ spec.version = Dvdvrconv::VERSION
6
+ spec.authors = ["icm7216"]
7
+ spec.email = ["icm7216d@gmail.com"]
8
+
9
+ spec.summary = %q{DVD-VR utility}
10
+ spec.description = %q{This tool converts "vro" file on DVD-VR format disc to "mp4" files.}
11
+ spec.homepage = "https://github.com/icm7216/dvdvrconv"
12
+ spec.license = "MIT"
13
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
14
+
15
+ # Specify which files should be added to the gem when it is released.
16
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
17
+ spec.files = Dir.chdir(File.expand_path("..", __FILE__)) do
18
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
19
+ end
20
+ spec.bindir = "exe"
21
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
+ spec.require_paths = ["lib"]
23
+
24
+ spec.add_development_dependency "test-unit"
25
+ spec.add_development_dependency "test-unit-rr"
26
+ end
data/exe/dvdvrconv CHANGED
@@ -1,5 +1,5 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "dvdvrconv"
4
-
5
- Dvdvrconv::Command.run(ARGV)
1
+ #!/usr/bin/env ruby
2
+
3
+ require "dvdvrconv"
4
+
5
+ Dvdvrconv::Command.run(ARGV)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dvdvrconv
2
4
  class Command
3
5
  def self.run(argv)
@@ -48,21 +50,35 @@ module Dvdvrconv
48
50
  dvd.vrdisc.cmd = @options[:dvd_vr_cmd] if @options[:dvd_vr_cmd]
49
51
  end
50
52
 
53
+ if @options[:concat_mode].nil?
54
+ dvd.vrdisc.concat_mode = Dvdvrconv::DEFAULT_CONCAT_MODE
55
+ else
56
+ dvd.vrdisc.concat_mode = @options[:concat_mode]
57
+ end
58
+
59
+ if @options[:hardware_encode].nil?
60
+ dvd.vrdisc.hardware_encode = DEFAULT_HARDWARE_ENCODE
61
+ else
62
+ dvd.vrdisc.hardware_encode = @options[:hardware_encode]
63
+ end
64
+
51
65
  # View the path of each files
52
- puts "== Use these paths =="
53
- puts " => VR_MANGR.IFO: #{dvd.vrdisc.opts_ifo}"
54
- puts " => VR_MOVIE.VRO #{dvd.vrdisc.opts_vro}"
55
- puts " => dvd-vr.exe: #{dvd.vrdisc.cmd}"
56
- puts "== Customize settings =="
66
+ puts '== Use these paths =='
67
+ puts " => VR_MANGR.IFO: #{dvd.vrdisc.opts_ifo}"
68
+ puts " => VR_MOVIE.VRO: #{dvd.vrdisc.opts_vro}"
69
+ puts " => dvd-vr.exe: #{dvd.vrdisc.cmd}"
70
+ puts '== Customize settings =='
57
71
  puts " => use_customize_title: #{@options[:use_customize_title]}"
58
- puts " => base_dst_name: #{@options[:base_dst_name]}"
59
- puts " => number_list: #{@options[:number_list]}"
60
-
72
+ puts " => base_dst_name: #{@options[:base_dst_name]}"
73
+ puts " => number_list: #{@options[:number_list]}"
74
+ puts " => concat_mode: #{@options[:concat_mode]}"
75
+ puts " => hardware_encode: #{@options[:hardware_encode]}"
76
+
61
77
  dvd.read_info
62
78
 
63
79
  dvd.view_info if options[:opt][:info] || options[:opt].empty?
64
80
  exit unless options[:opt][:exec]
65
-
81
+
66
82
  # Extract vob files
67
83
  dvd.adjust_title
68
84
  dvd.vro2vob
@@ -72,13 +88,16 @@ module Dvdvrconv
72
88
  dvd.rename_vob
73
89
 
74
90
  # Concatenate Split titles
75
- concat_list = dvd.make_concat_list
76
- dvd.concat_titles(concat_list)
91
+ if dvd.vrdisc.concat_mode == true
92
+ puts '== Concatenate Split titles =='
93
+ concat_list = dvd.make_concat_list
94
+ dvd.concat_titles(concat_list)
95
+ end
77
96
 
78
97
  # customize title of vob files
79
98
  case @options[:use_customize_title]
80
99
  when 1
81
- puts "Specify individual file names."
100
+ puts 'Specify individual file names.'
82
101
 
83
102
  if @options[:base_dst_name].class == Array
84
103
  base_dst_name = @options[:base_dst_name]
@@ -89,7 +108,7 @@ module Dvdvrconv
89
108
 
90
109
  number_list = []
91
110
  when 2
92
- puts "Add sequence number to the file name."
111
+ puts 'Add sequence number to the file name.'
93
112
 
94
113
  if @options[:base_dst_name].class == String
95
114
  base_dst_name = @options[:base_dst_name]
@@ -100,7 +119,7 @@ module Dvdvrconv
100
119
 
101
120
  number_list = []
102
121
  when 3
103
- puts "Specify sequence numbers individually."
122
+ puts 'Specify sequence numbers individually.'
104
123
 
105
124
  if @options[:base_dst_name].class == String
106
125
  base_dst_name = @options[:base_dst_name]
@@ -112,12 +131,13 @@ module Dvdvrconv
112
131
  if @options[:number_list].class == Array
113
132
  number_list = @options[:number_list]
114
133
  else
115
- puts "ERROR: number_list should be an Array."
134
+ puts 'ERROR: number_list should be an Array.'
116
135
  exit
117
136
  end
137
+
118
138
  else
119
- puts "No customize file names"
120
- base_dst_name = dvd.vrdisc.title.uniq.map { |file| file[0].gsub(/\s/, "_") }
139
+ puts 'No customize file names'
140
+ base_dst_name = dvd.vrdisc.title.uniq.map { |file| file[0].gsub(/\s/, '_') }
121
141
  number_list = []
122
142
  end
123
143
 
@@ -130,9 +150,9 @@ module Dvdvrconv
130
150
 
131
151
  # load yaml file and store in @options.
132
152
  def load_config(file)
133
- config = YAML.load(File.read(file)) || {}
153
+ config = YAML.safe_load(File.read(file)) || {}
134
154
 
135
- %w(vr_mangr_ifo vr_movie_vro dvd_vr_cmd).each do |key|
155
+ %w[vr_mangr_ifo vr_movie_vro dvd_vr_cmd].each do |key|
136
156
  @options[key.to_sym] = nil
137
157
 
138
158
  unless config.key?(key)
@@ -147,9 +167,21 @@ module Dvdvrconv
147
167
 
148
168
  end
149
169
 
150
- @options[:use_customize_title] = config["use_customize_title"] || "no"
151
- @options[:base_dst_name] = config["base_dst_name"] || []
152
- @options[:number_list] = config["number_list"] || []
170
+ @options[:use_customize_title] = config['use_customize_title'] || 'no'
171
+ @options[:base_dst_name] = config['base_dst_name'] || []
172
+ @options[:number_list] = config['number_list'] || []
173
+
174
+ if config['concat_mode'].nil?
175
+ @options[:concat_mode] = Dvdvrconv::DEFAULT_CONCAT_MODE
176
+ else
177
+ @options[:concat_mode] = config['concat_mode']
178
+ end
179
+
180
+ if config['hardware_encode'].nil?
181
+ @options[:hardware_encode] = 'normal'
182
+ else
183
+ @options[:hardware_encode] = config['hardware_encode']
184
+ end
153
185
  end
154
186
 
155
187
  def dvdpath
@@ -157,7 +189,7 @@ module Dvdvrconv
157
189
  :vr_mangr_ifo => @options[:vr_mangr_ifo],
158
190
  :vr_movie_vro => @options[:vr_movie_vro],
159
191
  :dvd_vr_cmd => @options[:dvd_vr_cmd]
160
- }
192
+ }
161
193
  end
162
194
  end
163
195
  end
@@ -1,34 +1,40 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dvdvrconv
2
4
 
3
5
  # DVD-VR disc status
4
6
  Vrdisc = Struct.new(
5
- :header, # @param [String]
6
- :num, # @param [Array<String>]
7
- :title, # @param [Array<String>]
8
- :date, # @param [Array<String>]
9
- :size, # @param [Array<String>]
10
- :opts_ifo, # @param [String]
11
- :opts_vro, # @param [String]
12
- :cmd, # @param [String]
13
- :output_title, # @param [Array<String>]
14
- :duplicate_name, # @param [Array<String>]
15
- :vob_titles, # @param [Array<String>]
16
- :default_opts_ifo,# @param [String]
17
- :default_opts_vro,# @param [String]
18
- :default_cmd, # @param [String]
7
+ :header, # @param [String]
8
+ :num, # @param [Array<String>]
9
+ :title, # @param [Array<String>]
10
+ :date, # @param [Array<String>]
11
+ :size, # @param [Array<String>]
12
+ :opts_ifo, # @param [String]
13
+ :opts_vro, # @param [String]
14
+ :cmd, # @param [String]
15
+ :output_title, # @param [Array<String>]
16
+ :duplicate_name, # @param [Array<String>]
17
+ :vob_titles, # @param [Array<String>]
18
+ :default_opts_ifo, # @param [String]
19
+ :default_opts_vro, # @param [String]
20
+ :default_cmd, # @param [String]
21
+ :concat_mode, # @param [Boolean]
22
+ :hardware_encode # @param [String]
19
23
  )
20
24
 
21
- BASE_NAME = "DVD"
22
- DEFAULT_CONFIG_FILE = "default_dvdvrconv.yml"
25
+ BASE_NAME = 'DVD'
26
+ DEFAULT_CONFIG_FILE = 'default_dvdvrconv.yml'
27
+ DEFAULT_CONCAT_MODE = true
28
+ DEFAULT_HARDWARE_ENCODE = 'normal'
23
29
 
24
30
  # Default DVD drive is "d".
25
31
  # If you want to use a different drive, you need to set up a "default_dvdvrconv.yml" file.
26
- WIN_DRV_IFO = "/cygdrive/D/DVD_RTAV/VR_MANGR.IFO"
27
- WIN_DRV_VRO = "/cygdrive/D/DVD_RTAV/VR_MOVIE.VRO"
28
- WIN_DRV_CMD = File.expand_path("../../win/dvd-vr.exe", __dir__)
29
- DRV_IFO = "/mnt/d/DVD_RTAV/VR_MANGR.IFO"
30
- DRV_VRO = "/mnt/d/DVD_RTAV/VR_MOVIE.VRO"
31
- DRV_CMD = "dvd-vr"
32
+ WIN_DRV_IFO = '/cygdrive/D/DVD_RTAV/VR_MANGR.IFO'
33
+ WIN_DRV_VRO = '/cygdrive/D/DVD_RTAV/VR_MOVIE.VRO'
34
+ WIN_DRV_CMD = File.expand_path('../../win/dvd-vr.exe', __dir__)
35
+ DRV_IFO = '/mnt/d/DVD_RTAV/VR_MANGR.IFO'
36
+ DRV_VRO = '/mnt/d/DVD_RTAV/VR_MOVIE.VRO'
37
+ DRV_CMD = 'dvd-vr'
32
38
 
33
39
  class Dvdvr
34
40
  attr_accessor :vrdisc
@@ -49,23 +55,63 @@ module Dvdvrconv
49
55
  @vrdisc.default_opts_ifo = @vrdisc.opts_ifo
50
56
  @vrdisc.default_opts_vro = @vrdisc.opts_vro
51
57
  @vrdisc.default_cmd = @vrdisc.cmd
58
+ @vrdisc.concat_mode = Dvdvrconv::DEFAULT_CONCAT_MODE
59
+ @vrdisc.hardware_encode = Dvdvrconv::DEFAULT_HARDWARE_ENCODE
52
60
  end
53
61
 
54
62
  # Read VRO file from dvd-ram disc in dvd-vr format, and output vob files.
55
63
  def str_dvdvr_cmd
56
- %Q[#{@vrdisc.cmd} --name=#{Dvdvrconv::BASE_NAME} #{@vrdisc.opts_ifo} #{@vrdisc.opts_vro}]
64
+ %(#{@vrdisc.cmd} --name=#{Dvdvrconv::BASE_NAME} #{@vrdisc.opts_ifo} #{@vrdisc.opts_vro})
57
65
  end
58
66
 
59
67
  # Make a concatenation command string for FFmpeg.
60
68
  def str_concat_cmd(file_name, base_name)
61
- %Q[ffmpeg -f concat -safe 0 -i #{file_name} -c copy #{base_name}.vob]
69
+ %(ffmpeg -f concat -safe 0 -i #{file_name} -c copy #{base_name}.vob)
62
70
  end
63
71
 
64
72
  # File convert command, vob to mp4 for FFmpeg.
65
73
  # * Change the aspect ratio to 16:9.
66
74
  # * Delete a closed caption.
75
+ def ffmeg_normal_cmd(file_name)
76
+ cmd = 'ffmpeg '
77
+ cmd += "-i #{file_name}.vob "
78
+ cmd += '-filter:v "crop=704:474:0:0" '
79
+ cmd += '-vcodec libx264 '
80
+ cmd += '-b:v 500k '
81
+ cmd += '-aspect 16:9 '
82
+ cmd += '-acodec copy '
83
+ cmd += '-bsf:v "filter_units=remove_types=6" '
84
+ cmd + "#{file_name}.mp4"
85
+ end
86
+
87
+ # File convert command, vob to mp4 for FFmpeg.
88
+ # * FFmpeg with QSV(Intel Quick Sync Video)
89
+ # * Change the aspect ratio to 16:9.
90
+ # * Delete a closed caption.
91
+ def ffmpeg_qsv_cmd(file_name)
92
+ cmd = 'ffmpeg '
93
+ cmd += '-hwaccel qsv '
94
+ cmd += '-hwaccel_output_format qsv '
95
+ cmd += "-i #{file_name}.vob "
96
+ cmd += '-filter:v "crop=704:474:0:0" '
97
+ cmd += '-c:v h264_qsv '
98
+ cmd += '-global_quality:v 35 '
99
+ cmd += '-look_ahead 1 '
100
+ cmd += '-aspect 16:9 '
101
+ cmd += '-acodec copy '
102
+ cmd += '-bsf:v "filter_units=remove_types=6" '
103
+ cmd + "#{file_name}.mp4"
104
+ end
105
+
106
+ # File convert command, vob to mp4 for FFmpeg.
67
107
  def str_convert_cmd(file_name)
68
- %Q[ffmpeg -i #{file_name}.vob -filter:v "crop=704:474:0:0" -vcodec libx264 -b:v 500k -aspect 16:9 -acodec copy -bsf:v "filter_units=remove_types=6" #{file_name}.mp4]
108
+ if @vrdisc.hardware_encode == 'qsv'
109
+ ffmpeg_qsv_cmd(file_name)
110
+ elsif @vrdisc.hardware_encode == 'normal'
111
+ ffmeg_normal_cmd(file_name)
112
+ else
113
+ ffmeg_normal_cmd(file_name)
114
+ end
69
115
  end
70
116
 
71
117
  # Read video information from dvd-ram discs in dvd-vr format.
@@ -86,7 +132,7 @@ module Dvdvrconv
86
132
  @vrdisc.header = out.scan(/^(.*?)Number/m)
87
133
 
88
134
  # Sets the captured information to @vrdisc.
89
- %w(num title date size).each do |item|
135
+ %w[num title date size].each do |item|
90
136
  str = format("%-5s", item) + ":"
91
137
  @vrdisc[item] = out.scan(/#{str}\s(.*?)$/)
92
138
  end
@@ -101,14 +147,14 @@ module Dvdvrconv
101
147
  # @vrdisc.date, @vrdisc.size
102
148
  #
103
149
  def view_info
104
- puts "----- view dvd-vr info -----"
150
+ puts '----- view dvd-vr info -----'
105
151
  puts @vrdisc.header
106
152
  [@vrdisc.num, @vrdisc.title, @vrdisc.date, @vrdisc.size].transpose.each do |x|
107
- %w(num title date size).each_with_index do |item, idx|
108
- line = format("%-5s", item) + ": #{x.flatten[idx].to_s}\n"
153
+ %w[num title date size].each_with_index do |item, idx|
154
+ line = format('%-5s', item) + ": #{x.flatten[idx].to_s}\n"
109
155
  puts line
110
156
  end
111
- puts "-"
157
+ puts '-'
112
158
  end
113
159
  end
114
160
 
@@ -137,10 +183,10 @@ module Dvdvrconv
137
183
  # Add sequential numbers to duplicate name.
138
184
  if dup.include?(@vrdisc.title[idx])
139
185
  dup_counter += 1
140
- output_title << format("%s_%02d", new_name, dup_counter)
186
+ output_title << format('%s_%02d', new_name, dup_counter)
141
187
  duplicate_names << new_name
142
188
  else
143
- output_title << format("%s", new_name)
189
+ output_title << format('%s', new_name)
144
190
  end
145
191
  dup_counter = 0 if dup_counter == @vrdisc.title.count(@vrdisc.title[idx])
146
192
  end
@@ -155,10 +201,10 @@ module Dvdvrconv
155
201
  # Read VRO file from dvd-ram disc in dvd-vr format, and output vob files.
156
202
  def vro2vob
157
203
  cmd = str_dvdvr_cmd
158
- puts "----- convert file VRO to VOB -----"
204
+ puts '----- convert file VRO to VOB -----'
159
205
  puts "> cmd:\n #{cmd}"
160
206
  system(cmd)
161
- puts ""
207
+ puts ''
162
208
  end
163
209
 
164
210
  # Change the file name to the title name
@@ -173,8 +219,8 @@ module Dvdvrconv
173
219
  vob_titles = []
174
220
 
175
221
  @vrdisc.title.size.times do |x|
176
- src = format("%s#%03d", Dvdvrconv::BASE_NAME, x + 1) + ".vob"
177
- dst = @vrdisc.output_title[x] + ".vob"
222
+ src = format('%s#%03d', Dvdvrconv::BASE_NAME, x + 1) + '.vob'
223
+ dst = @vrdisc.output_title[x] + '.vob'
178
224
  vob_titles << [src, dst]
179
225
  end
180
226
 
@@ -212,22 +258,32 @@ module Dvdvrconv
212
258
  def customize_title(base_dst_name, number_list = [])
213
259
  vob_titles = []
214
260
 
215
- base_dst_name.size.times do |x|
216
- break if x > @vrdisc.title.uniq.size - 1
217
- src = @vrdisc.title.uniq[x][0].gsub(/\s/, "_") + ".vob"
261
+ if @vrdisc.concat_mode == true
262
+ titels = @vrdisc.title.uniq.flatten
263
+ else
264
+ titels = @vrdisc.output_title
265
+ end
266
+
267
+ titels.each_with_index do |title, idx|
268
+ src = title.gsub(/\s/, '_') + '.vob'
218
269
 
219
270
  case base_dst_name
220
271
  when Array
221
- dst_name = base_dst_name[x]
272
+ dst_name = base_dst_name[idx]
222
273
  when String
223
274
  if number_list.size.zero?
224
- dst_name = base_dst_name + format("_%02d", x + 1)
275
+ dst_name = base_dst_name + format('_%02d', idx + 1)
225
276
  else
226
- dst_name = base_dst_name + format("_%02d", number_list[x])
277
+ case number_list[idx]
278
+ when Numeric
279
+ dst_name = base_dst_name + format('_%02d', number_list[idx])
280
+ when String
281
+ dst_name = base_dst_name + format('_%s', number_list[idx])
282
+ end
227
283
  end
228
284
  end
229
285
 
230
- dst = dst_name + ".vob"
286
+ dst = dst_name + '.vob'
231
287
  vob_titles << [src, dst]
232
288
  end
233
289
 
@@ -243,7 +299,7 @@ module Dvdvrconv
243
299
  # @vrdisc.vob_titles
244
300
  #
245
301
  def rename_vob
246
- puts "----- output vob file -----"
302
+ puts '----- output vob file -----'
247
303
 
248
304
  @vrdisc.vob_titles.each do |file_title|
249
305
  src, dst = file_title
@@ -266,11 +322,11 @@ module Dvdvrconv
266
322
  concat_list = []
267
323
 
268
324
  @vrdisc.duplicate_name.each do |base_name|
269
- contents = ""
325
+ contents = ''
270
326
  file_name = "concat_#{base_name}.txt"
271
327
 
272
328
  names = @vrdisc.output_title.select { |x| x.match(/#{base_name}_\d\d/) }
273
- names.each { |line| contents += %Q[file '#{line}.vob'\n] }
329
+ names.each { |line| contents += "file '#{line}.vob'\n" }
274
330
  concat_list << [file_name, contents, base_name]
275
331
  end
276
332
 
@@ -292,14 +348,14 @@ module Dvdvrconv
292
348
  # @param [String] base_name output vob name.
293
349
  #
294
350
  def concat_titles(concat_list)
295
- puts "----- Concatenate Split Titles -----"
351
+ puts '----- Concatenate Split Titles -----'
296
352
  concat_list.each do |list|
297
353
  file_name, contents, base_name = list
298
354
  File.write(file_name, contents)
299
355
  puts "concat list= #{file_name}"
300
356
 
301
357
  cmd = str_concat_cmd(file_name, base_name)
302
- puts "----- concat vob files -----"
358
+ puts '----- concat vob files -----'
303
359
  puts "run cmd:\n #{cmd}"
304
360
  system(cmd)
305
361
 
@@ -311,6 +367,14 @@ module Dvdvrconv
311
367
  end
312
368
  end
313
369
 
370
+ def vrdisc_status
371
+ puts "\n< < < < < @vrdisc status > > > > >"
372
+ %w[num title output_title duplicate_name vob_titles concat_mode hardware_encode].each do |item|
373
+ puts "#{item}=> #{@vrdisc[item]}"
374
+ end
375
+ puts "< < < < < @vrdisc status > > > > >\n"
376
+ end
377
+
314
378
  # convert vob to mp4.
315
379
  #
316
380
  # required Values:
@@ -320,7 +384,7 @@ module Dvdvrconv
320
384
  files = []
321
385
 
322
386
  @vrdisc.vob_titles.each do |vob_title|
323
- files << vob_title[1].gsub(/.vob/, "")
387
+ files << vob_title[1].gsub(/.vob/, '')
324
388
  end
325
389
 
326
390
  files.each do |file_name|
@@ -1,36 +1,38 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dvdvrconv
2
4
  module Options
3
5
  def self.parse(argv)
4
6
  options = {}
5
7
 
6
8
  parser = OptionParser.new do |o|
7
- o.on_head("-v", "--version", "Show version") do |v|
9
+ o.on_head('-v', '--version', 'Show version') do |v|
8
10
  options[:version] = v
9
11
  o.version = Dvdvrconv::VERSION
10
12
  puts o.version
11
13
  exit
12
14
  end
13
15
 
14
- o.on("-i", "--info", "Show file information") do |v|
16
+ o.on('-i', '--info', 'Show file information') do |v|
15
17
  options[:info] = v
16
18
  end
17
19
 
18
- o.on("-c", "--config=FILE", String, "Use YAML format FILE.") do |file|
20
+ o.on('-c', '--config=FILE', String, 'Use YAML format FILE.') do |file|
19
21
  options[:config_file] = file
20
22
  end
21
23
 
22
- o.on("-e", "--exec", "Execute the VRO file to mp4 conversion.") do |v|
24
+ o.on('-e', '--exec', 'Execute the VRO file to mp4 conversion.') do |v|
23
25
  options[:exec] = v
24
26
  end
25
27
  end
26
28
 
27
29
  begin
28
- remained = parser.parse!(argv)
30
+ parser.parse!(argv)
29
31
  rescue OptionParser::InvalidArgument => e
30
32
  abort e.message
31
33
  rescue OptionParser::MissingArgument => e
32
34
  case e.args
33
- when ["-c"], ["--config"]
35
+ when ['-c'], ['--config']
34
36
  # load_config(Dvdvrconv::DEFAULT_CONFIG_FILE)
35
37
  puts "The config file has not been specified.\nUse the default configuration file. (=> #{Dvdvrconv::DEFAULT_CONFIG_FILE})"
36
38
  options[:config_file] = Dvdvrconv::DEFAULT_CONFIG_FILE
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dvdvrconv
2
- VERSION = "1.1.1"
4
+ VERSION = '1.3.0'
3
5
  end
data/lib/dvdvrconv.rb CHANGED
@@ -1,8 +1,10 @@
1
- require "open3"
2
- require "optparse"
3
- require "yaml"
1
+ # frozen_string_literal: true
4
2
 
5
- require_relative "dvdvrconv/command"
6
- require_relative "dvdvrconv/options"
7
- require_relative "dvdvrconv/dvdvr"
8
- require_relative "dvdvrconv/version"
3
+ require 'open3'
4
+ require 'optparse'
5
+ require 'yaml'
6
+
7
+ require_relative 'dvdvrconv/command'
8
+ require_relative 'dvdvrconv/options'
9
+ require_relative 'dvdvrconv/dvdvr'
10
+ require_relative 'dvdvrconv/version'
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dvdvrconv
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - icm7216
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2021-10-06 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: test-unit
@@ -71,7 +70,6 @@ homepage: https://github.com/icm7216/dvdvrconv
71
70
  licenses:
72
71
  - MIT
73
72
  metadata: {}
74
- post_install_message:
75
73
  rdoc_options: []
76
74
  require_paths:
77
75
  - lib
@@ -86,8 +84,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
86
84
  - !ruby/object:Gem::Version
87
85
  version: '0'
88
86
  requirements: []
89
- rubygems_version: 3.2.17
90
- signing_key:
87
+ rubygems_version: 3.6.8
91
88
  specification_version: 4
92
89
  summary: DVD-VR utility
93
90
  test_files: []