video_converter 0.7.10 → 0.8.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.
@@ -72,9 +72,11 @@ module VideoConverter
72
72
  filter_complex << "crop=#{output.crop}" if output.crop
73
73
  if output.width || output.height
74
74
  video_stream = input.metadata[:video_streams].first
75
- output.width = (output.height * video_stream[:width].to_f / video_stream[:height].to_f / 2).to_i * 2 if output.height && !output.width
76
- output.height = (output.width * video_stream[:height].to_f / video_stream[:width].to_f / 2).to_i * 2 if output.width && !output.height
75
+ width, height = (video_stream[:dar_width] || video_stream[:width]).to_f, (video_stream[:dar_height] || video_stream[:height]).to_f
76
+ output.width = (output.height * width / height / 2).to_i * 2 if output.height && !output.width
77
+ output.height = (output.width * height / width / 2).to_i * 2 if output.width && !output.height
77
78
  filter_complex << "scale=#{scale(output.width, :w)}:#{scale(output.height, :h)}"
79
+ filter_complex << "setdar=#{video_stream[:dar_width]}:#{video_stream[:dar_height]}" if video_stream[:dar_width] && video_stream[:dar_height]
78
80
  end
79
81
  if output.watermarks && (output.watermarks[:width] || output.watermarks[:height])
80
82
  filter_complex = ["[0:v] #{filter_complex.join(',')} [main]"]
@@ -38,8 +38,8 @@ module VideoConverter
38
38
  @metadata[:audio_streams] = s.scan(/Stream\s#(\d:\d).*?Audio:\s*(\w+).*?(\d+)\s*Hz.*?(\d+)\s*kb\/s.*?$/).map do |stream|
39
39
  Hash[[:map, :audio_codec, :audio_sample_rate, :audio_bitrate_in_kbps].zip(stream)]
40
40
  end
41
- @metadata[:video_streams] = s.scan(/Stream\s#(\d:\d).*?Video:\s([[:alnum:]]+).*?,\s*(?:(\d+)x(\d+))(?:.*?(\d+)\s*kb\/s.*?([\d.]+)\s*fps)?/).map do |stream|
42
- Hash[[:map, :video_codec, :width, :height, :video_bitrate_in_kbps, :frame_rate].zip(stream)]
41
+ @metadata[:video_streams] = s.scan(/Stream\s#(\d:\d).*?Video:\s([[:alnum:]]+).*?,\s*(?:(\d+)x(\d+))(?:.*?DAR\s(\d+):(\d+))?(?:.*?(\d+)\s*kb\/s.*?([\d.]+)\s*fps)?/).map do |stream|
42
+ Hash[[:map, :video_codec, :width, :height, :dar_width, :dar_height, :video_bitrate_in_kbps, :frame_rate].zip(stream)]
43
43
  end
44
44
  if m = s.match(/rotate\s*\:\s*(\d+)/)
45
45
  @metadata[:rotate] = m[1].to_i
@@ -1,3 +1,3 @@
1
1
  module VideoConverter
2
- VERSION = "0.7.10"
2
+ VERSION = "0.8.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: video_converter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.10
4
+ version: 0.8.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-10-15 00:00:00.000000000 Z
12
+ date: 2014-10-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: video_screenshoter
@@ -142,7 +142,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
142
142
  version: '0'
143
143
  segments:
144
144
  - 0
145
- hash: 2644633100331060987
145
+ hash: 2160906061662950076
146
146
  required_rubygems_version: !ruby/object:Gem::Requirement
147
147
  none: false
148
148
  requirements:
@@ -151,7 +151,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
151
151
  version: '0'
152
152
  segments:
153
153
  - 0
154
- hash: 2644633100331060987
154
+ hash: 2160906061662950076
155
155
  requirements:
156
156
  - ffmpeg, version 1.2 or greated configured with libx264 and libfaac
157
157
  - live_segmenter to convert to hls