vidibus-fileinfo 0.3.0 → 1.0.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.
data/README.md CHANGED
@@ -67,15 +67,15 @@ jpg, jpeg, png, gif
67
67
  For videos, a different hash will be returned:
68
68
 
69
69
  ``` ruby
70
- :width # width of video (without anamorphosis)
71
- :height # height of video
72
- :aspect_ratio # aspect ratio of video on display (DAR)
73
- :size # file size in bytes
74
- :duration # duration of video in seconds
70
+ :width # width of video (without anamorphosis), e.g. 1920
71
+ :height # height of video, e.g. 1080
72
+ :aspect_ratio # aspect ratio of video on display (DAR), e.g. 1.777778
73
+ :size # file size in bytes, eg. 20883991
74
+ :duration # duration of video in seconds, e.g. 44.82
75
75
  :content_type # content type of video, e.g. "video/mp4"
76
- :fps # frames per second
77
- :bitrate # overall bit rate (video + audio)
78
- :video_codec # codec of video stream, e.g. "h264"
76
+ :frame_rate # frames per second, e.g. 29.97
77
+ :bit_rate # overall bit rate (video + audio) in bit, e.g. 600000
78
+ :video_codec # codec of video stream, e.g. "h264 (Main)"
79
79
  :audio_codec # codec of audio stream, e.g. "aac"
80
80
  :audio_sample_rate # sample rate of audio stream, e.g. 48000
81
81
  ```
@@ -83,7 +83,8 @@ For videos, a different hash will be returned:
83
83
  These video formats are currently supported:
84
84
 
85
85
  ```
86
- 3g2, 3gp, asf, avi, dv, f4p, f4v, flv, ivf, m21, mj2, mjpg, mkv, mov, mp4, mpeg, mpg, mxf, ogg, ogv, rm, ts, webm, wmv
86
+ 3g2, 3gp, asf, avi, dv, f4p, f4v, flv, ivf, m21, mj2, mjpg, mkv, mov, mp4,
87
+ mpeg, mpg, mxf, ogg, ogv, rm, ts, webm, wmv
87
88
  ```
88
89
 
89
90
  ## Copyright
@@ -7,8 +7,8 @@ module Vidibus
7
7
  mxf ogg ogv rm ts webm wmv
8
8
  ]
9
9
  METADATA = %w[
10
- aspect_ratio audio_codec audio_sample_rate content_type bit_rate bitrate
11
- duration fps frame_rate height size video_codec width
10
+ aspect_ratio audio_codec audio_sample_rate content_type bit_rate
11
+ duration frame_rate height size video_codec width
12
12
  ]
13
13
 
14
14
  # FFmpeg command
@@ -38,14 +38,14 @@ module Vidibus
38
38
 
39
39
  # Return the bit rate defined as "bitrate". Calculate it from
40
40
  # file size and duration otherwise.
41
+ # 1 kilobit == 1000 bit
41
42
  def bit_rate
42
43
  if match = @raw_metadata[/bitrate:\s(\d+)\skb\/s/, 1]
43
- match.to_i
44
+ match.to_i * 1000
44
45
  elsif duration && duration > 0
45
- (size.to_f/125/duration).round # /125 = /1000 (kB) *8 (bit)
46
+ (size.to_f/1.024/duration*8).round
46
47
  end
47
48
  end
48
- alias :bitrate :bit_rate
49
49
 
50
50
  def content_type
51
51
  super('video')
@@ -96,7 +96,6 @@ module Vidibus
96
96
  match.to_f
97
97
  end
98
98
  end
99
- alias :fps :frame_rate
100
99
 
101
100
  def height
102
101
  dimension[1] if dimension
@@ -1,5 +1,5 @@
1
1
  module Vidibus
2
2
  module Fileinfo
3
- VERSION = '0.3.0'
3
+ VERSION = '1.0.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vidibus-fileinfo
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
+ - 1
7
8
  - 0
8
- - 3
9
9
  - 0
10
- version: 0.3.0
10
+ version: 1.0.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Andre Pankratz
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-04-12 00:00:00 +02:00
18
+ date: 2012-04-13 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency