jwthumbs 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +9 -0
- data/README.md +3 -1
- data/Rakefile +3 -0
- data/ffmpeg.sh +51 -0
- data/lib/jwthumbs/version.rb +1 -1
- data/lib/movie.rb +3 -2
- data/lib/shutter.rb +4 -3
- data/lib/vtt.rb +9 -6
- data/spec/jwthumbs_spec.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 61e03b7571c388ee6177d85052127d28f51bcfaa
|
4
|
+
data.tar.gz: b05214162237a8824b1d138ee01cf55d464acab3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2615caa6f94182617d8006daaa7baab6cbd2d6cc5af74288f469eb9d97ce26e9760a63fe94a687aa17c497f2eba4b52b9efbabf8a17fe039a7a5d97d7d4bed1f
|
7
|
+
data.tar.gz: 3cdcef6c802a27b19a1044ca241cb0f877610a5d311a26176f5cad3aa5d2cd277fe4c63c2644eedd37ac6697242b7a0eb3714d22ccb096d0e644ef197d2f6738
|
data/.gitignore
CHANGED
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,6 +1,8 @@
|
|
1
|
+
[![Build Status](https://travis-ci.org/scaryguy/jwthumbs.png?branch=master)](https://travis-ci.org/scaryguy/jwthumbs)
|
2
|
+
|
1
3
|
# JWthumbs
|
2
4
|
|
3
|
-
Want to add tooltip thumbnails to your JWPlayer
|
5
|
+
Want to add tooltip thumbnails to your JWPlayer? You're welcome!
|
4
6
|
|
5
7
|
JWthumbs is a Ruby gem to create a .VTT file and a sprite of thumbnails of a given video file (mp4, mpg, avi, mov and so on...). You can't create timeline thumnails easier than this. Heavily inspired by [vlanard](https://github.com/vlanard)'s great [Python script](https://github.com/vlanard/videoscripts).
|
6
8
|
|
data/Rakefile
CHANGED
data/ffmpeg.sh
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
apt-get -y update
|
4
|
+
apt-get -y install libjpeg-dev libpng12-dev libtiff4-dev curl apache2 wget imagemagick libimage-exiftool-perl unzip lame autoconf build-essential checkinstall git libass-dev libfaac-dev libgpac-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev librtmp-dev libtheora-dev libtool libvorbis-dev pkg-config texi2html zlib1g-dev ffmpeg2theora poppler-utils
|
5
|
+
apt-get install imagemagick
|
6
|
+
## Install ffmpeg from source
|
7
|
+
mkdir ~/ffmpeg-source
|
8
|
+
cd ~/ffmpeg-source
|
9
|
+
wget http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gz
|
10
|
+
tar xzvf yasm-1.2.0.tar.gz && rm -rf yasm-1.2.0.tar.gz
|
11
|
+
cd yasm-1.2.0
|
12
|
+
./configure
|
13
|
+
make
|
14
|
+
checkinstall --pkgname=yasm --pkgversion="1.2.0" --backup=no --deldoc=yes --fstrans=no --default
|
15
|
+
cd ~/ffmpeg-source
|
16
|
+
git clone git://git.videolan.org/x264.git
|
17
|
+
cd x264
|
18
|
+
./configure --enable-static --enable-shared
|
19
|
+
make
|
20
|
+
checkinstall --pkgname=x264 --pkgversion="3:$(./version.sh | awk -F'[" ]' '/POINT/{print $4"+git"$5}')" --backup=no --deldoc=yes --fstrans=no --default
|
21
|
+
ldconfig
|
22
|
+
cd ~/ffmpeg-source
|
23
|
+
git clone --depth 1 git://github.com/mstorsjo/fdk-aac.git
|
24
|
+
cd fdk-aac
|
25
|
+
autoreconf -fiv
|
26
|
+
./configure --disable-shared
|
27
|
+
make
|
28
|
+
checkinstall --pkgname=fdk-aac --pkgversion="$(date +%Y%m%d%H%M)-git" --backup=no --deldoc=yes --fstrans=no --default
|
29
|
+
cd ~/ffmpeg-source
|
30
|
+
git clone --depth 1 http://git.chromium.org/webm/libvpx.git
|
31
|
+
cd libvpx
|
32
|
+
./configure --disable-examples --disable-unit-tests
|
33
|
+
make
|
34
|
+
checkinstall --pkgname=libvpx --pkgversion="1:$(date +%Y%m%d%H%M)-git" --backup=no --deldoc=yes --fstrans=no --default
|
35
|
+
cd ~/ffmpeg-source
|
36
|
+
git clone --depth 1 git://git.xiph.org/opus.git
|
37
|
+
cd opus
|
38
|
+
./autogen.sh
|
39
|
+
./configure --disable-shared
|
40
|
+
make
|
41
|
+
checkinstall --pkgname=libopus --pkgversion="$(date +%Y%lsm%d%H%M)-git" --backup=no --deldoc=yes --fstrans=no --default
|
42
|
+
cd ~/ffmpeg-source
|
43
|
+
wget http://www.ffmpeg.org/releases/ffmpeg-1.1.1.tar.gz
|
44
|
+
tar xf ffmpeg-1.1.1.tar.gz && rm -rf ffmpeg-1.1.1.tar.gz
|
45
|
+
cd ffmpeg-1.1.1
|
46
|
+
./configure --enable-gpl --enable-libass --enable-libfaac --enable-libfdk-aac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librtmp \
|
47
|
+
--enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree --enable-version3 --enable-libopus
|
48
|
+
make
|
49
|
+
checkinstall --pkgname=ffmpeg --pkgversion="7:$(date +%Y%m%d%H%M)-git" --backup=no --deldoc=yes --fstrans=no --default
|
50
|
+
hash -r
|
51
|
+
cd ~
|
data/lib/jwthumbs/version.rb
CHANGED
data/lib/movie.rb
CHANGED
@@ -5,7 +5,7 @@ module Jwthumbs
|
|
5
5
|
class Movie
|
6
6
|
|
7
7
|
attr_reader :file_path, :duration
|
8
|
-
attr_accessor :outdir, :seconds_between, :thumb_width, :vttfile, :spritefile, :clear_files
|
8
|
+
attr_accessor :outdir, :seconds_between, :thumb_width, :vttfile, :spritefile, :clear_files, :gallery_mode_on
|
9
9
|
|
10
10
|
def initialize(file_path=nil, options={})
|
11
11
|
raise Errno::ENOENT, "the file '#{file_path}' does not exist" unless File.exists?(file_path)
|
@@ -22,7 +22,8 @@ module Jwthumbs
|
|
22
22
|
@spritefile = options[:spritefile] ||= "#{File.basename(@file_path, File.extname(@file_path))}_sprite.jpg"
|
23
23
|
@vttfile_name = options[:vttfile_name] ||= "thumbs.vtt"
|
24
24
|
@outdir = options[:thumb_outdir] ||= "output/thumbs_#{Time.now.to_i.to_s}"
|
25
|
-
@vttfile = File.basename(@file_path, File.extname(@file_path))+"_"+@vttfile_name
|
25
|
+
@vttfile = File.basename(@file_path, File.extname(@file_path))+"_"+@vttfile_name
|
26
|
+
@gallery_mode_on = options[:gallery_mode_on] ||= false
|
26
27
|
end
|
27
28
|
|
28
29
|
|
data/lib/shutter.rb
CHANGED
@@ -27,8 +27,8 @@ module Jwthumbs
|
|
27
27
|
coords = get_geometry(@images.first)
|
28
28
|
gridsize = Math.sqrt(@images.length).ceil.to_i
|
29
29
|
gridsize = gridsize <= 0 ? 1 : gridsize
|
30
|
-
create_sprite(@movie.outdir, @movie.spritefile, coords, gridsize)
|
31
|
-
create_vtt(@movie, @movie.spritefile, @images.length, coords, gridsize)
|
30
|
+
create_sprite(@movie.outdir, @movie.spritefile, coords, gridsize) if !@movie.gallery_mode_on
|
31
|
+
create_vtt(@movie, @movie.spritefile, @images.length, coords, gridsize) if !@movie.gallery_mode_on
|
32
32
|
end
|
33
33
|
|
34
34
|
def create_vtt(movie, spritefile, images_count, coords, gridsize)
|
@@ -39,8 +39,9 @@ module Jwthumbs
|
|
39
39
|
grid = "#{gridsize}x#{gridsize}"
|
40
40
|
cmd = "montage #{outdir}/thumbnail*.jpg -tile #{grid} -geometry #{coords} #{outdir}/#{spritefile}"
|
41
41
|
Jwthumbs.logger.info(system(cmd))
|
42
|
+
|
42
43
|
end
|
43
|
-
|
44
|
+
|
44
45
|
|
45
46
|
def take_snaps
|
46
47
|
rate = "1/#{@movie.seconds_between}"
|
data/lib/vtt.rb
CHANGED
@@ -5,6 +5,7 @@ module Jwthumbs
|
|
5
5
|
@movie = movie
|
6
6
|
create(movie, spritefile, images_count, coords, gridsize)
|
7
7
|
clear_files if @movie.clear_files
|
8
|
+
|
8
9
|
end
|
9
10
|
|
10
11
|
def create(movie, spritefile, images_count, coords, gridsize)
|
@@ -29,16 +30,18 @@ module Jwthumbs
|
|
29
30
|
clipstart = clipend
|
30
31
|
clipend = clipend + thumb_rate
|
31
32
|
end
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
33
|
+
|
34
|
+
vtt_path = movie.outdir+"/"+movie.vttfile
|
35
|
+
File.open(vtt_path, 'w+') do |f|
|
36
|
+
f.write(vtt.join("\n"))
|
37
|
+
|
36
38
|
end
|
37
|
-
|
39
|
+
|
38
40
|
end
|
39
41
|
|
40
|
-
protected
|
41
42
|
|
43
|
+
protected
|
44
|
+
|
42
45
|
def clear_files
|
43
46
|
Dir.glob("#{@movie.outdir}/thumbnail*.jpg") do |image|
|
44
47
|
|
data/spec/jwthumbs_spec.rb
CHANGED
@@ -63,7 +63,7 @@ describe "File progresses" do
|
|
63
63
|
describe "VTT progresses" do
|
64
64
|
|
65
65
|
describe "should create vtt file" do
|
66
|
-
it { expect(File.file?("#{outdir}/#{@movie.
|
66
|
+
it { expect(File.file?("#{outdir}/#{@movie.vttfile}")).to eq true}
|
67
67
|
end
|
68
68
|
|
69
69
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jwthumbs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- scary.mac
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-02-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -64,10 +64,12 @@ files:
|
|
64
64
|
- .rspec
|
65
65
|
- .ruby-gemset
|
66
66
|
- .ruby-version
|
67
|
+
- .travis.yml
|
67
68
|
- Gemfile
|
68
69
|
- LICENSE.txt
|
69
70
|
- README.md
|
70
71
|
- Rakefile
|
72
|
+
- ffmpeg.sh
|
71
73
|
- fixtures/iki_dakka.mp4
|
72
74
|
- jwthumbs.gemspec
|
73
75
|
- lib/jwthumbs.rb
|