ez_video 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README.md +45 -101
  2. data/lib/rvideo/version.rb +1 -1
  3. metadata +1 -1
data/README.md CHANGED
@@ -1,132 +1,76 @@
1
- # EZHttp
1
+ # EZVideo
2
2
 
3
- A wrapper for ruby net/http, supports http/https, RESTful methods, headers, certificate and file uploads.
4
- It supports both command line and ruby code.
3
+ A fork of Rvideo, have some bugs fixed.
4
+ A video reader/converter, ruby wrapper for ffmpeg.
5
5
 
6
6
  ## How to use it
7
7
 
8
- ### Command Line
8
+ Initialize an inspector
9
9
 
10
- Send with query string
10
+ video = RVideo::Inspector.new(:file => "path/to/video.mp4")
11
11
 
12
- ezhttp \
13
- --url "https://api.twitter.com/1/followers/ids.json" \
14
- --method "get" \
15
- --data "cursor=-1&screen_name=twitterapi"
12
+ Basic file info
16
13
 
17
- Send with query string
14
+ video.ffmpeg_version
15
+ video.ffmpeg_configuration
16
+ video.valid?
17
+ video.unknown_format?
18
+ video.unreadable_file?
18
19
 
19
- ezhttp \
20
- --url "https://api.twitter.com/1/followers/ids.json&cursor=-1&screen_name=twitterapi" \
21
- --method "get"
20
+ video.audio?
21
+ video.video?
22
+ video.container #mov,mp4,m4a,3gp,3g2,mj2
23
+ video.raw_duration #"00:00:24.4" => 24.4 seconds
24
+ video.duration #24400 => 24.4 seconds
25
+ video.bitrate #778
26
+ video.bitrate_units #kb/s
27
+
28
+ Audio info
22
29
 
23
- Send with json
30
+ video.audio_codec #aac
31
+ video.audio_sample_rate #44100
32
+ video.audio_sample_units #Hz
33
+ video.audio_channels_string #mono
34
+ video.audio_channels #1
24
35
 
25
- ezhttp \
26
- --url 'http://127.0.0.1:3000/file/upload_file' \
27
- --data '{"name":{"fn":"xxx","ln":"xxx"}}' \
28
- --method 'post' \
29
- --type 'application/json'
36
+ Video info
30
37
 
31
- Send with header
38
+ video.video_codec #h264
39
+ video.video_colorspace #yuv420p
40
+ video.width #560
41
+ video.height #316
42
+ video.resolution #560x316
43
+ video.fps #27.97
32
44
 
33
- ezhttp \
34
- --url 'https://api.twitter.com/oauth/request_token' \
35
- --method 'post' \
36
- --header 'Authorization: OAuth oauth_nonce="K7ny27JTpKVsTgdyLdDfmQQWVLERj2zAK5BslRsqyw", oauth_callback="http%3A%2F%2Fmyapp.com%3A3005%2Ftwitter%2Fprocess_callback", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1300228849", oauth_consumer_key="OqEqJeafRSF11jBMStrZz", oauth_signature="Pc%2BMLdv028fxCErFyi8KXFM%2BddU%3D", oauth_version="1.0"'
45
+ Capture frame
37
46
 
47
+ video.capture_frame('30%', 'path/to/store/thumbnail.jpg') #3s/75f/30%
48
+ video.calculate_time('30%') #1.21(s) #3s/75f/30%
38
49
 
39
- Upload file
40
50
 
41
- ezhttp \
42
- --url 'http://127.0.0.1:3000/file/upload_file' \
43
- --files 'path_to_file.png'
44
-
45
- Upload multiple files with header
46
-
47
- ezhttp \
48
- --url 'http://127.0.0.1:3000/file/upload_file' \
49
- --files 'path_to_file1.zip','path_to_file2.jpg' \
50
- --header 'authorization:Basic Zvsdwegbdgegsdv0xvsd='
51
-
52
- ### Ruby
53
-
54
- Send with encoded query string as data
55
-
56
- # Post request
57
- response = EZHttp.Post("https://www.example.com:83/api",
58
- "user_id=12345&token=sdfwD12g%7Ecc")
59
-
60
- # Get request
61
- response = EZHttp.Get("http://www.example.com/api",
62
- "user_id=12345&token=sdfwD12g%7Ecc")
63
-
64
- # OR
65
- response = EZHttp.Get("http://www.example.com/api?user_id=12345&token=sdfwD12g%7Ecc")
66
-
67
- Send with hash as data
68
-
69
- # Post request
70
- response = EZHttp.Post("https://www.example.com:83/api",
71
- {"name1"=>"value", "name2" => "value2"})
72
-
73
- # Put request
74
- response = EZHttp.Put("https://www.example.com:83/api",
75
- {"name1"=>"value", "name2" => "value2"})
76
-
77
- Send with extra headers
78
-
79
- response = EZHttp.Post("https://www.example.com:83/api",
80
- "user_id=12345&token=sdfwD12g%7Ecc",
81
- nil,
82
- [
83
- "authentication:oAuth username=xxx&password=xxx",
84
- "other_header:other_values"
85
- ])
86
-
87
- Send with pem certificate
88
-
89
- response = EZHttp.Delete("https://www.example.com:83/api",
90
- {"user_id"=>"12345"},
91
- "application/json",
92
- nil,
93
- "/path_to_cert.pem")
94
-
95
- Upload file(s)
96
-
97
- #
98
- files = []
99
- file = File.open("path_to_file.extension", "rb")
100
- files.push({"name" => File.basename(file), "content" => file.read})
101
- file.close
102
-
103
- # simply upload file
104
- response = EZHttp.Upload("https://www.example.com:83/api",
105
- files)
106
-
107
- # upload file with headers
108
- response = EZHttp.Upload("https://www.example.com:83/api",
109
- files,
110
- ["authorization:Basic Zvsdwegbdgegsdv0xvsd="])
111
-
112
- Display response
51
+ ## Installation
113
52
 
114
- puts response.body
53
+ First, install all neccessory packages
115
54
 
116
- ## Installation
55
+ sudo aptitude update
56
+ sudo aptitude install ffmpeg
57
+ sudo aptitude install libfaac-dev libxvidcore4-dev liba52-0.7.4 liba52-0.7.4-dev libx264-dev
58
+ sudo aptitude install libavutil49 libavutil-dev libavcodec-dev
59
+ sudo aptitude install libavcodec-unstripped-52
117
60
 
118
61
  Add the following line to rails "Gemfile"
119
62
 
120
- gem "ez_http"
63
+ gem "ez_video"
121
64
 
122
65
  then execute
123
66
 
124
67
  $ bundle install
125
68
 
126
69
 
127
- See [http://rubygems.org/gems/ez_http](http://rubygems.org/gems/ez_http "EZHttp RubyGem Page") for more details
70
+ See [http://rubygems.org/gems/ez_video](http://rubygems.org/gems/ez_video "EZVideo RubyGem Page") for more details
128
71
 
129
72
  ## Authors
130
73
 
131
74
  Tianyu Huang
75
+ Original author: Jonathan Dahl
132
76
 
@@ -2,7 +2,7 @@ module RVideo #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 1
4
4
  MINOR = 0
5
- TINY = 0
5
+ TINY = 1
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ez_video
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: