Posts Tagged ‘Open Source’

Converting WMV with mencoder

Tuesday, July 8th, 2008

Steve and I have been working on a YouTube video downloader based in PHP. One of the features that I’ve been adding in is the ability to upload videos of any format and be encoded into a FLV, just like those big YouTube sites.

One of the problems I’ve been having is that the WMV videos race through at over 10 times the speed of the video, and leave the audio playing at normal speed. This, apparently, has to do with WMVs (and any ASF-based video) using a variable frame rate.

To get around this, you simply need to set a frame rate manually with -ofps. So, to convert a video from WMV to Flash video, you’d need a command like this:

mencoder MyVid.wmv -o MyVid.flv -of lavf -oac mp3lame -lameopts abr:br=56 -ovc lavc -lavcopts vcodec=flv:vbitrate=400:mbd=2:mv0:trell:v4mv:cbp:last_pred=3 -srate 22050 -ofps 25

This will keep the frame rate to 25 fps. Now, all I need to do is work out how to get the correct frame rate for the whole video…

Becta - you’re getting it all wrong

Saturday, January 19th, 2008

I don’t know what Becta think they aim to achieve with the latest anti-Microsoft report, but I don’t think that they are going to reach the computer utopia that their report on Microsoft Vista and Office 2007 seems to desire.

I’ve breezed through the report, and I can’t get into my head

a) Who the report is aimed at
b) What the purpose is

As anybody who knows me knows, I’m not a Microsoft fanboy - and I’m not completely evangelical about Linux either. Both suit a purpose in their own way.

What irks me about this report is that it makes a great deal of assumptions, that invites the reader to go along with the ride and interpret that as the de-facto way of thinking.

My biggest annoyance of the report is the whinging about Office 2007. It complains that the DOCX format is not widely supported (true enough), and because Microsoft’s implementation of the “industry standard” open document formats is poor, everyone should use the Office binary format and OpenOffice.

Yes, that is right. Instead of being the driving force that Becta is supposedly meant to be, it’s making what I can only describe as a half-baked approach to document interoperability by saying, “Yeah - you should use OpenOffice. You should use ODF. But save in the office binary format.” I cannot fathom what they intend to accomplish with this attitude. If Becta truly are to inspire educational establishments to embrace open source and open standards - they are playing this totally wrong. I’ll rant a bit more about this later on. What beguiles me is that there is no acknowledgement of Office Compatibility mode. Also, Becta seem convinced that having an open document format means that it should render EXACTLY the same in any program that opens it. That’s just not the case. The point of open documents is to enable an application to access all of the information within, and render it approximately close to the original intent. Indeed, the DOCX file is a glorified ZIP file and no more. The XML is what’s in question with the open standards that ODF and DOCX are embroiled in.

Their year-long investigation into Windows Vista is a joke. Their summary is not to use mixed XP / Vista environments. If you’re considering upgrading your network, then take a look at Vista. So, the reader (if an IT person) is being told something that they should know: Any implementation of a new O/S environment takes planning, preparation, and testing. Oh, and mixed environments with XP and Vista are not the end of the world - I run them side by side quite happily.

I think it’s fair that the value added of using Vista Business compared to XP Professional is still in question. Not just for education, but for the industry as a whole. Microsoft have done a great job promoting Vista. But ultimately it is a very greedy operating system. Requirements are higher than what should be reasonable for an O/S, and most of the improvements are aimed at corporate customers where staff have their own computers - not the environment of schools or colleges.

A couple of niggles in Vista that cause complications on a roaming network:

  • The ‘lock computer’ button on the start panel can not be configured or changed. Totally useless in a roaming environment as a user may think that they have logged off when they press it. The consequence is that the new Start Panel has to be disabled on Vista machines.
  • No roaming gadgets - therefore the first thing that has to be turned off
  • Loss of active desktop. Now the intranet has to be opened by the user, instead of it being there by default. I know, gadgets are meant to replace that - which would be fine if it wasn’t for my last point

Also, the blanket statement of exercising your downgrade rights is a joke. Drivers for systems - especially laptops - are getting very difficult to track down all of a sudden for systems pre-Vista. The problem is compounded by the issue of a lack of drivers for Vista for some hardware peripherals. We’re in a transitional O/S point where we can’t seem to win either way. Becta miss this point entirely.

Finally, there’s Becta’s supposed pro-Open Source approach. They rejoice with Open Office, and say that there should be more choice. The problem is that when schools receive documents from other schools, or the education authority, of the government guess what? It’s Office binary format! And schools have Windows rammed down their throats because the EAs insist on them using Windows applications to deliver the curriculum. In fact, over the last couple of years, I’ve seem a number of free and discounted applications sent to schools where they are Windows applications. Then they deliver training on these programs.

If you want schools to be open source, you need:

  • to support the schools in doing so and not blame the industry for trying to sell something instead
  • to put pressure higher up the chain to being implementing policies to migrate to open document formats. Only then would it be possible for educational establishments to embrace this format
  • to start to educate people in education that there is an alternative

Finally, Becta needs to stop leeching off open-source like a parasite. I’m annoyed by it’s “get everything for free - don’t pay Microsoft” attitude. That’s not quite what open-source is about. With thousands of schools around the country, to ask schools to contribute in whatever way they can to projects that they benefit from would make open source more viable, because the UK education system could begin to change and direct the movement of open source. If a school is using an open-source alternative that would have cost them £250 for a site license of something else, why not contribute £50 to a project? If the project could do with documentation or translations, surely a secondary school or college could commit some resources to these kinds of things?

The education sector has by far the most potential to steer and promote the direction of open-source than anything else in the UK. It’s a completely missed and wasted opportunity.

I don’t think it’s unreasonable to expect some practical guidance on these matters from the leader of “the national drive to inspire and lead the effective and innovative use of technology throughout learning.” I really would like to see more of that.

With Vista and Office 2007 out in the wild for over a year now, Becta should have been making these points 12 months ago. Instead they let it slide and the complain when things don’t pan out as they expect, while missing the point entirely.

It’s such a shame.

FreeWins - Live Windows Rotation in Compiz!

Saturday, October 27th, 2007

Well, it’s very exciting that a new plugin has been developed that allows live manipulation of desktop windows. Over on SmSpillaz’s blog, he’s got some links to YouTube as well as a nice screenshot of the desktop.

The plugin is only in alpha and requires compilation on the system that you are using… But the promise is incredible.

If a plugin like this can work, and more importantly, work well, then I think we can expect to see some excellent plugins to take advantage of this.

Some ideas could be:

  • A plugin that shifts windows to the side of the screen rather than minimizing, like a book
  • A feature that allows you to scale windows larger or smaller without actually resizing it.

Of course, that’s just my limited imagination there.

Searching for the contents of many files in Linux

Tuesday, October 16th, 2007

One thing that I find remarkable in Linux is the vast array of clever tools that allow you to do ‘clever stuff’.

The problem exists where these obscure tools are difficult to work out how to use effectively, and moreover, use right.

One task I aim to do occasionally is search a disk for files containing particular text. This is always difficult. Even in Windows XP - the search indexing service actually prevents Windows from searching for specific text within a file. I’ve searched for files that I know have certain strings in them, only for Windows to tell me that it cannot find them.

As my love of Linux and Ubuntu grows, I found myself needing to perform this task again. Recently, I’ve scraped by using the rather useful find tool:

find . -type f -name foobar

What this little snippet does is seach the current directory and all subdirectories for any files containing the word foobar in the name. So it could return names such as ./foobar.doc, ./test/foobar.doc, or ./this is a foobar file name.txt. Pretty useful.

Tonight I needed to search for a specific phrase in a Word document on a disk. This is where the Linux command line really becomes powerful:

find . -type f -name *.doc -print0 | xargs -0 grep -i 'foo bar'

This will join the power of two commands: grep and find to create a groovy search.

First of all, the find command is searching for all files (-type f) that end in .doc (-name *.doc) in all folders starting from the folder I am in.

Once find finds a match, we use the pipe (the |) to pass that file name over to grep, which will search the file for the string foo bar.

We have to use the -print0 and -0 options to make sure that find and grep share the file names correctly between them in case we find any unusual ones (files with spaces would be counted as unusual).

Finally, the -i tells grep that the search is case-insensitive. This means that any .doc file with foo bar, Foo Bar, fOO bAR or any other case variation will be caught. Without it, only the exact string will be matched.

Now go forth and search!

Using dd and dd_rescue

Tuesday, September 11th, 2007

Following up on a post about recovering bad disks and reiser file systems, here is a list of ddrescue commands to help make life that little bit easier:

Backup MBR (boot code + partition table):
dd if=/dev/hda of=mbr count=1 bs=512
Restore boot code + partition table:
dd if=mbr of=/dev/hda
Restore, not including partition table:
dd of=/dev/hda if=mbr bs=448 count=1

Saving partition sizes to text file:
fdisk -l /dev/hda >partition-info.txt

Backing up to gzipped file:
dd if=/dev/hda | gzip >hda.gz
Restoring:
gunzip -c hda.gz | dd of=/dev/hda

Backing up to archive split into 1GB chunks:
dd if=/dev/hda | split -b 1024m -d - hda.
Restoring:
cat hda.* | dd of=/dev/hda

Backing up over ssh tunnel to remote machine (blowfish = faster):
dd if=/dev/hda | ssh -c blowfish user@machine "dd of=hda"

copying files over ssh tunnel:
tar cv /source | ssh -c blowfish user@machine "cd /destination ; tar x"

Thanks to colinm over at Digg for putting these so succinctly

Selecting a sound device in Ubuntu

Sunday, July 29th, 2007

I’ve found that using the ALSA sound system in Ubuntu is pretty slick, but becomes a pain when the sound tool in Ubuntu doesn’t correctly switch devices using the graphical user interface.

In a nutshell, here are a few useful commands to list and select the sound devices that are on your computer:

asoundconf list - list available sound cards
asoundconf set-default-card # - set the default sound card. Replace # with the device name from the previous command
alsamixer # - adjust volume settings for your specific sound card. Once again, replace # with the device.

Running through these 3 commands will probably save any user a great deal of grief in the long run.