video_sprites 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +12 -0
  3. data/.travis.yml +5 -0
  4. data/Gemfile +6 -0
  5. data/LICENSE.txt +21 -0
  6. data/README.md +76 -0
  7. data/Rakefile +10 -0
  8. data/Vagrantfile +76 -0
  9. data/ansible/development-playbook.yml +15 -0
  10. data/ansible/development.ini +2 -0
  11. data/ansible/roles/basic-setup/tasks/main.yml +35 -0
  12. data/ansible/roles/ffmpeg/defaults/main.yml +6 -0
  13. data/ansible/roles/ffmpeg/tasks/ff-libraries.yml +21 -0
  14. data/ansible/roles/ffmpeg/tasks/ffmpeg.yml +18 -0
  15. data/ansible/roles/ffmpeg/tasks/libfdk_aac.yml +19 -0
  16. data/ansible/roles/ffmpeg/tasks/libmp3lame.yml +20 -0
  17. data/ansible/roles/ffmpeg/tasks/libogg.yml +18 -0
  18. data/ansible/roles/ffmpeg/tasks/libopus.yml +20 -0
  19. data/ansible/roles/ffmpeg/tasks/libvorbis.yml +18 -0
  20. data/ansible/roles/ffmpeg/tasks/libvpx.yml +18 -0
  21. data/ansible/roles/ffmpeg/tasks/main.yml +80 -0
  22. data/ansible/roles/ffmpeg/tasks/x264.yml +18 -0
  23. data/ansible/roles/ffmpeg/tasks/x265.yml +14 -0
  24. data/ansible/roles/ffmpeg/tasks/yasm.yml +19 -0
  25. data/ansible/roles/rvm_io.rvm1-ruby/.gitignore +6 -0
  26. data/ansible/roles/rvm_io.rvm1-ruby/.travis.yml +52 -0
  27. data/ansible/roles/rvm_io.rvm1-ruby/LICENSE +22 -0
  28. data/ansible/roles/rvm_io.rvm1-ruby/README.md +142 -0
  29. data/ansible/roles/rvm_io.rvm1-ruby/defaults/main.yml +44 -0
  30. data/ansible/roles/rvm_io.rvm1-ruby/meta/main.yml +21 -0
  31. data/ansible/roles/rvm_io.rvm1-ruby/tasks/main.yml +4 -0
  32. data/ansible/roles/rvm_io.rvm1-ruby/tasks/rubies.yml +78 -0
  33. data/ansible/roles/rvm_io.rvm1-ruby/tasks/rvm.yml +55 -0
  34. data/ansible/roles/rvm_io.rvm1-ruby/tests/inventory +1 -0
  35. data/ansible/roles/rvm_io.rvm1-ruby/tests/test.yml +14 -0
  36. data/ansible/roles/rvm_io.rvm1-ruby/vars/main.yml +22 -0
  37. data/bin/console +14 -0
  38. data/bin/setup +8 -0
  39. data/exe/videosprites +6 -0
  40. data/lib/video_sprites.rb +7 -0
  41. data/lib/video_sprites/cli.rb +17 -0
  42. data/lib/video_sprites/processor.rb +167 -0
  43. data/lib/video_sprites/version.rb +3 -0
  44. data/video_sprites.gemspec +31 -0
  45. metadata +173 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ff00cddcb56e85f7007f4bb2e72a170ad45558ed
4
+ data.tar.gz: 2b16074efb0f73297c96ed11ac123a9633e87834
5
+ SHA512:
6
+ metadata.gz: d3f5c637742386b98cfdd6602f0f620fe59ab0491ff149952c737f12bc7140fa0245b56ef95ab64d6ab7400781a09a7a77062cdc0b903c98a3fd7ab20dc6fee4
7
+ data.tar.gz: ea99033ea838ef2abe6941aa934f329e81ce2445b777f5a780a04f35da2bb41eee8b3c185725ff4135b944973c13449df851b3a10200ded61d3ef85a6fa1092d
data/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ /.vagrant/
11
+ /.byebug_history
12
+ /.imdone
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.3.3
5
+ before_install: gem install bundler -v 1.13.6
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in video_sprites.gemspec
4
+ gemspec
5
+
6
+ gem 'byebug'
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 North Carolina State University
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,76 @@
1
+ # VideoSprites
2
+
3
+ Creates thumbnail sprite images and a WebVTT metadata file that can be used within several HTML5 video players to show preview thumbnails when hovering over the video time rail.
4
+
5
+ The initial version [video-sprites](https://github.com/jronallo/video-sprites) was written during an [AMIA](http://www.amianet.org/) hack day by Ashley Blewer, Jay Brown, Jason Ronallo, and Nicholas Zoss. This version improves on the CLI and allows it to be used as a module in other projects.
6
+
7
+ ## Requirements
8
+
9
+ - ffmpeg
10
+ - Imagemagick (convert and montage)
11
+
12
+ ## Installation
13
+
14
+ Add this line to your application's Gemfile:
15
+
16
+ ```ruby
17
+ gem 'video_sprites'
18
+ ```
19
+
20
+ And then execute:
21
+
22
+ `$ bundle`
23
+
24
+ Or install it yourself as:
25
+
26
+ `$ gem install video_sprites`
27
+
28
+ ## Usage
29
+
30
+ See usage with: `videosprites help process`
31
+
32
+ Try it out with the defaults on one of the test videos in this repository under test/videos:
33
+ `videosprites process test/videos/GibraltarVotesToRemainBritish1967-51sec.mp4 tmp/gibraltar`
34
+
35
+ Or create sprites that better match your use case:
36
+ `videosprites process test/videos/GibraltarVotesToRemainBritish1967-51sec.mp4 tmp/gibraltar2 --seconds=5 --width=150 --columns=3 --group=6`
37
+
38
+ You can also make an animated GIF from all the selected frames using the same size as the thumbnails by adding the `--gif` option.
39
+
40
+ To use the project as a module in your own video processing workflow you can use it like this:
41
+
42
+ ```ruby
43
+ input_file = '/path/to/video.mp4'
44
+ output_directory = '/path/to/tmp/gibraltar2'
45
+ options = {
46
+ seconds: 10,
47
+ width: 160,
48
+ columns: 4,
49
+ group: 20,
50
+ gif: false
51
+ }
52
+ processor = VideoSprites::Processor.new(input_file, output_directory, options)
53
+ processor.process
54
+ ```
55
+
56
+ ## Players
57
+
58
+ The following players provide a way to use WebVTT files and images sprites. Note that the WebVTT and thumbnails provided by VideoSprites may not have been tested in all players. Please file an issue if you find an incompatibility with any player.
59
+
60
+ - [JW Player](https://support.jwplayer.com/customer/portal/articles/1407439-adding-preview-thumbnails)
61
+ - [THEOplayer](https://support.theoplayer.com/hc/en-us/articles/207460505-Preview-Thumbnails)
62
+ - [Radiant Media Player](https://www.radiantmediaplayer.com/docs/3.0/preview-thumbnails.html)
63
+
64
+ ## Development
65
+
66
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
67
+
68
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
69
+
70
+ ## Contributing
71
+
72
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/video_sprites.
73
+
74
+ ## License
75
+
76
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList['test/**/*_test.rb']
8
+ end
9
+
10
+ task :default => :test
data/Vagrantfile ADDED
@@ -0,0 +1,76 @@
1
+ # -*- mode: ruby -*-
2
+ # vi: set ft=ruby :
3
+
4
+ Vagrant.configure("2") do |config|
5
+ config.vm.box = "boxcutter/centos72"
6
+
7
+ config.vm.synced_folder '.', '/vagrant' #, type: 'nfs', mount_options: ['nolock', 'rw', 'vers=3', 'tcp', 'actimeo=2']
8
+
9
+ config.vm.provider "virtualbox" do |vb|
10
+ vb.linked_clone = true
11
+ vb.memory = 1024
12
+ vb.cpus = 1
13
+ end
14
+
15
+ config.vm.provision "ansible_local" do |ansible|
16
+ ansible.playbook = 'ansible/development-playbook.yml'
17
+ ansible.inventory_path = 'ansible/development.ini'
18
+ ansible.limit = 'all'
19
+ # ansible.verbose = 'vvvv'
20
+ end
21
+
22
+ # Disable automatic box update checking. If you disable this, then
23
+ # boxes will only be checked for updates when the user runs
24
+ # `vagrant box outdated`. This is not recommended.
25
+ # config.vm.box_check_update = false
26
+
27
+ # Create a forwarded port mapping which allows access to a specific port
28
+ # within the machine from a port on the host machine. In the example below,
29
+ # accessing "localhost:8080" will access port 80 on the guest machine.
30
+ # config.vm.network "forwarded_port", guest: 80, host: 8080
31
+
32
+ # Create a private network, which allows host-only access to the machine
33
+ # using a specific IP.
34
+ # config.vm.network "private_network", ip: "192.168.33.10"
35
+
36
+ # Create a public network, which generally matched to bridged network.
37
+ # Bridged networks make the machine appear as another physical device on
38
+ # your network.
39
+ # config.vm.network "public_network"
40
+
41
+ # Share an additional folder to the guest VM. The first argument is
42
+ # the path on the host to the actual folder. The second argument is
43
+ # the path on the guest to mount the folder. And the optional third
44
+ # argument is a set of non-required options.
45
+ # config.vm.synced_folder "../data", "/vagrant_data"
46
+
47
+ # Provider-specific configuration so you can fine-tune various
48
+ # backing providers for Vagrant. These expose provider-specific options.
49
+ # Example for VirtualBox:
50
+ #
51
+ # config.vm.provider "virtualbox" do |vb|
52
+ # # Display the VirtualBox GUI when booting the machine
53
+ # vb.gui = true
54
+ #
55
+ # # Customize the amount of memory on the VM:
56
+ # vb.memory = "1024"
57
+ # end
58
+ #
59
+ # View the documentation for the provider you are using for more
60
+ # information on available options.
61
+
62
+ # Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
63
+ # such as FTP and Heroku are also available. See the documentation at
64
+ # https://docs.vagrantup.com/v2/push/atlas.html for more information.
65
+ # config.push.define "atlas" do |push|
66
+ # push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
67
+ # end
68
+
69
+ # Enable provisioning with a shell script. Additional provisioners such as
70
+ # Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
71
+ # documentation for more information about their specific syntax and use.
72
+ # config.vm.provision "shell", inline: <<-SHELL
73
+ # apt-get update
74
+ # apt-get install -y apache2
75
+ # SHELL
76
+ end
@@ -0,0 +1,15 @@
1
+ ---
2
+ - hosts: video_sprites
3
+ become: yes
4
+ become_method: sudo
5
+ become_user: root
6
+ remote_user: root
7
+ gather_facts: yes
8
+ roles:
9
+ - role: basic-setup
10
+ - role: ffmpeg
11
+ build_dir: /root/ffmpeg_build
12
+ source_dir: /root/ffmpeg_sources
13
+ - role: rvm_io.rvm1-ruby
14
+ rvm1_rubies:
15
+ - 2.3.3
@@ -0,0 +1,2 @@
1
+ [video_sprites]
2
+ localhost ansible_connection=local
@@ -0,0 +1,35 @@
1
+ ---
2
+ - name: install epel-release
3
+ yum:
4
+ name: epel-release
5
+ state: present
6
+ - name: install git repo
7
+ yum:
8
+ name: http://opensource.wandisco.com/centos/6/git/x86_64/wandisco-git-release-6-1.noarch.rpm
9
+ state: present
10
+ - name: install required packages
11
+ yum:
12
+ pkg: "{{item}}"
13
+ state: present
14
+ update_cache: yes
15
+ with_items:
16
+ - git
17
+ - curl
18
+ - zlib
19
+ - zlib-devel
20
+ - gcc-c++
21
+ - readline
22
+ - readline-devel
23
+ - libyaml-devel
24
+ - libffi-devel
25
+ - openssl-devel
26
+ - make
27
+ - bzip2
28
+ - autoconf
29
+ - automake
30
+ - libtool
31
+ - bison
32
+ - vim
33
+ - htop
34
+ - tree
35
+ - ImageMagick
@@ -0,0 +1,6 @@
1
+ ---
2
+ bin_dir: "/usr/local/bin"
3
+ lib_dir: "/usr/local/lib"
4
+
5
+ build_dir: "/home/vagrant/ffmpeg_build"
6
+ source_dir: "/home/vagrant/ffmpeg_sources"
@@ -0,0 +1,21 @@
1
+ ---
2
+ - name: remove yum packaged ffmpeg
3
+ become: yes
4
+ yum: name=ffmpeg state=absent
5
+
6
+ - name: Install dependencies
7
+ yum: name={{ item }} state=present
8
+ with_items:
9
+ - autoconf
10
+ - automake
11
+ - cmake
12
+ - freetype-devel
13
+ - gcc
14
+ - gcc-c++
15
+ - git
16
+ - libtool
17
+ - make
18
+ - mercurial
19
+ - nasm
20
+ - pkgconfig
21
+ - zlib-devel
@@ -0,0 +1,18 @@
1
+ ---
2
+ - name: GIT clone | ffmpeg
3
+ git: repo=git://source.ffmpeg.org/ffmpeg.git
4
+ dest={{ source_dir }}/ffmpeg
5
+ accept_hostkey=yes
6
+ depth=1
7
+
8
+ - name: Compile | ffmpeg
9
+ shell: "export PATH=/usr/local/bin/:$PATH && {{ item }}"
10
+ args:
11
+ chdir: "{{ source_dir }}/ffmpeg"
12
+ creates: "{{ bin_dir }}/ffmpeg"
13
+ with_items:
14
+ - PKG_CONFIG_PATH="{{ build_dir }}/lib/pkgconfig" ./configure --prefix={{ build_dir }} --extra-cflags="-I{{ build_dir }}/include" --extra-ldflags="-L{{ build_dir }}/lib" --bindir={{ bin_dir }} --pkg-config-flags="--static" --enable-gpl --enable-nonfree --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265
15
+ - make
16
+ - make install
17
+ - make distclean
18
+ - hash -r
@@ -0,0 +1,19 @@
1
+ ---
2
+ # AAC audio encoder
3
+ - name: GIT clone | libfdk_aac
4
+ git: repo=git://git.code.sf.net/p/opencore-amr/fdk-aac
5
+ dest={{ source_dir }}/libfdk_aac
6
+ accept_hostkey=yes
7
+ depth=1
8
+
9
+ - name: Compile | libfdk_aac
10
+ shell: "export PATH=/usr/local/bin/:$PATH && {{ item }}"
11
+ args:
12
+ chdir: "{{ source_dir }}/libfdk_aac"
13
+ creates: "{{ bin_dir }}/libfdk_aac"
14
+ with_items:
15
+ - autoreconf -fiv
16
+ - ./configure --prefix={{ build_dir }} --disable-shared
17
+ - make
18
+ - make install
19
+ - make distclean
@@ -0,0 +1,20 @@
1
+ ---
2
+ # - name: libmp3lame | Download
3
+ # get_url: url=http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz dest={{ source_dir }}/libmp3lame.tar.gz
4
+
5
+ - name: libmp3lame | Unarchive
6
+ unarchive:
7
+ src: http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz
8
+ dest: "{{ source_dir }}"
9
+ copy: no
10
+
11
+ - name: Compile | libmp3lame
12
+ shell: "export PATH=/usr/local/bin/:$PATH && {{ item }}"
13
+ args:
14
+ chdir: "{{ source_dir }}/lame-3.99.5"
15
+ creates: "{{ bin_dir }}/lame-3.99.5"
16
+ with_items:
17
+ - ./configure --prefix={{ build_dir }} --bindir={{ bin_dir }} --disable-shared --enable-nasm
18
+ - make
19
+ - make install
20
+ - make distclean
@@ -0,0 +1,18 @@
1
+ ---
2
+ # Ogg bitstream library. Required by libtheora and libvorbis.
3
+ - name: libogg | Unarchive
4
+ unarchive:
5
+ src: http://downloads.xiph.org/releases/ogg/libogg-1.3.2.tar.gz
6
+ dest: "{{ source_dir }}"
7
+ copy: no
8
+
9
+ - name: Compile | libogg
10
+ shell: "export PATH=/usr/local/bin/:$PATH && {{ item }}"
11
+ args:
12
+ chdir: "{{ source_dir }}/libogg-1.3.2"
13
+ creates: "{{ bin_dir }}/libogg-1.3.2"
14
+ with_items:
15
+ - ./configure --prefix={{ build_dir }} --disable-shared
16
+ - make
17
+ - make install
18
+ - make distclean
@@ -0,0 +1,20 @@
1
+ ---
2
+ # Opus audio decoder and encoder
3
+ # 2016-05-21 Changed from using git:// URI to using HTTP
4
+ - name: GIT clone | libopus
5
+ git: repo=http://git.opus-codec.org/opus.git
6
+ dest={{ source_dir }}/libopus
7
+ # depth=1
8
+ # accept_hostkey=yes
9
+
10
+ - name: Compile | libopus
11
+ shell: "export PATH=/usr/local/bin/:$PATH && {{ item }}"
12
+ args:
13
+ chdir: "{{ source_dir }}/libopus"
14
+ creates: "{{ bin_dir }}/libopus"
15
+ with_items:
16
+ - autoreconf -fiv
17
+ - ./configure --prefix={{ build_dir }} --disable-shared
18
+ - make
19
+ - make install
20
+ - make distclean
@@ -0,0 +1,18 @@
1
+ ---
2
+ # Vorbis audio encoder. Requires libogg.
3
+ - name: libvorbis | Unarchive
4
+ unarchive:
5
+ src: http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.4.tar.gz
6
+ dest: "{{ source_dir }}"
7
+ copy: no
8
+
9
+ - name: Compile | libvorbis
10
+ shell: "export PATH=/usr/local/bin/:$PATH && {{ item }}"
11
+ args:
12
+ chdir: "{{ source_dir }}/libvorbis-1.3.4"
13
+ creates: "{{ bin_dir }}/libvorbis-1.3.4"
14
+ with_items:
15
+ - LDFLAGS="-L{{ build_dir }}/lib" CPPFLAGS="-I{{ build_dir }}/include" ./configure --prefix="{{ build_dir }}" --with-ogg="{{ build_dir }}" --disable-shared
16
+ - make
17
+ - make install
18
+ - make distclean
@@ -0,0 +1,18 @@
1
+ ---
2
+ # VP8/VP9 video encoder
3
+ - name: GIT clone | libvpx
4
+ git: repo=https://chromium.googlesource.com/webm/libvpx.git
5
+ dest={{ source_dir }}/libvpx
6
+ accept_hostkey=yes
7
+ depth=1
8
+
9
+ - name: Compile | libvpx
10
+ shell: "export PATH=/usr/local/bin/:$PATH && {{ item }}"
11
+ args:
12
+ chdir: "{{ source_dir }}/libvpx"
13
+ creates: "{{ bin_dir }}/libvpx"
14
+ with_items:
15
+ - ./configure --prefix={{ build_dir }} --disable-examples
16
+ - make
17
+ - make install
18
+ - make distclean