dvdvrconv 1.3.1 → 1.3.3

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: c05c88e2cd69df800f143dc2a9754a4f9b04ee5c64756fff8ed09faad6e2fc4f
4
- data.tar.gz: d189810613ef0a7ff5b7e243fd0a10d258bce0486a82f81d83a68f2661ea777d
3
+ metadata.gz: caab8f34b81f4361edbdb9cb50ef5215f3809efc46de355af8dda0aa0b58538a
4
+ data.tar.gz: 781cd817f0f4e0852d555b3fc368e08bb008ccf89ccb379b6db2654fa37127e4
5
5
  SHA512:
6
- metadata.gz: b2e0fb30eb6087997fc6faaf09c4ef6e5b7917cddbe4a9ea926adcf8d6c58b68029243bca095a3929cb56eb95cb98585b35eb9222693e3368e5e333e0c37e7fe
7
- data.tar.gz: c0a664e7eb8a6689f6030a10a46de495c8da114c50beabbab085d3fa7d08d980048a11fe3d81410151e3fff91eff460a27d097b4cb64d0ad4bfb2a7c612addfb
6
+ metadata.gz: 8681b1d376df42b185f0b7c550cbada833ca920fa62e380290fdc74522f5fd2b9c6154b9f5a7ab0cea2126381eb4f8cad41378fec72606a3894142b82b0037e3
7
+ data.tar.gz: efacfa73e7ccc4c7a80d365165dee9ac6882a410a2987dca79482f0deb202d447ab8f713b122d45e7b843abb55e1e16e5c04cfaa4e47fd113240de3248a28d6b
data/README.md CHANGED
@@ -92,6 +92,9 @@ dvdvrconv reads `default_dvdvrconv.yml` in the current working directory as dvdv
92
92
  * use_customize_title
93
93
  * base_dst_name
94
94
  * number_list
95
+ * hardware_encode
96
+ * global_quality
97
+ * h264_crf
95
98
 
96
99
  ## vr_mangr_ifo, vr_movie_vro
97
100
 
@@ -175,7 +178,37 @@ In this case, "concat_mode" can be disabled.
175
178
  concat_mode: false
176
179
  ```
177
180
 
181
+ ## hardware_encode
178
182
 
183
+ FFmpeg encode option. You can select the encoding mode from 'normal' or 'qsv'.
184
+
185
+ if you want to use a software encoder (default)
186
+ ```
187
+ hardware_encode: 'normal'
188
+ ```
189
+
190
+ If you want to use a hardware encoder(intel QSV LA_ICQ)
191
+ ```
192
+ hardware_encode: 'qsv'
193
+ ```
194
+
195
+ ## global_quality
196
+
197
+ FFmpeg hardware encode(QSV) option:
198
+
199
+ if you want to set Global Quality (default 25)
200
+ ```
201
+ global_quality: 28
202
+ ```
203
+
204
+ ## h264_crf
205
+
206
+ FFmpeg software encode option:
207
+
208
+ if you want to set h264 Constant Rate Factor (default 25)
209
+ ```
210
+ h264_crf: 28
211
+ ```
179
212
 
180
213
 
181
214
  # Install dependent libraries for WSL(ubuntu)
@@ -285,6 +318,7 @@ After compile success, you will get the following files.
285
318
  * [FFmpeg](https://www.ffmpeg.org/download.html)
286
319
  From the Windows EXE Files link above, select the following website.
287
320
  * [Releases · BtbN/FFmpeg-Builds](https://github.com/BtbN/FFmpeg-Builds/releases) (daily auto-build).
321
+ * [Releases · GyanD/codexffmpeg](https://github.com/GyanD/codexffmpeg/releases)
288
322
 
289
323
  As an example, download Auto-Build 2021-09-28 12:22.
290
324
  * [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)
@@ -68,6 +68,12 @@ module Dvdvrconv
68
68
  dvd.vrdisc.global_quality = @options[:global_quality]
69
69
  end
70
70
 
71
+ if @options[:h264_crf].nil?
72
+ dvd.vrdisc.h264_crf = Dvdvrconv::DEFAULT_H264_CRF
73
+ else
74
+ dvd.vrdisc.h264_crf = @options[:h264_crf]
75
+ end
76
+
71
77
  # View the path of each files
72
78
  puts '== Use these paths =='
73
79
  puts " => VR_MANGR.IFO: #{dvd.vrdisc.opts_ifo}"
@@ -80,6 +86,7 @@ module Dvdvrconv
80
86
  puts " => concat_mode: #{@options[:concat_mode]}"
81
87
  puts " => hardware_encode: #{@options[:hardware_encode]}"
82
88
  puts " => global_quality: #{@options[:global_quality]}"
89
+ puts " => h264_crf: #{@options[:h264_crf]}"
83
90
 
84
91
  dvd.read_info
85
92
 
@@ -195,6 +202,12 @@ module Dvdvrconv
195
202
  else
196
203
  @options[:global_quality] = config['global_quality']
197
204
  end
205
+
206
+ if config['h264_crf'].nil?
207
+ @options[:h264_crf] = Dvdvrconv::DEFAULT_H264_CRF
208
+ else
209
+ @options[:h264_crf] = config['h264_crf']
210
+ end
198
211
  end
199
212
 
200
213
  def dvdpath
@@ -20,7 +20,8 @@ module Dvdvrconv
20
20
  :default_cmd, # @param [String]
21
21
  :concat_mode, # @param [Boolean]
22
22
  :hardware_encode, # @param [String]
23
- :global_quality # @param [Integer]
23
+ :global_quality, # @param [Integer]
24
+ :h264_crf, # @param [Integer]
24
25
  )
25
26
 
26
27
  BASE_NAME = 'DVD'
@@ -28,6 +29,8 @@ module Dvdvrconv
28
29
  DEFAULT_CONCAT_MODE = true
29
30
  DEFAULT_HARDWARE_ENCODE = 'normal'
30
31
  DEFAULT_GLOBAL_QUALITY = 25
32
+ DEFAULT_H264_CRF = 25
33
+
31
34
 
32
35
  # Default DVD drive is "d".
33
36
  # If you want to use a different drive, you need to set up a "default_dvdvrconv.yml" file.
@@ -60,50 +63,39 @@ module Dvdvrconv
60
63
  @vrdisc.concat_mode = Dvdvrconv::DEFAULT_CONCAT_MODE
61
64
  @vrdisc.hardware_encode = Dvdvrconv::DEFAULT_HARDWARE_ENCODE
62
65
  @vrdisc.global_quality = Dvdvrconv::DEFAULT_GLOBAL_QUALITY
66
+ @vrdisc.h264_crf = Dvdvrconv::DEFAULT_H264_CRF
63
67
  end
64
68
 
65
69
  # Read VRO file from dvd-ram disc in dvd-vr format, and output vob files.
66
70
  def str_dvdvr_cmd
67
- %(#{@vrdisc.cmd} --name=#{Dvdvrconv::BASE_NAME} #{@vrdisc.opts_ifo} #{@vrdisc.opts_vro})
71
+ Shellwords.shellsplit(%("#{@vrdisc.cmd}" --name="#{Dvdvrconv::BASE_NAME}" "#{@vrdisc.opts_ifo}" "#{@vrdisc.opts_vro}"))
68
72
  end
69
73
 
70
74
  # Make a concatenation command string for FFmpeg.
71
75
  def str_concat_cmd(file_name, base_name)
72
- %(ffmpeg -f concat -safe 0 -i #{file_name} -c copy #{base_name}.vob)
76
+ Shellwords.shellsplit(%(ffmpeg -f concat -safe 0 -i "#{file_name}" -c copy "#{base_name}.vob"))
73
77
  end
74
78
 
75
79
  # File convert command, vob to mp4 for FFmpeg.
76
80
  # * Change the aspect ratio to 16:9.
77
81
  # * Delete a closed caption.
82
+ # * Use deinterlace (bwdif)
83
+ # * Use Constant Rate Factor mode insted of CBR mode
84
+ # * Use analyze and probe option
78
85
  def ffmeg_normal_cmd(file_name)
79
- cmd = 'ffmpeg '
80
- cmd += "-i #{file_name}.vob "
81
- cmd += '-filter:v "crop=704:474:0:0" '
82
- cmd += '-vcodec libx264 '
83
- cmd += '-b:v 500k '
84
- cmd += '-aspect 16:9 '
85
- cmd += '-acodec copy '
86
- cmd += '-bsf:v "filter_units=remove_types=6" '
87
- cmd + "#{file_name}.mp4"
86
+ Shellwords.shellsplit(%(ffmpeg -analyzeduration 2000M -probesize 2G -i "#{file_name}.vob" -vf "bwdif=0:-1:0,crop=704:474:0:0,scale=704:480,setdar=16/9" -c:v libx264 -crf "#{@vrdisc.h264_crf}" -preset medium -bsf:v "filter_units=remove_types=6" -map 0:v:0 -map 0:a:0 -c:a copy "#{file_name}.mp4"))
88
87
  end
89
88
 
90
89
  # File convert command, vob to mp4 for FFmpeg.
91
90
  # * FFmpeg with QSV(Intel Quick Sync Video)
92
91
  # * Change the aspect ratio to 16:9.
93
92
  # * Delete a closed caption.
93
+ # * Support for FFmpeg 8
94
+ # * Software decode, cropp and deinterlace + h264 qsv(LA_ICQ) encode
95
+ # * Use ICQ Look_ahead mode
96
+ # * Use analyze and probe option
94
97
  def ffmpeg_qsv_cmd(file_name)
95
- cmd = 'ffmpeg '
96
- cmd += '-hwaccel qsv '
97
- cmd += '-hwaccel_output_format qsv '
98
- cmd += "-i #{file_name}.vob "
99
- cmd += '-filter:v "crop=704:474:0:0" '
100
- cmd += '-c:v h264_qsv '
101
- cmd += "-global_quality #{@vrdisc.global_quality} "
102
- cmd += '-look_ahead 1 '
103
- cmd += '-aspect 16:9 '
104
- cmd += '-acodec copy '
105
- cmd += '-bsf:v "filter_units=remove_types=6" '
106
- cmd + "#{file_name}.mp4"
98
+ Shellwords.shellsplit(%(ffmpeg -analyzeduration 2000M -probesize 2G -i "#{file_name}.vob" -vf "bwdif=0:-1:0,crop=704:474:0:0,scale=704:480,setdar=16/9" -c:v h264_qsv -global_quality "#{@vrdisc.global_quality}" -look_ahead 1 -look_ahead_depth 30 -aspect 16:9 -bsf:v "filter_units=remove_types=6" -map 0:v:0 -map 0:a:0 -c:a copy "#{file_name}.mp4"))
107
99
  end
108
100
 
109
101
  # File convert command, vob to mp4 for FFmpeg.
@@ -205,8 +197,8 @@ module Dvdvrconv
205
197
  def vro2vob
206
198
  cmd = str_dvdvr_cmd
207
199
  puts '----- convert file VRO to VOB -----'
208
- puts "> cmd:\n #{cmd}"
209
- system(cmd)
200
+ puts "> cmd:\n #{cmd.join(' ')}"
201
+ system(*cmd)
210
202
  puts ''
211
203
  end
212
204
 
@@ -329,7 +321,10 @@ module Dvdvrconv
329
321
  file_name = "concat_#{base_name}.txt"
330
322
 
331
323
  names = @vrdisc.output_title.select { |x| x.match(/#{base_name}_\d\d/) }
332
- names.each { |line| contents += "file '#{line}.vob'\n" }
324
+ names.each do |line|
325
+ escaped_line = "#{line}.vob".gsub("'") {"'\\''"}
326
+ contents += "file '#{escaped_line}'\n"
327
+ end
333
328
  concat_list << [file_name, contents, base_name]
334
329
  end
335
330
 
@@ -359,8 +354,8 @@ module Dvdvrconv
359
354
 
360
355
  cmd = str_concat_cmd(file_name, base_name)
361
356
  puts '----- concat vob files -----'
362
- puts "run cmd:\n #{cmd}"
363
- system(cmd)
357
+ puts "run cmd:\n #{cmd.join(' ')}"
358
+ system(*cmd)
364
359
 
365
360
  begin
366
361
  File.delete(file_name)
@@ -372,7 +367,7 @@ module Dvdvrconv
372
367
 
373
368
  def vrdisc_status
374
369
  puts "\n< < < < < @vrdisc status > > > > >"
375
- %w[num title output_title duplicate_name vob_titles concat_mode hardware_encode global_quality].each do |item|
370
+ %w[num title output_title duplicate_name vob_titles concat_mode hardware_encode global_quality h264_crf].each do |item|
376
371
  puts "#{item}=> #{@vrdisc[item]}"
377
372
  end
378
373
  puts "< < < < < @vrdisc status > > > > >\n"
@@ -396,8 +391,8 @@ module Dvdvrconv
396
391
  else
397
392
  cmd = str_convert_cmd(file_name)
398
393
  puts "----- convert #{file_name}.vob to mp4 file -----"
399
- puts "run cmd:\n #{cmd}"
400
- system(cmd)
394
+ puts "run cmd:\n #{cmd.join(' ')}"
395
+ system(*cmd)
401
396
  end
402
397
  end
403
398
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dvdvrconv
4
- VERSION = '1.3.1'
4
+ VERSION = '1.3.3'
5
5
  end
data/lib/dvdvrconv.rb CHANGED
@@ -3,6 +3,7 @@
3
3
  require 'open3'
4
4
  require 'optparse'
5
5
  require 'yaml'
6
+ require 'shellwords'
6
7
 
7
8
  require_relative 'dvdvrconv/command'
8
9
  require_relative 'dvdvrconv/options'
@@ -47,3 +47,38 @@ base_dst_name:
47
47
  - title_three
48
48
 
49
49
  number_list: []
50
+
51
+
52
+ ##################################################
53
+ #
54
+ # FFmpeg encode option
55
+ #
56
+ # You can select the encoding mode from 'normal' or 'qsv'.
57
+ #
58
+ # if you want to use a software encoder (default)
59
+ #
60
+ # hardware_encode: 'normal'
61
+ #
62
+ #
63
+ # If you want to use a hardware encoder(intel QSV LA_ICQ)
64
+ #
65
+ # hardware_encode: 'qsv'
66
+ #
67
+ #
68
+ ##################################################
69
+ #
70
+ # software encode option
71
+ #
72
+ # if you want to set h264 Constant Rate Factor (default 25)
73
+ #
74
+ # h264_crf: 28
75
+ #
76
+ #
77
+ # hardware encode option
78
+ #
79
+ # if you want to set Global Quality (default 25)
80
+ #
81
+ # global_quality: 28
82
+ #
83
+ #
84
+ ##################################################
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dvdvrconv
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.1
4
+ version: 1.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - icm7216
@@ -84,7 +84,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
84
84
  - !ruby/object:Gem::Version
85
85
  version: '0'
86
86
  requirements: []
87
- rubygems_version: 3.6.8
87
+ rubygems_version: 4.0.15
88
88
  specification_version: 4
89
89
  summary: DVD-VR utility
90
90
  test_files: []