Contact Mr. Bethel

Email: misterbethel@gmail.com

Announcements

Calendar

Recent Wiki Changes

Recently Changed Pages
September 18th
September 15th
September 15th

Check Your Grades Here!!

Click the assignment name to see your grades and/or to see if i've received your work

 

Web Video Using the Command Line

Intro to the command line. Yes you heard that right. You cant get anywhere on the web without being able to use BASh. BASh stands for Born Again Shell. A shell is another term for the command-line interface in many Unix based operating systems. For all intensive purposes, this provides users with a quick way to execute complex tasks, or strings of tasks that can be done by typing, or copy/pasting more often than not, a line of text. Since we've been talking about video recently, we're going to learn how to convert video for the web this way. There are plenty of other ways, many with their own faults, to convert a video, but this is one of the easiest and most straightforward ways to do it.

Here goes...

On the command line the syntax is usually this:

nameofcommand -o --long-option whatgetsthecommand

For example, if you wanted to use a very famous command line program called WGET to download a file you would type:

wget misterbethel.com/custom_content/turkey_pardon.mp4

Now the video will download to the computer in the directory you started out at. It will be in your home folder. We'll use this video that you just downloaded. The linux CLI (command line interface) program most often used to convert videos is called ffmpeg. You use it by calling (aka typing) ffmpeg into BASh along with where the video is you want to convert where you want the new one to wind up and all the options you want to add to the new video. The options can get to be very long and complex, fortunately there are a bunch of variations already built that will do the job we need in a much more sane manner. As a quick summary of a very very long topic, here is what you generally need to make sure a video works on every computer and device out there.

For starters:

--a version in .mp4, this works in most browsers, but NOT Firefox.

--For Firefox, you need a .ogv.

--You should also have a version in .webm which is a new (as of 11/11) format that is optimized especially for the web, unfortunately older browsers (i’m talking to you Internet Explorer) don’t support it.

--Lastly, you SHOULD have a version that uses a Flash plugin as well. I don’t. I think that we’re past this point and if one of the above doesn’t work, it is deserving that you get a warning that you’re browser is missing out on some new features that are now standard. I’ll get to this later. So we’re gonna skip anything Flash.

Onward! I need to give credit where credit is due. This next section is borrowed heavily from the fantastic tutorial by Mark Pilgrim. We’re going to use the CLI version of ffmpeg called ffmpeg2theora. You can get it from their site, or download it via Software Center on Ubuntu. Anyway, since we’re starting with an .mp4 let’s start with .ogv.

Open Terminal and type:

ffmpeg2theora turkey_pardon.mp4

 You should now have a file called turkey_pardon.ogv in your home folder. Next, lets make a .webm.

You should now have two videos in your home folder. Let’s add them to a webpage using only html5. Code:

<video controls>
<source src=”turkey_pardon.mp4”></source>
<source src=”turkey_pardon.ogv”></source>
</video>
There you have it...a working web video without too much hassle. Just kidding that was a pain in the ass.