moshy 1.0.1 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 65ba7cdf045a9030b3d55c3e47ba0f663dc1f0b4
4
- data.tar.gz: adccab4801ffc3f4464fcbc39f949897254275fc
2
+ SHA256:
3
+ metadata.gz: bc59918e9bee8fa77d0ab8ab50133b649b6a678c9252841f96f0ca437ce8c451
4
+ data.tar.gz: 73a9c73111913e8636822c05cc0070192ed4d52a18b94c8123da6feb8576b0b8
5
5
  SHA512:
6
- metadata.gz: 5e5d5f1cec0c6a8757283621a22ccfe0b6d140b0cd2e56b52a779ac07dcddde98be29d490c5f05826eb07d05491db844d0366274910c2380565b3654f1e2ef66
7
- data.tar.gz: 027b8c7921993a9ebbade5e3332a3a02422971b6ab4fa1de9504124e11808e66052b9804e7098756c39880a95bfdc7e03be9962accfbc7fdfbaeb1d21ae91a29
6
+ metadata.gz: ee687b047cb841b6604b37bb9c455565533a8f692691477469794fc2e301334c0681154671c428844f1f59bbe50c4c479d4f2d356f6e334c17d41dff0891ec11
7
+ data.tar.gz: eb4aba0d25e6548c9e327c4cc685afaab7ac0a179f7e1adfe55a6ae074293f6e83d91ff5b1ef8f7aaa5e29f46b8105023c7b5672b9c80bdfeb2483a0e8145ea9
data/.gitignore CHANGED
@@ -1,22 +1,22 @@
1
- *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- .yardoc
6
- Gemfile.lock
7
- InstalledFiles
8
- _yardoc
9
- coverage
10
- doc/
11
- lib/bundler/man
12
- pkg
13
- rdoc
14
- spec/reports
15
- test/tmp
16
- test/version_tmp
17
- tmp
18
- *.bundle
19
- *.so
20
- *.o
21
- *.a
22
- mkmf.log
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ *.bundle
19
+ *.so
20
+ *.o
21
+ *.a
22
+ mkmf.log
data/DEVNOTES.md ADDED
@@ -0,0 +1,7 @@
1
+ # Running on Windows 10
2
+
3
+ Need to have PATH set up properly with ffmpeg
4
+
5
+ ```
6
+ ruby -Ilib ./bin/moshy -m prep -i i.mp4 -o o.avi
7
+ ```
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in moshy.gemspec
4
- gemspec
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in moshy.gemspec
4
+ gemspec
data/LICENSE.txt CHANGED
@@ -1,22 +1,22 @@
1
- Copyright (c) 2015 Way Spurr-Chen <wayspurrchen@gmail.com> <http://wayspurrchen.com/>
2
-
3
- MIT License
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining
6
- a copy of this software and associated documentation files (the
7
- "Software"), to deal in the Software without restriction, including
8
- without limitation the rights to use, copy, modify, merge, publish,
9
- distribute, sublicense, and/or sell copies of the Software, and to
10
- permit persons to whom the Software is furnished to do so, subject to
11
- the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be
14
- included in all copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1
+ Copyright (c) 2015 Way Spurr-Chen <wayspurrchen@gmail.com> <http://wayspurrchen.com/>
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -1,87 +1,112 @@
1
- # moshy
2
-
3
- ![](http://imgur.com/OMLTr26.gif)
4
- created with moshy's pdupe options
5
-
6
- **moshy** is a command line datamoshing utility kit for AVI files, based heavily on [aviglitch](https://github.com/ucnv/aviglitch).
7
- It's designed to make common datamoshing tasks easier without having to open avidemux or other GUI tools. It lets you do stuff like:
8
-
9
- - Convert video files into AVI video files with minimal I-Frames and no B-frames for ultimate moshability
10
- - Create P-Frame duplication effects quickly
11
- - Split a long video file into multiple clips based on its I-Frames
12
- - "Bake" your datamoshed video, encoding the corruption as actual video content for uploading to video services or moshing even further!
13
- - Identifying keyframe and deltaframe indexes in any AVI file
14
- - ...and more!
15
-
16
- If you don't know how to use the command line, this is a great opportunity to learn:
17
-
18
- - Mac OS X Tutorial: http://blog.teamtreehouse.com/introduction-to-the-mac-os-x-command-line
19
- - Windows Tutorial: http://lifehacker.com/5633909/who-needs-a-mouse-learn-to-use-the-command-line-for-almost-anything
20
-
21
- ## Get it!
22
-
23
- You'll need to install [Ruby](https://www.ruby-lang.org/en/). If you're on Mac OS X, you probably already have a local version of Ruby installed. Once that's done, you can use Rubygems (which comes with Ruby) to install moshy:
24
-
25
- ```
26
- gem install moshy
27
- ```
28
-
29
- From there, you can use `moshy` from the command line.
30
-
31
- ## What's it do?
32
-
33
- Moshy currently has six different modes:
34
-
35
- - `prep` - Preps a video file for datamoshing with moshy by converting it
36
- into an AVI with no B-Frames (they're not good for moshing), and placing as
37
- few I-Frames as possible. Requires ffmpeg be installed locally.
38
- - `isplit` - Extracts individual clips from an AVI where each clip is
39
- separated by I-frames in the original AVI. Great for getting specific
40
- clips out of a larger video and later doing I-frame moshing.
41
- - `inspect` - Reads an .avi file and prints which video frames are keyframes
42
- (I-Frames) and which frames are delta frames (P-frames or B-frames). moshy
43
- cannot tell the difference between a P-frame or a B-frame, so you will want
44
- to use avidemux or another program if you need to know.
45
- - `pdupe` - Duplicates a P-frame at a given frame a certain amount. To find
46
- out which frames are P-frames, use software like avidemux to look at the
47
- frame type. WARNING: This mode is a little glitchy. You may need to set
48
- the interval 1 or 2 above or below the frame number you actually want to
49
- duplicate. I'm not sure why this happens, but try it with a small
50
- duplication amount first. NOTE: This can mode take a while to process
51
- over 60-90 frame dupes.
52
- - `ppulse` - Takes c number of frames and every n frames and duplicates them a
53
- given amount, resulting in a consistent P-duplication datamosh that's
54
- good for creating rhythmic effects. This was originally created to
55
- create mosh effects in sync with a beat for a music video.
56
- - `bake` - "Bakes" your datamosh by creating a new video file from your
57
- datamoshed .avi, causing the datamosh effects to be treated as the actual
58
- content of the new video instead of an error. Requires ffmpeg to be
59
- installed locally.
60
-
61
- You can access detailed info on how to use each of them from the command line with
62
- the command `moshy -m <mode> --help`.
63
-
64
- ## Cool!
65
-
66
- If you think this is cool, you'll probably find my list of [glitch art resources](http://www.glitchet.com/resources)
67
- useful as well as the [Glitchet newsletter](http://www.glitchet.com/), a free weekly futuristic
68
- news and glitch aesthetic e-zine.
69
-
70
- ## Quick tutorial
71
-
72
- Here's a short example of how you might use moshy to create a P-dupe mosh:
73
-
74
- 1. Choose a YouTube video you want to mosh (I'll use "Charlie bit my finger": <https://www.youtube.com/watch?v=bnRVheEpJG4>)
75
- 2. Download it with KeepVid (<http://keepvid.com/?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DbnRVheEpJG4>)
76
- 3. "Prep" it with moshy to turn it into an .AVI with minimal I-Frames and all P-frames (because B-frames don't mosh well):
77
- `moshy -m prep -i charlie.mp4 -o charlie.avi`
78
- 4. Open charlie.avi in avidemux and clip it down to the segment I want (moshy will soon be able to do this with a "clip" command): ![](http://i.imgur.com/OBy8pbB.png)
79
- 5. Open charlie_clip.avi and find the frame I want to P-dupe mosh (here, frame 196): ![](http://i.imgur.com/aZsZIx6.png)
80
- 6. Use moshy in pdupe mode to dupe frame 196 60 times:
81
- `moshy -m pdupe -i charlie_clip.avi -f 196 -d 60 -o charlie_clip-dupe.avi`
82
- Open it in a video player (I use VLC) and see if it looks good.
83
- 7. Awesome, I love it, but I want to clip it down to size. However, since it has so few I-frames, if I just clip it anywhere, the beginning of the video will become corrupted because of lack of pixel data. Let's use moshy to bake the mosh:
84
- `moshy -m bake -i charlie_clip-dupe.avi -o charlie_clip-dupe-bake.avi`
85
- 8. Done. Let's open it back up in avidemux, clip it down to size, and save our final result: ![](http://i.imgur.com/07abIqT.png)
86
- 9. Looks good to me. Let's save it as an MP4 so that I can upload it to Giphy, which will convert it into a .gif for me. (I'm hoping to add modes to moshy that convert videos to .gif and .mp4 directly, too.)
87
- 10. Done! ![](https://media.giphy.com/media/3o85xoWYyG1HEVs8Vy/giphy.gif)
1
+ # moshy
2
+
3
+ ![](http://imgur.com/OMLTr26.gif)
4
+ created with moshy's pdupe options
5
+
6
+ **moshy** is a command line datamoshing utility kit for AVI files, based heavily on [aviglitch](https://github.com/ucnv/aviglitch).
7
+ It's designed to make common datamoshing tasks easier without having to open avidemux or other GUI tools. It lets you do stuff like:
8
+
9
+ - Convert video files into AVI video files with minimal I-Frames and no B-frames for ultimate moshability
10
+ - Create P-Frame duplication effects quickly
11
+ - Split a long video file into multiple clips based on its I-Frames
12
+ - "Bake" your datamoshed video, encoding the corruption as actual video content for uploading to video services or moshing even further!
13
+ - Identifying keyframe and deltaframe indexes in any AVI file
14
+ - ...and more!
15
+
16
+ If you don't know how to use the command line, this is a great opportunity to learn:
17
+
18
+ - Mac OS X Tutorial: http://blog.teamtreehouse.com/introduction-to-the-mac-os-x-command-line
19
+ - Windows Tutorial: http://lifehacker.com/5633909/who-needs-a-mouse-learn-to-use-the-command-line-for-almost-anything
20
+
21
+ ## June 2022 Update - Moshy 2.0.0
22
+
23
+ With the release of Ruby 3, many dependencies for this project broke. I have updated this for the following versions, but I don't support this software actively anymore and haven't tested on various devices, platforms, etc., but if you have the right dependencies everything should work as normal:
24
+
25
+ - Ruby 3.1.2
26
+ - Bundler 2.3.7
27
+ - ffmpeg 5
28
+
29
+ If you already use moshy, run the following:
30
+
31
+ ```
32
+ gem uninstall moshy
33
+ gem uninstall slop
34
+ gem install moshy -v 2.0.1
35
+ ```
36
+
37
+ That should work. If not, please file an issue and I will try to get to it.
38
+
39
+ ## Get it!
40
+
41
+ You'll need to install [Ruby](https://www.ruby-lang.org/en/). If you're on Mac OS X, you probably already have a local version of Ruby installed. Once that's done, you can use Rubygems (which comes with Ruby) to install moshy:
42
+
43
+ ```
44
+ gem install moshy -v 2.0.1
45
+ ```
46
+
47
+ From there, you can use `moshy` from the command line.
48
+
49
+ For a couple commands (`prep` and `bake`), you need to have ffmpeg installed locally.
50
+ [You can get it for your OS here.](https://www.ffmpeg.org/download.html)
51
+
52
+ ## What's it do?
53
+
54
+ Moshy currently has six different modes:
55
+
56
+ - `prep` - Preps a video file for datamoshing with moshy by converting it
57
+ into an AVI with no B-Frames (they're not good for moshing), and placing as
58
+ few I-Frames as possible. Requires ffmpeg be installed locally.
59
+ - `isplit` - Extracts individual clips from an AVI where each clip is
60
+ separated by I-frames in the original AVI. Great for getting specific
61
+ clips out of a larger video and later doing I-frame moshing.
62
+ - `inspect` - Reads an .avi file and prints which video frames are keyframes
63
+ (I-Frames) and which frames are delta frames (P-frames or B-frames). moshy
64
+ cannot tell the difference between a P-frame or a B-frame, so you will want
65
+ to use avidemux or another program if you need to know.
66
+ - `pdupe` - Duplicates a P-frame at a given frame a certain amount. To find
67
+ out which frames are P-frames, use software like avidemux to look at the
68
+ frame type. WARNING: This mode is a little glitchy. You may need to set
69
+ the interval 1 or 2 above or below the frame number you actually want to
70
+ duplicate. I'm not sure why this happens, but try it with a small
71
+ duplication amount first. NOTE: This can mode take a while to process
72
+ over 60-90 frame dupes.
73
+ - `ppulse` - Takes c number of frames and every n frames and duplicates them a
74
+ given amount, resulting in a consistent P-duplication datamosh that's
75
+ good for creating rhythmic effects. This was originally created to
76
+ create mosh effects in sync with a beat for a music video.
77
+ - `bake` - "Bakes" your datamosh by creating a new video file from your
78
+ datamoshed .avi, causing the datamosh effects to be treated as the actual
79
+ content of the new video instead of an error. Requires ffmpeg to be
80
+ installed locally.
81
+
82
+ You can access detailed info on how to use each of them from the command line with
83
+ the command `moshy -m <mode> --help`.
84
+
85
+ ## Cool!
86
+
87
+ If you think this is cool, you'll probably find my list of [glitch art resources](http://www.glitchet.com/resources)
88
+ useful as well as the [Glitchet newsletter](http://www.glitchet.com/), a free weekly futuristic
89
+ news and glitch aesthetic e-zine.
90
+
91
+ ## Quick tutorial
92
+
93
+ Here's a short example of how you might use moshy to create a P-dupe mosh:
94
+
95
+ 1. Choose a YouTube video you want to mosh (I'll use "Charlie bit my finger": <https://www.youtube.com/watch?v=bnRVheEpJG4>)
96
+ 2. Download it with KeepVid (<http://keepvid.com/?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DbnRVheEpJG4>)
97
+ 3. "Prep" it with moshy to turn it into an .AVI with minimal I-Frames and all P-frames (because B-frames don't mosh well):
98
+ `moshy -m prep -i charlie.mp4 -o charlie.avi`
99
+ 4. Open charlie.avi in avidemux and clip it down to the segment I want (moshy will soon be able to do this with a "clip" command): ![](http://i.imgur.com/OBy8pbB.png)
100
+ 5. Open charlie_clip.avi and find the frame I want to P-dupe mosh (here, frame 196): ![](http://i.imgur.com/aZsZIx6.png)
101
+ 6. Use moshy in pdupe mode to dupe frame 196 60 times:
102
+ `moshy -m pdupe -i charlie_clip.avi -f 196 -d 60 -o charlie_clip-dupe.avi`
103
+ Open it in a video player (I use VLC) and see if it looks good.
104
+ 7. Awesome, I love it, but I want to clip it down to size. However, since it has so few I-frames, if I just clip it anywhere, the beginning of the video will become corrupted because of lack of pixel data. Let's use moshy to bake the mosh:
105
+ `moshy -m bake -i charlie_clip-dupe.avi -o charlie_clip-dupe-bake.avi`
106
+ 8. Done. Let's open it back up in avidemux, clip it down to size, and save our final result: ![](http://i.imgur.com/07abIqT.png)
107
+ 9. Looks good to me. Let's save it as an MP4 so that I can upload it to Giphy, which will convert it into a .gif for me. (I'm hoping to add modes to moshy that convert videos to .gif and .mp4 directly, too.)
108
+ 10. Done! ![](https://media.giphy.com/media/3o85xoWYyG1HEVs8Vy/giphy.gif)
109
+
110
+ ## Trouble?
111
+
112
+ Having issues? Please [file an issue](https://github.com/wayspurrchen/moshy/issues/new)!
data/Rakefile CHANGED
@@ -1,2 +1,2 @@
1
- require "bundler/gem_tasks"
2
-
1
+ require "bundler/gem_tasks"
2
+
data/bin/moshy CHANGED
@@ -1,105 +1,107 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'optparse'
4
- require 'slop'
5
- require 'moshy'
6
-
7
- module Moshy
8
- def self.top_level_help
9
- $options = {
10
-
11
- }
12
- opts = OptionParser.new do |opts|
13
- opts.banner = "
14
- moshy, a Ruby utility for making it easier to datamosh AVI files. It has
15
- multiple modes that can be run with the -m or --mode option.
16
-
17
- MODES DETAILS
18
- -------------
19
-
20
- \"prep\"
21
- ------
22
- Preps a video file for datamoshing with moshy by converting it
23
- into an AVI with no B-Frames (they're not good for moshing), and placing as
24
- few I-Frames as possible. Requires ffmpeg be installed locally.
25
-
26
- \"isplit\"
27
- --------
28
- Extracts individual clips from an AVI where each clip is
29
- separated by I-frames in the original AVI. Great for getting specific
30
- clips out of a larger video and later doing I-frame moshing.
31
-
32
- \"pdupe\"
33
- -------
34
- Duplicates a P-frame at a given frame a certain amount. To find
35
- out which frames are P-frames, use software like avidemux to look at the
36
- frame type. WARNING: This mode is a little glitchy. You may need to set
37
- the interval 1 or 2 above or below the frame number you actually want to
38
- duplicate. I'm not sure why this happens, but try it with a small
39
- duplication amount first. NOTE: This can mode take a while to process
40
- over 60-90 frame dupes.
41
-
42
- \"ppulse\"
43
- --------
44
- Takes c number of frames and every n frames and duplicates them a
45
- given amount, resulting in a consistent P-duplication datamosh that's
46
- good for creating rhythmic effects. This was originally created to
47
- create mosh effects in sync with a beat for a music video.
48
-
49
- \"bake\"
50
- ------
51
- \"Bakes\" your datamosh by creating a new video file from your
52
- datamoshed .avi, causing the datamosh effects to be treated as the actual
53
- content of the new video instead of an error. Requires ffmpeg to be
54
- installed locally.
55
-
56
- \"inspect\"
57
- ---------
58
- Reads an .avi file and prints which video frames are keyframes
59
- (I-Frames) and which frames are delta frames (P-frames or B-frames). moshy
60
- cannot tell the difference between a P-frame or a B-frame, so you will want
61
- to use avidemux or another program if you need to know.
62
-
63
- Run moshy with mode -m <mode> --help to see options for individual modes.
64
- "
65
- end
66
-
67
- begin
68
- opts.parse
69
- rescue OptionParser::InvalidOption, OptionParser::InvalidArgument
70
- end
71
-
72
- puts opts
73
- end
74
- end
75
-
76
- # Because we have multiple modes, we do some initial basic arg checking
77
- # to see if they specified a mode. If not, we show the top-level help menu.
78
- result = Slop.parse suppress_errors: true do |o|
79
- o.string '-m', '--mode'
80
- end
81
-
82
- mode_classes = {
83
- "inspect" => Moshy::Inspect,
84
- "isplit" => Moshy::ISplit,
85
- "pdupe" => Moshy::PDupe,
86
- "ppulse" => Moshy::PPulse,
87
- "prep" => Moshy::Prep,
88
- "bake" => Moshy::Bake
89
- }
90
-
91
- if mode_classes.has_key? result[:m]
92
- # We need to strip out the "m" otherwise our other arg parsers
93
- # will choke on the extra parameter
94
- ARGV.each_with_index do |o, i|
95
- if o == "-m" || o == "--m"
96
- ARGV.delete_at(i + 1)
97
- ARGV.delete_at(i)
98
- break
99
- end
100
- end
101
-
102
- mode_classes[result[:m]].new.cli ARGV
103
- else
104
- Moshy.top_level_help
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'optparse'
4
+ require 'slop'
5
+ require 'moshy'
6
+
7
+ module Moshy
8
+ def self.top_level_help
9
+ $options = {
10
+
11
+ }
12
+ opts = OptionParser.new do |opts|
13
+ opts.banner = "
14
+ moshy, a Ruby utility for making it easier to datamosh AVI files. It has
15
+ multiple modes that can be run with the -m or --mode option.
16
+
17
+ MODES DETAILS
18
+ -------------
19
+
20
+ \"prep\"
21
+ ------
22
+ Preps a video file for datamoshing with moshy by converting it
23
+ into an AVI with no B-Frames (they're not good for moshing), and placing as
24
+ few I-Frames as possible. Requires ffmpeg be installed locally.
25
+
26
+ \"isplit\"
27
+ --------
28
+ Extracts individual clips from an AVI where each clip is
29
+ separated by I-frames in the original AVI. Great for getting specific
30
+ clips out of a larger video and later doing I-frame moshing.
31
+
32
+ \"pdupe\"
33
+ -------
34
+ Duplicates a P-frame at a given frame a certain amount. To find
35
+ out which frames are P-frames, use software like avidemux to look at the
36
+ frame type. WARNING: This mode is a little glitchy. You may need to set
37
+ the interval 1 or 2 above or below the frame number you actually want to
38
+ duplicate. I'm not sure why this happens, but try it with a small
39
+ duplication amount first. NOTE: This can mode take a while to process
40
+ over 60-90 frame dupes.
41
+
42
+ \"ppulse\"
43
+ --------
44
+ Takes c number of frames and every n frames and duplicates them a
45
+ given amount, resulting in a consistent P-duplication datamosh that's
46
+ good for creating rhythmic effects. This was originally created to
47
+ create mosh effects in sync with a beat for a music video.
48
+
49
+ \"bake\"
50
+ ------
51
+ \"Bakes\" your datamosh by creating a new video file from your
52
+ datamoshed .avi, causing the datamosh effects to be treated as the actual
53
+ content of the new video instead of an error. Requires ffmpeg to be
54
+ installed locally.
55
+
56
+ \"inspect\"
57
+ ---------
58
+ Reads an .avi file and prints which video frames are keyframes
59
+ (I-Frames) and which frames are delta frames (P-frames or B-frames). moshy
60
+ cannot tell the difference between a P-frame or a B-frame, so you will want
61
+ to use avidemux or another program if you need to know.
62
+
63
+ Run moshy with mode -m <mode> --help to see options for individual modes.
64
+ "
65
+ end
66
+
67
+ begin
68
+ opts.parse
69
+ rescue OptionParser::InvalidOption, OptionParser::InvalidArgument
70
+ end
71
+
72
+ puts opts
73
+ end
74
+ end
75
+
76
+ # Because we have multiple modes, we do some initial basic arg checking
77
+ # to see if they specified a mode. If not, we show the top-level help menu.
78
+ result = Slop.parse suppress_errors: true do |o|
79
+ o.string '-m', '--mode'
80
+ end
81
+
82
+ puts result
83
+
84
+ mode_classes = {
85
+ "inspect" => Moshy::Inspect,
86
+ "isplit" => Moshy::ISplit,
87
+ "pdupe" => Moshy::PDupe,
88
+ "ppulse" => Moshy::PPulse,
89
+ "prep" => Moshy::Prep,
90
+ "bake" => Moshy::Bake
91
+ }
92
+
93
+ if mode_classes.has_key? result[:m]
94
+ # We need to strip out the "m" otherwise our other arg parsers
95
+ # will choke on the extra parameter
96
+ ARGV.each_with_index do |o, i|
97
+ if o == "-m" || o == "--m"
98
+ ARGV.delete_at(i + 1)
99
+ ARGV.delete_at(i)
100
+ break
101
+ end
102
+ end
103
+
104
+ mode_classes[result[:m]].new.cli ARGV
105
+ else
106
+ Moshy.top_level_help
105
107
  end