Life of a Geek Admin

The Daily adventures of a true geek administrator

Life of a Geek Admin - The Daily adventures of a true geek administrator

Downloading YouTube Videos and Extracting Audio on Ubuntu

Have you ever had a YouTube video that you just wanted to have on your PC in-case you were not online to watch it or you wanted the audio extracted from one of those videos to listen to on your PC or iPod? With Firefox addons  that is a reality. I had a friend who had found a very, very old German song and found it on YouTube put to a slideshow and was asked how to download the video and extract the audio. This can be done in two steps very easy.

First download the Firefox addon called Fast Video Download. It is available here https://addons.mozilla.org/en-US/firefox/addon/3590. Install the addon and restart Firefox. Once restarted you will see a little icon in the top right portion of the toolbar or the bottom right corner.

Next make sure you have the correct programs for the audio extraction. This is primarily done with ffmpeg and a few supporting actors.
$ sudo apt-get install ffmpeg gstreamer0.10-ffmpeg gstreamer0.10-ugly-multiverse
mpg123 mpg123-alsa

At the command line type
$ ffmpeg -i input.flv -acodec copy output.mp3

And in seconds you have music to listen to!!!

If you want more information on the use of ffmpeg go to http://www.ffmpeg.org.

Epson 4490 Photo scanner Ubuntu

The Epson Perfection 4490 Photo scanner is not supported in Ubuntu by sane. To get the scanner to work in Ubuntu you must download and install third party software. This how to describes how I was able to install it on Ubuntu Karmic 9.10 64-bit.

  1. Install libsane-extras (sudo apt-get install libsane-extras)
  2. Edit /etc/sane.d/dll.conf and uncomment epson2 if it is not done already.
  3. Go to http://www.sane-project.org/lists/sa…-external.html
  4. Scroll down and find “Perfection 4490 PHOTO” and click on the link and you’ll be redirected to Avasys http://www.avasys.jp/lx-bin2/linux_e/scan/DL1.do
  5. Fill in the form and download iscan_2.24.0-4.ltdl7_amd64.deb iscan-plugin-gt-x750_2.1.0-5_amd64.deb for 64 bit Ubuntu
  6. Install the two files from a terminal or by double clicking. (sudo dpkg -i iscan*)
  7. Power cycle or unplug-plug back in the scanner.
  8. From the terminal test that sane finds the system (sane-find-scanner and also run scanimage -L)
  9. Open X-sane and start scanning.

Adding DVD Support Ubuntu Karmic 9.10

Due to licensing on encrypted DVD you are unable to watch your movies on Ubuntu. To remedy this you can add the support needed to Ubuntu 9.10.

$ sudo wget --output-document=/etc/apt/sources.list.d/medibuntu.list http://www.medibuntu.org/sources.list.d/$(lsb_release -cs).list && sudo apt-get --quiet update && sudo apt-get --yes --quiet --allow-unauthenticated install medibuntu-keyring && sudo apt-get --quiet update

Now install the DVD support and a few codecs

$ sudo apt-get install libdvdcss2 libxine1-ffmpeg gxine mencoder non-free-codecs ubuntu-restricted-extras

And finally a player to watch them. I prefer VLC and mplayer since both are very versatile players.

$ sudo apt-get install vlc mplayer mozilla-plugin-vlc

Creating YouTube type video using Kino and JW Player on Ubuntu

This post will cover creating a video and posting the video in Flash format to a website in the YouTube format. The tools / programs used are Kino, WinFF and JW Player. For the hardware a firewire connection to a MiniDV video Camera is used for the video source, you could omit the camera and Kino step if you have a video already and just need to convert and post.

Download and Install needed Packages

First need to make sure the needed code is installed on your Ubuntu system.

WinFF

Install WinFF from Synaptic Package Manager or from the terminal type sudo apt-get install winff.

Kino

Kino is at version 1.3.2 in the Ubuntu Repositories. First install it from there either using the command line or Synaptic, whichever method you prefer. This version will suffice for what we need to accomplish, but the latest version can be found on GetDeb (http://www.getdeb.net/) or at http://www.kinodv.org . At the time of this writing the version is at 1.3.4.

Install from Command Line

sudo apt-get install kino

FFMPEG

Use the ubuntu repositories to install FFMPEG so you will have added export features in Kino. Run the command sudo apt-get install ffmpeg.

JW Player

JW Player is a flash plugin to deliver flash video content. It is free for personal use but requires a fee for business use. It can be downloaded from http://www.longtailvideo.com/players/jw-flv-player/.

Flowplayer

Flowplayer is another plugin to deliver flash videos to the internet. As the JW Player it is also free. Download the code from http://www.flowplayer.org.

The Process

Now that we have downloaded and installed the code we are ready to start the process of capturing the video, converting it and posting it to the web. In this example we will be using a firewire connection to a MiniDV Camcorder and importing in the file using Kino.

Plug-in your camcorder into the firewire port on your computer and turn it on. Open Kino and click on Edit > Preferences and click on the IEEE 1394 tab. If the module loaded properly you should see your device listed in the drop down.

If not and you see an error you will need to make a few changes to the settings. Close the Kino Preferences dialogue, open a command prompt and type sudo modprobe raw1394, then type sudo chmod a+rw /dev/raw1394. Reopen Kino Preferences again and now your device should show.

A feature turned on by default in Kino is to Auto Split the captures. If you want the capture to be one file then you will need to turn off this feature. If not then exit Kino Preferences, if so then click on the click on the Capture tab and uncheck Auto Split Files and click OK.

Now click on the Capture tab and lets start the capture. With the use of fireware you can control the actions of the camera from within Kino. So to start the Capture click Capture.The files will be saved to /home/<id>/capturXXX.dv. When you are done capturing click on Stop.

Click on the Edit tab and you’ll see the clip has been added to the storyboard column and you can edit the file. Lets say that we are satisfied with the clip and we are ready to export it to Flash. The newer version of Kino will let us do just that.

With Kino as the export for flash do the following. Click on the Export tab and then click on Other tab in the Export Section. Input the filename, From the Tools dropdown select Flash Dual Pass (FFMPEG) and from the Profile Dropdown select either Broadband Quality FLV or Low Quality FLV and then select Export. If you are not using Kino for the import and have an existing file to convert then WinFF is used to convert to FLV

Converting Using WinFF

Open WinFF, Click on the Add button and add the file from Kino that was captured or another file to convert. In the Convert To drop down select Websites. In the drop down box next to it select Flash Video (flv) for Web (4:3) and click Convert. Note: you can also select Flash Video (flv) for Web (16:9)

Setting up JW Media Player

Step 1: Transfer the player.swf and swfobject.js file from the ZIP to your website. (Make sure that you’ve also uploaded all the necessary videos / songs / images to your site.)

Step 2: Embed the player in your HTML page with the lines of code below. Note: If you place the files in different directories, make sure to set the references in this code accordingly.

<p id='preview'>The player will show in this paragraph</p>

<script type='text/javascript' src='swfobject.js'></script>
<script type='text/javascript'>
var s1 = new SWFObject('player.swf','player','400','300','9');
s1.addParam('allowfullscreen','true');
s1.addParam('allowscriptaccess','always');
s1.addParam('flashvars','file=video.flv');
s1.write('preview');
</script>

Notice the flashvars parameter above can contain a list of variables for configuring the player to use different Plugins or Skins. To quickly set up flashvars, use the setup wizard. Simply choose an example, select the variables you want to use and paste the code onto your page. It’s that easy.

Switch to our mobile site