{"id":1407,"date":"2014-09-09T12:50:27","date_gmt":"2014-09-09T11:50:27","guid":{"rendered":"http:\/\/johnjohnston.info\/106\/?p=1407"},"modified":"2014-09-09T12:58:30","modified_gmt":"2014-09-09T11:58:30","slug":"and-all-the-pieces-matter","status":"publish","type":"post","link":"https:\/\/johnjohnston.info\/106\/and-all-the-pieces-matter\/","title":{"rendered":"and all the pieces matter"},"content":{"rendered":"<figure id=\"attachment_1408\" aria-describedby=\"caption-attachment-1408\" style=\"width: 500px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-1408 size-full\" src=\"https:\/\/johnjohnston.info\/106\/wp-content\/uploads\/2014\/09\/and-all-the-pieces-matter.gif\" alt=\"and-all-the-pieces-matter\" width=\"500\" height=\"375\" \/><figcaption id=\"caption-attachment-1408\" class=\"wp-caption-text\">Gif using gifboard<\/figcaption><\/figure>\n<p>This is a quick intro to installing videogrep.py a tool for making supercut movies. Written in haste, consider it a rough draft.<\/p>\n<p>Videogrep is a python program run from the command line. This is quite different from using applications with a GUI. I am hoping to write up a few different tools I use for playing DS106 and will try and come back and expand on this.<\/p>\n<p>More about <a href=\"http:\/\/lav.io\/2014\/06\/videogrep-automatic-supercuts-with-python\">Videogrep: Automatic Supercuts with Python \u2013 Sam Lavigne<\/a>.<\/p>\n<p>Code: <a href=\"https:\/\/github.com\/antiboredom\/videogrep\">antiboredom\/videogrep \u00b7 GitHub<\/a>.<\/p>\n<h3 id=\"caveats\">Caveats<\/h3>\n<ul>\n<li>I am no expert in using the command line. I\u2019ve failed on quite a few attempts at installing.<\/li>\n<li>As with a lot of software you can make mistakes, bad things can happen. You will be giving the software author control over your computer.<\/li>\n<li>I am using Mac OS X<\/li>\n<li>There is not a lot of detail here, I\u2019ll come back and improve if it seems useful.<\/li>\n<li>It is probably sensible to read all of the linked pages here rather than just go on trust.<\/li>\n<\/ul>\n<h3 id=\"dependencies\">Dependencies<\/h3>\n<p>Videogrep depends on a few python modules and programs. These are installed with pip (A tool for installing and managing Python packages) which you may need to install.<\/p>\n<p>You also need to install <a href=\"https:\/\/www.ffmpeg.org\">FFMPEG<\/a> (FFmpeg is a free software project that produces libraries and programs for handling multimedia data. ). One way to install FFmpg is with homebrew, which you need to install first!<\/p>\n<h3 id=\"homebrew_and_ffmpeg\">Homebrew and ffmpeg<\/h3>\n<p><a href=\"http:\/\/brew.sh\/\">Homebrew<\/a>, is a package manager it is installed and used via the commandline so you will need to open the terminal app.<\/p>\n<p>You run stuff in the terminal by typing (or pasting) after the <em>prompt<\/em> my prompt is <em>johnj:~ john$<\/em> if I am in my home directory which is called johnj<\/p>\n<p>On the <a href=\"http:\/\/brew.sh\/\">Homebrew<\/a> site you can copy a line of text which if pasted into the terminal will install homebrew when you press return. I\u2019d go to the site and copy from there rather than from here.<\/p>\n<pre><code>ruby -e \"$(curl -fsSL https:\/\/raw.github.com\/Homebrew\/homebrew\/go\/install)\"\r\n<\/code><\/pre>\n<p><em>The script explains what it will do and then pauses before it does it.<\/em><\/p>\n<p>Once the script has finished it will recommend running:<\/p>\n<pre><code>brew doctor\r\n<\/code><\/pre>\n<p>To check all is ok, so type that and hit return, wait a while and the prompt returns. you can now install FFmpeg. The videogrep notes suggest you do with this:<\/p>\n<pre><code>brew install ffmpeg --with-libvpx --with-libvorbis\r\n<\/code><\/pre>\n<p>So try that, type it in at the prompt in the terminal, lots of text should stream by, by the time it stops FFmpeg should be installed. You can check by typing<\/p>\n<p>ffmpeg -h<\/p>\n<p>Which will display the help.<\/p>\n<h3 id=\"pip\">pip<\/h3>\n<p>Next you want to install pip, which lets you install other stuff. Again at the prompt type:<\/p>\n<pre><code>easy_install pip\r\n<\/code><\/pre>\n<p>Some text will go by and the prompt should come back.<\/p>\n<h3 id=\"videogrep\">Videogrep<\/h3>\n<p>Finally<\/p>\n<p>Down load the zip file from <a href=\"https:\/\/github.com\/antiboredom\/videogrep\">antiboredom\/videogrep \u00b7 GitHub<\/a> unzip and put it somewhere handy, your desktop folder for example.<\/p>\n<p>The folder is called \u2018videogrep-master\u2019 I\u2019ve just left it as that.<\/p>\n<p>Inside the folder is a txt file requirements.txt this lists the python modules that you need to install, you don\u2019t need to open it. Back in the terminal, cd into the videogrep folder:<\/p>\n<pre><code>cd path\/to\/folder\r\n<\/code><\/pre>\n<p>to do that type cd at the prompt and drag the folder into the terminal window, I see:<\/p>\n<pre><code>johnj john$ cd \/Users\/john\/Desktop\/videogrep-master\r\n<\/code><\/pre>\n<p>hit return and type:<\/p>\n<pre><code>pip install -r requirements.txt\r\n<\/code><\/pre>\n<p>and return again a ton of text will scroll past as past.<\/p>\n<p>At the end, unless you have errors you are ready to go.<\/p>\n<h3 id=\"first_cut\">First cut<\/h3>\n<p>You need a video file and an srt file to match, there names must be the same except for the extension, eg:<\/p>\n<ul>\n<li>The Wire Season 1 Episode 06 &#8211; The Wire.avi<\/li>\n<li>The Wire Season 1 Episode 06 &#8211; The Wire.srt<\/li>\n<\/ul>\n<p>If you followed the above steps your prompt should show you are in the videogrep-master folder:<\/p>\n<pre><code>johnj:videogrep-master john$\r\n<\/code><\/pre>\n<p>type:<\/p>\n<pre><code>python videogrep.py --input path\/to\/srt file  --search pieces --output pieces.mp4\r\n<\/code><\/pre>\n<p>more text scrolls past the terminal. A video pieces.mp4 appears in the folder, it is the supercut video.<\/p>\n<p>&nbsp;<\/p>\n<div style=\"width: 480px;\" class=\"wp-video\"><!--[if lt IE 9]><script>document.createElement('video');<\/script><![endif]-->\n<video class=\"wp-video-shortcode\" id=\"video-1407-1\" width=\"480\" height=\"320\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"http:\/\/johnjohnston.info\/106\/wp-content\/uploads\/2014\/09\/pieces.iphone.mp4?_=1\" \/><a href=\"http:\/\/johnjohnston.info\/106\/wp-content\/uploads\/2014\/09\/pieces.iphone.mp4\">http:\/\/johnjohnston.info\/106\/wp-content\/uploads\/2014\/09\/pieces.iphone.mp4<\/a><\/video><\/div>\n<h3 id=\"problems_along_the_way\">Problems along the way<\/h3>\n<p>I had a couple, first in installing the requirments.txt I kept getting errors about pattern. To solve this I went to <a href=\"http:\/\/www.clips.ua.ac.be\/pattern\">pattern<\/a>, downloaded pattern and installed it. I then removed that line from requirments.txt and saved it before running <em>pip install -r requirements.txt<\/em> again.<\/p>\n<p>The second problem I had was the movies created had no sound. I didn\u2019t fix that, I just used <a title=\"Miro Video Converter FREE - Convert any video to MP4, WebM (vp8), iPhone, Android, iPod, iPad, and more.\" href=\"http:\/\/www.mirovideoconverter.com\">miro video converter<\/a> to convert the files to apple or iphone ones which did the trick. I am guessing this could have been fixed with ffmpeg too as miro video converter is, as far as I know, a gui for ffmpeg.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is a quick intro to installing videogrep.py a tool for making supercut movies. Written in haste, consider it a rough draft. Videogrep is a python program run from the command line. This is quite different from using applications with a GUI. I am hoping to write up a few different tools I use for &hellip; <a href=\"https:\/\/johnjohnston.info\/106\/and-all-the-pieces-matter\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;and all the pieces matter&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[91,113],"tags":[162,161,160],"class_list":["post-1407","post","type-post","status-publish","format-standard","hentry","category-mashup","category-tutorial","tag-commandline","tag-python","tag-videogrep"],"better_featured_image":null,"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p3RLlC-mH","_links":{"self":[{"href":"https:\/\/johnjohnston.info\/106\/wp-json\/wp\/v2\/posts\/1407","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/johnjohnston.info\/106\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/johnjohnston.info\/106\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/johnjohnston.info\/106\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/johnjohnston.info\/106\/wp-json\/wp\/v2\/comments?post=1407"}],"version-history":[{"count":3,"href":"https:\/\/johnjohnston.info\/106\/wp-json\/wp\/v2\/posts\/1407\/revisions"}],"predecessor-version":[{"id":1412,"href":"https:\/\/johnjohnston.info\/106\/wp-json\/wp\/v2\/posts\/1407\/revisions\/1412"}],"wp:attachment":[{"href":"https:\/\/johnjohnston.info\/106\/wp-json\/wp\/v2\/media?parent=1407"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/johnjohnston.info\/106\/wp-json\/wp\/v2\/categories?post=1407"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/johnjohnston.info\/106\/wp-json\/wp\/v2\/tags?post=1407"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}