Character Cutting

So Burtus was on my case pretty fast last week, trying to get a fix on me. I guess I didn’t drop enough clues. The deal was I should reveal some history, some of my favorite places, that might have given her a clue. For the folk less agile that Burtus, I’ll spell it out. I’ve been down south where the sky ain’t sentimental. I ran into a bit of bother, nothing I couldn’t handle.

Anyhow I was intrigued enough to listen to the second message on my machine. When you have more than one client things can get tricky, and this is tricky times four.

This week Groom seems to be sucking up to Burtus big time.

I saw a couple of Burtus other performances too (here and here). She is trying to come over cashmere, soften the message a bit, but she is still all steel. Wants everything her way, reports for Sunday night.

All 4 of the clients are demanding, well they can keep that up, I’ll steer my own course through this business.

Another familiar face showed up here last week. Quite a character for such a sweet face. Worth keeping you eye on Tina if you are in this game.

So, among this week’s unreasonable demands was instructions to dig into some character. I started leafing through some old cases. I got interested in Frank Bigelow, but that turned into a wild goose chase.

The Words and pictures just didn’t line up. I dived back into the files. I was looking for words and pictures at the right time and struck gold:

You can tell a lot about a character from watching others talk about them. These guys are pieces of work.

Supercut note: srt files don’t always line up with the video. I tried a couple of apps to adjust and match srts I downloaded to go with D.O.A. They didn’t work. SubShifter – Online SRT Subtitle Resync Tool looks promising for another time.

Schooling the Wire

Three SuperCut videos from season 4 of the wire on the words, school, schooled and schooling after a prompt from Jim Groom. Made with videogrep.py

I was surprised at how few times schooled or schooling were used.

Supercut videos are a nice way of looking at this sort of stuff but you can get a quick idea of the use of words by finding them in the subtitle (.srt) files.

For example I downloaded season 4 subtitles from The Wire S04(Season 4) english subtitles – TVsubs.net. This gives several versions of the files. I found before that the DVDRip.TOPAZ.en.srt ones work best for me. I’ve put them in the same folder as my wire episodes and renamed them to match these files.

I open the terminal and type cd then drag the folder from the finder into the terminal window and hit return. This moves me into the folder.

I then grep -e 'school ' *.srt which outputs a list of the episodes with school in the subtitles and the line:

The Wire Season 4 Episode 01 - Boys of Summer.srt:for some back-to-school stuff.
The Wire Season 4 Episode 01 - Boys of Summer.srt:back-to-school stuff for?
The Wire Season 4 Episode 01 - Boys of Summer.srt:When school start, I'll be selling it
The Wire Season 4 Episode 02 - Soft Eyes.srt:for your school clothes,
The Wire Season 4 Episode 02 - Soft Eyes.srt:your school shit, man.
The Wire Season 4 Episode 02 - Soft Eyes.srt:I can't wait until school starts.
The Wire Season 4 Episode 02 - Soft Eyes.srt:of school coming up, right?
The Wire Season 4 Episode 02 - Soft Eyes.srt:- Y'all need school clothes and shit?
The Wire Season 4 Episode 02 - Soft Eyes.srt:to buy school clothes with.
The Wire Season 4 Episode 02 - Soft Eyes.srt:to school some.
The Wire Season 4 Episode 02 - Soft Eyes.srt:to that school lookin'
The Wire Season 4 Episode 03 - Home Rooms.srt:do you want to go to school for?
The Wire Season 4 Episode 04 - Refugees.srt:For school or out the business,
The Wire Season 4 Episode 04 - Refugees.srt:to start out a school year,
The Wire Season 4 Episode 04 - Refugees.srt:school on Friday,
The Wire Season 4 Episode 04 - Refugees.srt:school you, brother.
The Wire Season 4 Episode 05 - Alliances.srt:ain't in school tomorrow morning,
The Wire Season 4 Episode 05 - Alliances.srt:take him in, school him,
The Wire Season 4 Episode 06 - Margin of Error.srt:- High-school biology.
The Wire Season 4 Episode 06 - Margin of Error.srt:Ain't no school today.
The Wire Season 4 Episode 07 - Unto Others.srt:Does the school have
The Wire Season 4 Episode 07 - Unto Others.srt:creep out of school after lunch.
The Wire Season 4 Episode 07 - Unto Others.srt:He's got to be at school in the morning.
The Wire Season 4 Episode 08 - Corner Boys.srt:the word around school is
The Wire Season 4 Episode 08 - Corner Boys.srt:the school or not.
The Wire Season 4 Episode 09 - Know Your Place.srt:after school lets out--
The Wire Season 4 Episode 09 - Know Your Place.srt:to the school social worker.
The Wire Season 4 Episode 10 - Misgivings.srt:I'll get the school police.
The Wire Season 4 Episode 10 - Misgivings.srt:of the school year,
The Wire Season 4 Episode 11 - A New Day.srt:front of the school today,
The Wire Season 4 Episode 11 - A New Day.srt:at school 45,
The Wire Season 4 Episode 11 - A New Day.srt:school 52, and school 58
The Wire Season 4 Episode 11 - A New Day.srt:- The school audit.
The Wire Season 4 Episode 12 - That's Got His Own.srt:when I look at the school budget.
The Wire Season 4 Episode 12 - That's Got His Own.srt:for the school budget.
The Wire Season 4 Episode 12 - That's Got His Own.srt:with the school board itself.
The Wire Season 4 Episode 12 - That's Got His Own.srt:is on the school system.
The Wire Season 4 Episode 12 - That's Got His Own.srt:As president of the school board,
The Wire Season 4 Episode 12 - That's Got His Own.srt:not the school board,
The Wire Season 4 Episode 12 - That's Got His Own.srt:- to go see the school superintendent.
The Wire Season 4 Episode 12 - That's Got His Own.srt:the Baltimore school system's
The Wire Season 4 Episode 12 - That's Got His Own.srt:middle school no more.
The Wire Season 4 Episode 12 - That's Got His Own.srt:no school closures.
The Wire Season 4 Episode 12 - That's Got His Own.srt:over the school board
The Wire Season 4 Episode 13 - Final Grades.srt:It knocks the school deficit
The Wire Season 4 Episode 13 - Final Grades.srt:your school system."
The Wire Season 4 Episode 13 - Final Grades.srt:I went to school here

Where as schooling:


01 - Boys of Summer.srt:So... he was schooling me.
07 - Unto Others.srt:Don't be schooling us now.
08 - Corner Boys.srt:we schooling them.

Only has 3 mentions as does schooled


01 - Boys of Summer.srt:You laughing. I've been schooled, dog.
09 - Know Your Place.srt:You schooled me good.
10 - Misgivings.srt:- You schooled them well.

If you just want the number of mentions:
grep -e 'school ' *.srt | wc -l
outputs 45.

I am sure lots of ds106 students can thing of some other useful and interesting ways to use this.

all in the game

Wire Characters Season 1

My last couple of posts have been about using and setting up videogrep.py.

Videogrep is a python script that searches through dialog in videos and then cuts together a new video based on what it finds. Basically, it’s a command-line “supercut” generator.

I’ve been thinking about how to use it, especially since Jim Groom gave it a rousing reception( Wiring Supercuts & The Game Supercut ).

I’ve always liked the suspect board on the wire, where the detectives pin up pictures of suspects in a mindmap fashion, and wondered if I could make a board with Supercut videos of the characters. Turns out I can: Wire Characters Season 1.

A man must have a code

The Wire Season 1 Episode 07   one Arrest

First thing I had to do was make the supercuts, I just used the method described in the previous post, with one wrinkle. Some of the characters are refered to by more than one name, some times Kima is Greggs, I wanted to catch all of the references. It turns out that the default search for videogrep is a regular expression. Now I don’t know much (anything) about regEx, but a quick google game me the pipe character as OR, so:

python ../videogrep.py -i /Users/john/Movies/The\ Wire/Season\ 1 -s 'Kima|Greggs' -o Kima.mp4

Gets clips with either Kima or Greggs in the subtitles.

I then convert the mp4 files with miro video converter, using iphone as the setting, this lets me hear the clips which lose sound on my system. I open the output movies with QuickTime Pro find a still and hit copy. Switch to Fireworks and paste into a new document, save as a jpge with the same name as the video apart from the file extension.

I’ve now got a folder full of movies and images and just need a html file to display them.

I wanted to do a few things with the display of the videos, I wanted them to be is some sort of disarray as if pinned on, not all lined up. I also was making this in between all of the supercutting. This lead me to put the videos on the page with Javascript rather than hard coding all the tags. If you are really interested you can view the code on the page, I’ll just blog a few concepts here. I did hardcode an array of the names, without the file extensions and a matching one with the character names. It was them easy to loop through these arrays creating video elements and populating them with the video source and the jpg images as posters.

The CSS gives the div wrapping the video a white background and a drop shadow, some javascript rotates the divs (JavaScript Rotate | KaisarCode) and randomised the margins between them and the white border width.

I also used the javascript to scale down the video to fit more across the page and css to set the page width to 1600 pixels (side scroll I am afraid).

when it’s not your turn

I also missed a few things out.

  • The files are big, converting them with miro made them bigger, I guess I could use ffmpeg to do a better job of that, I could also scale them down to the size they are displayed.
  • The videos do not play in Firefox on a mac, firefox does not support the video format in the video tag. I had a very quick try using mediaelement.js to add flash for firefox but it looked like it would be too much work to display properly. I could also convert all the files to ogg for firefox, I might try that in combonation with scaleing them down a bit at a later date.

Update: I’ve run all the videos first throught te commandline ffmpg to downsize them to 360×240 and then ffmpeg2theora to create ogg versions.

Dope on the damn table

So while some of this has been for self education around javascript and css there are a few ds106 style things that spring to mind from the exercise.

The supercuts get the parts of the video where a character is mentions, sometimes this is never when they are on screen. I had to use other parts of the movie to get posters for some characters. The supercuts let you focus on the character from other characters points of view and the POV of the writers and directors. Some characters I love and feel are important are not refered to much by name, the video file sizes gives a view of this, Ellis Carver’s video is tiny (I love how his character in season 1 hints of his growth during the wire as a whole).

Although I’ve now watched most of season 1 (third time round) I’ve struggled to watch with a critical eye, or even an eye to a gif, the programme is too absorbing and emotionally involving. It has reinforced the series as my favourite tv. I am especially noticing the parts when charcters show complexity beyond normal tv. Kima, presented very positivly, leads the charge to kick and beat a youth that hits the rather usless police Pogue (or Mahone). The emotion showed by the character at the end of episode 10 and the beginning of 11 is viceral, rewatching brings back the shock from the first viewing in a suprisingly powerful way.

Watching the supercuts allows you to step back a bit, pulls information about a character together in a suprising way letting you see the character and how their story is told in new light.

and all the pieces matter

and-all-the-pieces-matter
Gif using gifboard

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 playing DS106 and will try and come back and expand on this.

More about Videogrep: Automatic Supercuts with Python – Sam Lavigne.

Code: antiboredom/videogrep · GitHub.

Caveats

  • I am no expert in using the command line. I’ve failed on quite a few attempts at installing.
  • 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.
  • I am using Mac OS X
  • There is not a lot of detail here, I’ll come back and improve if it seems useful.
  • It is probably sensible to read all of the linked pages here rather than just go on trust.

Dependencies

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.

You also need to install FFMPEG (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!

Homebrew and ffmpeg

Homebrew, is a package manager it is installed and used via the commandline so you will need to open the terminal app.

You run stuff in the terminal by typing (or pasting) after the prompt my prompt is johnj:~ john$ if I am in my home directory which is called johnj

On the Homebrew site you can copy a line of text which if pasted into the terminal will install homebrew when you press return. I’d go to the site and copy from there rather than from here.

ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"

The script explains what it will do and then pauses before it does it.

Once the script has finished it will recommend running:

brew doctor

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:

brew install ffmpeg --with-libvpx --with-libvorbis

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

ffmpeg -h

Which will display the help.

pip

Next you want to install pip, which lets you install other stuff. Again at the prompt type:

easy_install pip

Some text will go by and the prompt should come back.

Videogrep

Finally

Down load the zip file from antiboredom/videogrep · GitHub unzip and put it somewhere handy, your desktop folder for example.

The folder is called ‘videogrep-master’ I’ve just left it as that.

Inside the folder is a txt file requirements.txt this lists the python modules that you need to install, you don’t need to open it. Back in the terminal, cd into the videogrep folder:

cd path/to/folder

to do that type cd at the prompt and drag the folder into the terminal window, I see:

johnj john$ cd /Users/john/Desktop/videogrep-master

hit return and type:

pip install -r requirements.txt

and return again a ton of text will scroll past as past.

At the end, unless you have errors you are ready to go.

First cut

You need a video file and an srt file to match, there names must be the same except for the extension, eg:

  • The Wire Season 1 Episode 06 – The Wire.avi
  • The Wire Season 1 Episode 06 – The Wire.srt

If you followed the above steps your prompt should show you are in the videogrep-master folder:

johnj:videogrep-master john$

type:

python videogrep.py --input path/to/srt file  --search pieces --output pieces.mp4

more text scrolls past the terminal. A video pieces.mp4 appears in the folder, it is the supercut video.

 

Problems along the way

I had a couple, first in installing the requirments.txt I kept getting errors about pattern. To solve this I went to pattern, downloaded pattern and installed it. I then removed that line from requirments.txt and saved it before running pip install -r requirements.txt again.

The second problem I had was the movies created had no sound. I didn’t fix that, I just used miro video converter 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.