Thursday 18 November 2010

Recording anything that gets played in your computer

I knew it was possible, but I had forgotten the details, so here they go...

Sometimes you might want to record audio played by an application in your computer (system sounds, music in a webpage, etc... basically anything that the computer can output to speakers/headphones). Recording that is actually very easy... In Ubuntu 10.04 I got the instructions from https://wiki.ubuntu.com/PulseAudio

I decided to try recording a song from Spotify (which is running inside Wine in my PC) using Audacity. The only extra software that I needed was PulseAudio Volume Control, and that was also the only one that I needed to configure.


When you start playing a song in Spotify and start recording in Audacity, it probably does not record anything, because Audacity will try to record from the "wrong" source. To route the sound properly, you just need to open the PulseAudio Volume Control and (while recording, otherwise this option is not available) change the option "ALSA Capture from" to "Monitor of Internal Audio Analog Stereo", as shown below, and Audacity will record them properly:


Monday 15 November 2010

New Al Zimmermann's Programming Contest

Another one of the famous Al Zimmermann programming contests has just started. The contest runs until 12 Feb 2011, so there is plenty of time to compete. These contests are very competitive and the level is quite high, so it is difficult to stay in the top. Given that, and that I can only devote a limited amount of time to this, I will just try to compete "a little". For me, the goal will be to end within the first 10% of participants. Right now there are 125 contestants, so I should try to get in rank 12 or better. I quickly wrote a basic program and got in rank 33. Now it is time to improve it and see if I can do better than that over time. I will chart my progress below...



Update (14/2/2011): Oh well, the contest ended two days ago, and in the end I didn't get very far at all. My final position was 110, which with 362 contestants sets me at rank around 30.39%. I lost steam in the final weeks of the contest, when I realized that I had run out of easy ideas, and real work was not letting me try harder ones... Let's see if I can do better in the next contest (which is already set to start on Jul 9th).

Saturday 13 November 2010

Editing videos from a Pentax Optio M40 camera

In a previous post I have a link to a Vimeo video, which was created by:
  1. recording a video with my Pentax Optio M40 camera
  2. cutting the beginning and the end of the video with the PiTiVi software
PiTiVi is not the video editing software that I would choose to do anything serious, but I had a problem with Kdenlive and OpenShot: the audio and video would be out of sync when importing the clip to any of them; but worse still, after cutting the beginning of the video, the problem just got much worse, and the audio would be out of sync by around a full second. With PiTiVi it was also out of sync, but only by a fraction of a second, so it was not too bad.

Today I decided to find a solution to this, so that I could edit the clip with Kdenlive, which is right now my preferred video editing software. The solution seems to use an intermediate software to create the clips to be imported to Kdenlive: Avidemux.

I just load the AVI file from the camera in Avidemux, select the starting and end points of the clip I want to use, and press the "Save" button. A screenshot can be seen here:


Then this clip can be imported into Kdenlive, without any synchronization problems. With Kdenlive we can now add a title, add effects, etc. and if we want a decent quality we can render it as the template MPEG-4 10000k 2-pass (which translates to:
f=mp4 acodec=libmp3lame ab=128k ar=44100 vcodec=mpeg4 minrate=0 b=10000k aspect=%dar mbd=2 trellis=1 mv4=1 pass=2).

The resulting file has perfect synchronization and can be uploaded to Vimeo without any problems and with much better quality than the one generated in my previous post. Here is the resulting video.

Friday 12 November 2010

File Version Control

I'm a fan of version control systems, but for some reason I end up not using them as regularly as I should, and then I tend to forget how to do the most common operations, so this time I'm logging it here.

I do all my editing from inside Emacs, so I will be using VC, which allows me to use a version control system from within Emacs. VC works with many different version control systems, but for the moment I will use it with a very simple one: RCS. Later on, perhaps I will need a more sophisticated one, since RCS does not work over a network, and it only works at the level of individual files, but for the moment this is all I need.

The integration Emacs-RCS is very tight, and the basics for checking-in, checking-out are just performed with the same command: C-x v v. The first time we do this command, Emacs will offer to create the RCS directory, if it doesn't exist, and it will register (and unlock) the file as version 1.1. To edit the file again, just type C-x v v again to lock the file. When done and when we register the file again, the *VC-log* buffer will open, so that we can add a log entry. We continue this way, so that different versions of the file will be registered.

So now, some of the most common things that I need to do:

* Be able to see what has been changed in the file:
    - When editing the file: C-x v =
    - When writing the log entry: C-c C-d in the *VC-log* window (after saving the file being edited)

* Compare different versions:
Perhaps the most flexible one is just to type C-x v ~ REVISION, which allows us to view any previouos revision of the file, and then we can compare any two versions with something like ediff-buffers

 * See history of changes:
 C-x v l gives us the revision control change history. In a different buffer, we will have a list of all the revisions made to the file, together with the text of the log entries. This buffer is also very convenient to do some useful operations:
    - With p and n, we can go the the lines corresponding to the previous or the next revision respectively.
    - With e we can modify the log entry text.
    - With f we can visit the revision indicated at the current line (like C-x v ~ above).
    - With d see the diff between the revision at the current line and the next earlier revision.

* Undo changes:
C-x v u revert the file to the revision from which you started editing.

Later on I will add to my daily version control fix how to work with branches, but for the moment this is 90% of what I really need from a CVS.

Tuesday 9 November 2010

Classical guitar progress logging (Nov'10)

Today I'm starting my guitar progress logging, my plan being to record and upload every month a piece that I'm learning, whatever its status, to keep a record of my progress, my struggles, etc.

We start with the Étude Simple n.VI by Leo Brouwer, which can be seen at http://vimeo.com/16656488

Étude Simple n.VI by Leo Brouwer from Angel de Vicente on Vimeo.


My camera doesn't have an input for an external microphone, so I have to rely in its poor quality built-in microphone. (Later on I hope I will be able to learn how to easily and accurately sinchronize video recorded with the camera and audio recorded directly to the computer via microphone, but until then...)

Technical stuff: after editing it with PiTiVi, I render it with the options: VGA(640x480), Audio Output: CD; Container: FFmpeg AVI format muxer; Audio Codec: TwoLAME mp2 encoder; Video Codec: FFmpeg MPEG-4 part 2 encoder

Other codecs gave me problems and the video could not be converted by the Vimeo Servers.

Monday 8 November 2010

Free classical guitar lessons on the internet

Free classical guitar lessons on the internet

Lessons given by Jean-François Delcamp

(Professor at the Brest Conservatory of Music, Dance and Drama - France)

The lessons will begin in November 2010 and finish in June 2011.
These lessons correspond to the first three years at the conservatory
The conditions for registering are available on the forum
http://www.delcamp.us/


More details at: http://www.delcamp.us/viewtopic.php?f=41&t=54022#p587821

Thursday 4 November 2010

The best video editor in Linux? OpenShot vs. Kdenlive? The jury is still out.

I'm starting to create videos more or less frequently, and the software that I tried so far, while good, was not working that well. My video editing needs are simple: put together a number of sequences, mix them with audio, apply some effects and transitions (fade in, fade out, etc.), and add some titles, credits, etc., and export it all to different formats: for Internet, DVD, etc.; and obviously, all within Linux.

When I start creating videos more regularly, perhaps I change my mind about the software I've used, but so far the fight is between OpenShot and Kdenlive. The video editing software that I have used:

Pitivi, was behaving properly, it looked stable and easy to use, but transition effects are not yet implemented, only fades.


Open Movie Editor, the interface does not look very polished, although it was quite OK for some of the videos I did, but the main problem for me was that I didn't find a way to zoom in or zoom out in the timeline. This was a problem when I had very short clips (perhaps just a few seconds), because it would be difficult to select them, in order to move them around or cut them, etc.

Kdenlive, this is probably the most complete editor of them all, and it has all those features that I want and many more, but in the past it crashed on me many times. Today I'm trying it again, with a new version (0.7.7.1), which apparently squashed many bugs, and it looks very promising. If I manage to run this version without crashes, this is probably the one that will win my heart. A screenshot of the video I'm editing right now:



OpenShot is the new kid in the block, and the interface is quite clean and it is feature rich. So far, my only gripe is that if I apply effects to consecutive video clips, sometimes artifacts are created in the audio, but I think this also happens with Kdenlive, so I need to investigate. The screenshot of the same project with Openshot:

 
There are a few more programs to try, (see http://en.wikipedia.org/wiki/Comparison_of_video_editing_software), but I think one of these two is going to be more than enough for my needs.