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.
- data/README.md +45 -101
- data/lib/rvideo/version.rb +1 -1
- metadata +1 -1
data/README.md
CHANGED
@@ -1,132 +1,76 @@
|
|
1
|
-
#
|
1
|
+
# EZVideo
|
2
2
|
|
3
|
-
A
|
4
|
-
|
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
|
-
|
8
|
+
Initialize an inspector
|
9
9
|
|
10
|
-
|
10
|
+
video = RVideo::Inspector.new(:file => "path/to/video.mp4")
|
11
11
|
|
12
|
-
|
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
|
-
|
14
|
+
video.ffmpeg_version
|
15
|
+
video.ffmpeg_configuration
|
16
|
+
video.valid?
|
17
|
+
video.unknown_format?
|
18
|
+
video.unreadable_file?
|
18
19
|
|
19
|
-
|
20
|
-
|
21
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
53
|
+
First, install all neccessory packages
|
115
54
|
|
116
|
-
|
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 "
|
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/
|
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
|
|
data/lib/rvideo/version.rb
CHANGED