Tag Archives: Ubuntu

OneConf in Ubuntu 10.10

Now, this is something I am really looking forward to in the upcoming Ubuntu 10.10 release (a.k.a Maverick Meerkat):

Idea is to store the state of your Ubuntu installation in the cloud, so that it can be cloned on some other machine, or used to restore after a brand new installation.

This is especially relevant because of the 6-month release cycle. I’ve spent many hours – if not days – to bring my system back to where I like it to be, after every fresh install. Furthermore, it may encourage folks to do a fresh install (versus an upgrade), thereby avoiding many problems that often arise after an upgrade. This is great for anyone who provides support on the the Ubuntu Forums – or other support avenues.

Another reason I like this is that, features like this truly justify Ubuntu One. Ubuntu One needs more ideas like OneConf to harness its great potential, and distinguish it from the other online storage/file sharing services. Not to mention the value it adds to Ubuntu as a desktop Linux distribution.

Somehow, all this sounds very familiar!

Can’t wait…

Camcorder to the Web – HD Video on Ubuntu

Problem statement:

Grab HD clips from Sony HDR-HC7 HDV camcorder and convert them to HD videos on the web (Vimeo, YouTube, etc.) fairly easily on Linux – specifically, Ubuntu

I’ve been trying to address this problem for a while now. It has been about a year since I tried last. I remember using Kino and giving Cinelerra a shot. For variety of reasons, I did not like either and I gave up on the effort.

Recently, when Ubuntu 10.04 shipped with PiTiVi as the default video editor, I decided to give it another go. Since I had used OpenShot briefly in Ubuntu 9.10, I thought it would be educational to try both the video editors to accomplish the task. So I created a short sample video in both these editors – embedded below.

I am a video pro by no means. I am just a novice user trying hard to shoot least shaky HD movies and sharing them with family and friends – while not embarrassing myself! So please take my input and opinions with a grain of salt. But at the end of it all, I think I prefer OpenShot – at least for my camcorder, my level of skill and expertise using video editors.

Now that the result is out of the way, here’s the rest of the story…

Workflow

Workflow I would like to set up is simple:

  1. Grab clips from the camcorder
  2. Convert clips to a format the video editor likes (I would rather not, but necessary with some editors)
  3. Import them into the video editor
  4. Edit/mix the clips and compose the video
  5. Export it to desired target

Grabbing clips from the camcorder

This is something I learned from my previous experience with Kino. I use dvgrab to grab clips from the camcorder. Here is the source of the script I use:

Sony HDR-HC7 is an HDV camcorder. As such, the above script grabs the clips in form of a sequence of MPEG-2 transport stream (.m2t) files. I use the -timestamp option so that the names of the files include the time when the video was recorded. I also store the output of this script for later use. It includes useful information about the clips – like the timecode, length of the clip in frames, size of the clip etc. Here’s a sample output:

Using OpenShot

Importing video

One thing I really loved about OpenShot is the fact that it can consume .m2t files! Kino did not, Cinelerra did not, PiTiVi does not. So this is great. It completely eliminates one step in my workflow.

Import function in OpenShot (the big green ‘+’ sign in the toolbar) allows you to add video (my .m2t files), audio and other media files.

Editing video

For a simple video, like the one I created for this experiment, all you need to do is drag the clips into the timeline – the lower part of the interface – and position them to define the sequence of scenes in the movie.

Here are some editing/mixing features of OpenShot I used in the making of the sample video:

  • The razor tool can be used to snip clips at any given position
  • Markers can be added on the timeline to mark significant positions in the timeline
  • Video in a clip can be turned ON or OFF
  • Audio in a clip can be turned ON or OFF
  • Effects like Fade in/Fade out can be applied to individual tracks
  • There are many transitions and effects, which I did not use in the sample video

I did not play with titles, credits or subtitles, so I cannot say much about those features. All in all, you can do some basic editing and mixing really well.

Exporting video

Another thing you got to love is that OpenShot comes with canned export profiles. Profiles have export parameters set to work with DVD, Web (Vimeo, Youtube and the likes) etc. The fact that export to Vimeo-HD and Youtube-HD worked so well, make me feel very optimistic about DVD export – which is going to be my next endeavor.

Here’s a screenshot of the export dialog.

Exporting for Vimeo using OpenShot - Click for full size

Exporting for Vimeo using OpenShot

And finally, here are the videos out of OpenShot, on both Vimeo (exported with Vimeo-HD profile) and Youtube (exported with Youtube-HD profile).

OpenShot Vimeo HD video:

OpenShot Youtube HD video:

Using PiTiVi

Importing video

Like I mentioned, PiTiVi does not consume .m2t files. Apparently, it has the capability, but there’s probably a bug currently, that keeps it from recognizing the files correctly. So there’s hope!

But for now, you must convert the .m2t files into a format that PiTiVi can read. I used ffmpeg to do so. Here’s the command (and its output) I used for .m2t to .mpg conversion:

Converted .mpg files can now be imported and worked with in PiTiVi.

Editing video

Much like OpenShot, PiTiVi allows you to add video, audio and other media files to a project. You then drag the clips in the time line and position them to define the sequence of scenes in the movie.

Here are some editing/mixing features of PiTiVi I used in the making of the sample video:

  • The scissor tool can be used to snip clips at any given position
  • I could only add one marker (the cursor), but I am sure there is a way to add more. I just did not try to find it
  • Instead of Fade In/Out effects or completely turning ON or OFF a clip, PiTiVi allows you to set track levels (brightness for video tracks, volume for audio tracks). The levels can vary through the track depending on the levels in the beginning and the end of track. I think this provides an added level of flexibility. But also, at the same time, makes simple Fade In/Out slightly harder to implement. I like it though
  • Audio from a video track can be separated into an independent track. This, also, I think is a very handy feature

Again, I did not play with titles, credits or subtitles, so I cannot say much about those features. I also did not easily find any transitions or effects, that could be applied to tracks.

I had trouble synchronizing audio and video in PiTiVi (synchronizing the ‘gong’ with dropping of CD sleeve). I was finally able to synchronize the two with a lot of trial-and-error. The one that rendered kind of synchronized (one below) does not actually look synchronized in the preview. The preview in PiTiVi did not seem very accurate.

Exporting video

PiTiVi does not come with canned export profiles. Although I found a way to export to Vimeo-HD on the Vimeo help sites. It is left to the users to do the research. As you might notice though, the audio/video out of PiTiVi is a bit choppy at times. I probably did not get all the export parameters right. But then again, PiTiVi does not make it any easier.

Here’s the screenshot of the export dialog of PiTiVi:

Exporting for Vimeo using PiTiVi - Click for full size

Exporting for Vimeo using PiTiVi

And here is the resulting Video:

Conclusion

I tend to compare video editors in three different categories – Import, Editing and Export. A good video editor should support a wide variety of input formats. It should have a good balance of powerful and easy-to-use editing features. It should export video in formats that can be played flawlessly on popular targets like the Web (Youtube, Vimeo, etc.) and media players (DVD/VCD players, desktop media players, etc.).

At the time of this writing, I think OpenShot trumps in all the three categories.

  • In my case, PiTiVi could not import .m2t files. This added a step in my workflow. Hopefully this is temporary and will be fixed soon
  • PiTiVi has some neat editing features, but lack of transitions and effects shifts the balance in OpenShot’s favor. Also everything you can do in PiTiVi can be achieved in OpenShot to some extent.
  • OpenShot has export profile for popular targets. This is a must for anyone who doesn’t want to get lost in the many gory details of conversion parameters and their optimal values – certainly for me

Looks like the Linux video editor scene is starting to look up. I hope it only gets better from here.

If something I mentioned in this post is inaccurate/wrong, please point it out in the comments. Hope this helps!



Conky with XMMS2 on Ubuntu 10.04 (Lucid Lynx)

Default Conky in Ubuntu 10.04 (Lucid Lynx) does not come with xmms2 support built in. Since I use xmms2 extensively, building conky from source was the only option. Here’s how I did it:

That should install Conky with xmms2 support in /opt/conky. And here’s the obligatory screen shot:

XMMS2 music display with Conky - Click for full size

XMMS2 music display with Conky

Just for reference, here’s the conkyrc I use for music:

Happy listening!

Nginx and PHP on Ubuntu Lucid

To do some PHP development (read experimenting) on my laptop I wanted to get a web-server with PHP running on it. Since this is a laptop with limited resources, I decided to try Nginx instead of Apache. Nginx is known to use less memory as compared to Apache. I am hoping this will keep the laptop still usable while the web-server is still running in the background.

This is not an exhaustive how-to, but this is how I installed all that is needed to get my first PHP page up.

Let me begin by mentioning that this laptop currently runs the development build of Ubuntu Lucid (which will become Ubuntu 10.04 LTS sometime in April 2010).

To begin, I installed following packages from Ubuntu Lucid repositories:

  % sudo aptitude install nginx php5-cgi lighttpd

Although I am not using lighttpd, the package is required because it provides the spawn-fcgi script.

Nginx supports FastGI natively. PHP is served as a FastCGI process.

Modify /etc/php5/cgi/php.ini to include the following line:

cgi.fix_pathinfo=1

Setting this configuration makes sure that PHP sets path information of the executing script in a way that conforms with CGI specifications. The line may already exist in the file, but commented. Just un-comment it. This is an optional step (at least in Lucid version of PHP) since the default value of cgi.fix_pathinfo is 1.

To spawn FastCGI add the following line to /etc/rc.local every time the computer starts.

/usr/bin/spawn-fcgi \
    -a 127.0.0.1 -p 9000 -u www-data -g www-data \
    -f /usr/bin/php5-cgi -P /var/run/fastcgi-php.pid

This script (spawn-fcgi) was installed via the lighttpd package.

Finally, I configured a website in Nginx and enabled PHP via FastCGI. This configuration would typically reside in /etc/nginx/sites-available/<website_name>:

server {
  listen   80;
  server_name  localhost;

  access_log  /var/log/nginx/localhost.access.log;

  root   /var/www/blog;
  index  index.php;
  fastcgi_index  index.php;

  #
  # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
  #
  location ~ \.php$ {
    fastcgi_pass   127.0.0.1:9000;
    fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    include /etc/nginx/fastcgi_params;
  }
}

When all is set up properly, you can test it with the phpinfo() command. It should look something like the following:

phpinfo() screen - Click for full size

phpinfo() screen with Nginx+PHP setup

All this, mostly a note to self. But hope it helps someone out there.

Koalas are in!

It’s been around a week since Ubuntu 9.10 – Karmic Koala was released. Both my Linux systems are now up-to-date.

Linux systems

One of the two machines is a Sony Vaio Laptop (VGN-T140P) and other is a desktop built on a Asus P5K-e Wifi/AP motherboard with an Nvidia 8400GS video card.

Install strategy

In both cases I chose to do a clean install. I always keep /home on a separate partition, so clean installs are not much of a hassle. I usually move all the dot-files (and directories) from /home/me out of the way before a clean install. After the install, I bring the ones I need manually. This, I believe, prevents any configuration issues arising from new versions of applications adding/removing/changing any configuration items. I do have to configure some applications – like compiz – all over again, but it is not a big deal most of the time.

I also make a copy of /etc directory before a clean install, just in case I need to refer to the hacks that worked around bugs in the previous release.

Trends

If I look at the way thinks are working on the two of my systems since Ubuntu 8.10 – Hardy Heron, I see pretty consistent trends. My laptop was at its best in Hardy, things are not quite that good now. The desktop, however, is at its best in Karmic! I wonder if it has to do with the video hardware (Intel in laptop, Nvidia in desktop) or wireless usage (I use it in laptop all the time, never on the desktop).

Suspend/resume has gotten worse on the laptop, but almost perfect on the desktop.

Laptop is plagued with wireless issues, but I know I am not alone there (Launchpad bug reports as of today).

Sound, at least on my systems, has greatly improved. It worked out of the box on both of them.

Laptop experience

The general feel of the OS has definitely improved. With the new boot experience, artwork, new themes, Karmic looks pretty neat. It is snappier than ever, even on the laptop with mediocre specifications. All that good stuff is marred by the issues that have come up in this release – from back in the alpha days.

There has always been a problem with the laptop hardware, that when it resumes from suspend (to RAM), the backlight is missing. In the past, I have been able to work around it by setting quirks in suspend/resume scripts. Those hacks don’t work anymore. I haven’t found any work-around for Karmic yet. Launchpad bug #417599.

An even worse issue that has come up is with the wireless networking. In my case, it just doesn’t connect. Even when it does, it doesn’t stay connected for long. It is extremely annoying. Launchpad but #429035. So its mostly wired network for now. I know, laptop wired to the router? That sucks :(
I hope not for very long though.

Desktop experience

On the desktop, Karmic is just sweet. Out of the box, everything just worked. Sound, video, suspend/resume, everything!

The only thing worth mentioning is that when I first rebooted the system after installing Karmic, Windows entry was missing from the Grub2 menu. All I did to fix this was:

  % sudo update-grub

I wonder why it missed the Windows entry during installation. I am sure it runs update-grub as an installation step, doesn’t it? In any case, if you see Windows entry missing from your Grub menu after installing Karmic on a dual-boot machine, just run the above command.

One more thing I haven’t checked is if wake-on-lan works. If it doesn’t I’ll need to do what I usually do after clean Ubuntu installs – Howto: Wake on LAN with ASUS P5WDG2 WS Pro in Debian/Ubuntu. Hope it works this time too!

Well, there. Now that the computer are all working, time to get some work done!

Incidentally, I set up a github account for all my little hobby projects. Check it out. All the projects are purely experimental and educational. Nothing is going to blow your mind.

Incorrect hue in video?

I was watching the Apple Get a Mac ads today and this is what I got:

Incorrect hue in GStreamer - Click for full size

Incorrect hue in videos can be corrected by fixing the hue setting in Movie Player

This is on Ubuntu 9.04 (Jaunty Jackalope), where Firefox uses GStreamer plug-in to display video. Movie Player (Applications -> Sound & Video -> Movie Player) also uses GStreamer as its back-end.

So to fix the hue issue, I opened Movie Player preferences (Edit -> Preferences). In the Display tab, under section Color Balance noticed the Hue. In my case it was set to the minimum value. I clicked on the Reset to Defaults button. It reset the Hue slider to a center position.

Closed Movie Player preferences and reloaded the movie. It looked so much better.

Now I wonder what changed the Hue setting in the first place…

Building Alpine on Hardy Heron

Lately, I have developed a liking for the Alpine Messaging System. It is a text based email client that runs on a variety of platforms. I use it with Gmail IMAP at home and MS Exchange at work. In both cases, it works beautifully.

Pre-compiled binaries for a good number of platforms are available on the apline website. But if you are not in a position to use the pre-compiled binaries – say because you do not have root privileges, or binary is not available for your platform, or may be you just
want to use the bleeding edge development code – you can build the alpine application from source. The following steps are specific to building the latest SVN snapshot on Ubuntu Hardy Heron. It may/may not work on other OSes.

Prepare your system

Get all the (known) prerequisites. From my experience, these are required:

  • libncurses5-dev to get rid of the following error:

configure: error: Terminfo/termcap not found

  • libpam0g-dev and libssl-dev to get rid of some SSL related errors.

To get the above use the following in terminal:

  % sudo apt-get install subversion libncurses5-dev \
                         libpam0g-dev libssl-dev

Get the source code

Get the latest source snapshot. Following few steps are one time. After the initial snapshot is acquired with svn checkout, svn update can be used to update the source snapshot:

  % mkdir ..../alpine
  % cd ..../alpine
  % svn checkout \

https://svn.cac.washington.edu/public/alpine/snapshots/

Accept the certificate (permanently) if required.

Configure, compile and install

Now use the familiar configure, make, make install routine to build and install Alpine.

  % cd .../alpine/snapshots
  % svn update
  % ./configure --prefix=/opt/apps/alpine
                --with-local-password-cache-method
  % make
  % sudo make install

I was overly optimistic in using --with-local-password-cache-method. I was hoping that Alpine would store my account passwords in Gnome Keyring! It did not work quite like that. I need to enter my email passwords every time I start Alpine.

Other way to automate password entry is to use the --with-passfile configure option. But it is known to be unsafe.

Happy messaging!

EDIT: Trying to recompile alpine on Intrepid, I discovered that libssl-dev is also required.