muvy-header

muvy is a simple Ruby movie barcode generator.
You can feed it a youtube video, phone gallery, or any locally stored video files. It pulls most of the frames out, moves around the colors, and throws them back together in a neat montage.


Install

Notes

Getting Started

macOS

You can use ffmpeg -v, convert -v, or youtube-dl --version at the terminal to check if you already have the binaries.

If you don't already have FFmpeg, ImageMagick, or youtube-dl installed, you can download all of them with Homebrew. With Homebrew, just bring up a terminal session and type:

$ brew install ffmpeg
$ brew install imagemagick
$ brew install youtube-dl
$ gem install muvy

Windows

  1. You can download Ruby here.
  2. You can download Windows binaries for ImageMagick here, noting:
    On the third installation window, you need to check 2 boxes:
    • [x] Add application directory to your system path
    • [x] Install legacy utilities (e.g. convert)
    • [ ] Keep 'Install FFmpeg' unchecked - IM's bundle doesn't include ffprobe & ffplay
  3. Grab FFmpeg here.
  4. You'll have to manually edit your PATH environment variable like in this tutorial. Once you set up FFmpeg in the PATH, you need to move the ImageMagick folder from 'User Variables' to the first entry in the 'System Variables' PATH variable so that Windows prefers ImageMagick convert over its own 'convert.exe'. Here's an image showing that process.
    ImageMagick 7 replaced convert with magick on Windows, but this gem can't make use of that yet.
  5. Get youtube-dl here.
  6. Then, you can install any gem like so:
    sh $ gem install muvy

Usage

Basics

Type Command: muvy [Type] [Options] Support
URL muvy https://youtube.com/someVidID youtube-dl sites, but most fail
Local muvy /Documents/Fave-Films/movie.mp4 FFmpeg supported formats
Folder muvy /Downloads/Phone-Backup-1/Photos ImageMagick supported formats

Options

-p, --path

Optionally specify the path where your final image will be saved.
Default: your present working directory

-s, --style

Optionally specify currently supported styles: solid, stretch.
Default: solid

-g, --gradient

Optionally add a gradient on top of the final image. You can choose one:

black:heavy black:medium black:light
white:heavy white:medium white:light

Default: none

--arc

Pass --arc to wrap all of the lines around a center point. See examples

--rotate

Pass --rotate to rotate the final image 90 degrees, i.e. to draw horizontal lines, where the top is the 'start' of your media file.

-h, --height

Optionally specify a custom height for the output image.

--format

Optionally force the download quality for youtube-dl.
This command is currently best-suited to youtube. To see possible formats for other sites, type youtube-dl -F <URL> or see youtube-dl docs on format selection; however, even when specifying a suitable format, the script might fail to run.
This determines the height of your image when using -s stretch only if you didn't specify --height.
Default: 135 (854x480 DASH at 24fps).

--frame_rate

Optionally specify the amount of frames to extract per second from the media.
This determines the width of the image.

You should run muvy [..] without this option once and check the stats printout to get an idea of a better number.
For example, if the stats printout readsM "1.6 fps," passing --frame_rate 3.2 would double the amount of frames, lines, and subsequently the width.

Setting this to an unreasonable number might cause hundreds of thousands of files to be temporarily created in your system's temp files.

--start and --end

Optionally specify starting and ending times for processing videos.
If you only specify one, the other will default (e.g. if you only give --end, start -> 0).

Features

  • Formats
    • [x] Accepts image galleries, local videos, and online videos
    • [ ] Works with any youtube-dl supported site
    • [x] Specify start & end times for frame extraction
    • [ ] Accept music files
    • [ ] Generate audio waveforms
    • [ ] Randomize waveform colors
  • Image Output
    • [x] Vertical lines
    • [x] Horizontal lines
    • [x] 'Stretched' output, taking average of each line of pixels
    • [x] Arc distortion
    • [ ] Spotmap output, akin to 'QR' code
    • [ ] Slit scan output
    • [ ] 'Bedforms' output
    • [ ] Stacked lines output, inspired by Sol Lewitt's work
    • [ ] Choose inset borders
    • [ ] Curvature
    • [ ] Crosshatch lines output
  • Image adjustments
    • [x] Fade to black or white on edges
    • [ ] Pixel thickness control
    • [ ] Colorspace changes
  • Generation
    • [ ] Dominant color algorithms
    • [ ] via ImageMagick histograms
    • [ ] via k-means clustering
  • Compatibility
    • [ ] Use popen3 since current gem wrappers are outdated (TODO)

Examples

Films

Spirited Away (2001)

`muvy film.mkv -h 300` 0.27 frames per second on 125 minutes final resolution 2027x300



Mad Max: Fury Road (2015)

`muvy madden.mkv --end 01:52:50 -h 300` 0.276 frames per second on 120 minutes final resolution 1868x300



The Grand Budapest Hotel (2014)

`muvy "grand.avi" --end 01:33:40 --gradient black:medium --height 600` 0.303 frames per second on 100 minutes final resolution 1703x600



Her (2013)

`muvy film.mp4 -g black:medium -h 720` 0.269 frames per second on 126 minutes final resolution 1919x720



Melancholia (2011)

`muvy film.mp4 --gradient black:medium` 0.277 frames per second on 136 minutes final resolution 2158x720



Kagemusha (1980)

`muvy film.mp4 --style stretch --gradient black:medium` 0.225 frames per second on 162 minutes final resolution 2439x688



Samsara (2011)

(1) `muvy film.avi --end 01:35:00 -s stretch -g black:medium` (2) `muvy "Samsara 2011 BRRip XviD AC3 - HDSi.avi" --height 150 --end 01:35:00` 0.3 frames per second on 95 minutes



Baraka (1992)

`muvy film.avi --height 150 --end 01:30:30` 0.3 frames per second on 90 minutes final resolution 1663x150



It's Such A Beautiful Day (2012)

`muvy film.mkv --height 200` 0.4843 frames per second on 62 minutes final resolution 1780x720



YouTube

Holi by Variable

`muvy https://www.youtube.com/watch?v=r64Xk7c4Mr4 --frame_rate 10 --style stretch` slow-motion youtube video 10 frames per second on 1 minute 47 seconds final resolution 1073x480



Mahalia - Sober by COLORS

(1) `muvy https://www.youtube.com/watch?v=QK7JQl9jNzM --frame_rate 7.5 --start 0:05 --end 3:23 -h 200` (2) `muvy https://www.youtube.com/watch?v=QK7JQl9jNzM --frame_rate 7.5 --start 0:05 --end 3:23 -s stretch` 7.5 frames per second on 3 minutes 36 seconds



The Banach–Tarski Paradox by Vsauce

`muvy https://www.youtube.com/watch?v=s86-Z-CbaHA` 0.62 frames per second on 24 minutes 14 seconds final resolution 898x720



Colors In Macro by Macro Room

`muvy https://www.youtube.com/watch?v=gNbSjMFd7j4 --start 0:16 --end 2:07 --style stretch --frame_rate 10` 10 frames per second on ~ 2 minutes final resolution 1110x480



Ink In Motion by Macro Room

(1) `muvy https://www.youtube.com/watch?v=BmBh0NNEm00 --start 0:37 --end 1:20 --frame_rate 10 -r -s stretch` (2) `muvy https://www.youtube.com/watch?v=BmBh0NNEm00 --start 0:37 --end 1:20 --frame_rate 10 -r --arc`



BBC Planet Earth II Episode 1

`muvy episode.mp4 --arc -g black:light` 0.413 frames per second on 58 minutes final resolution 1176x1176

Speed Drawing

`muvy https://www.youtube.com/watch?v=P3UozWhL6A0 --start 0:04 --end 04:45 --arc` 1.7185 frames per second final resolution 872x872



DCIM

TODO

Troubleshooting

Make sure you can access ffmpeg -v, magick -v, and youtube-dl --version on the command line. If you can't, you likely have to update your existing PATH environment variable to include the folder holding the relevant binaries. If you're on Windows and you are unsure how to add FFmpeg to path, you can try any of these links: 1, 2, 3.

If you're on Windows and very recently made changes, you probably have to reopen a command prompt window or restart for those changes to take effect.

You might also want to update all three binaries.

If it's not working out, I've linked more generators and methods that you can try out, most of them depending on some combination of ffmpeg and ImageMagick.