Archive for the ‘linux’ Category

Qalculate!

January 31, 2015

Just a note of thanks to the authors of Qalculate! because I’ve just discovered it today. My elderly Casio fx-7700GB has started to consume batteries like Smarties. With Qalculate! I can continue to do calculations with fractions so I don’t lose precision to decimals in my Circuit Theory homework.

Installing it on Ubuntu (assuming you’re using the default window manager) makes it less pink as well.

Advertisements

Creating multi-page PDFs with free software.

September 27, 2014

This is another of those posts which are mostly for my reference, but I’m happy to share also.

The task was to scan a multi-page letter, and email it to someone. As I’m not keen on spending money, I look to free software to get the job done.

Requirements: Linux and ImageMagick.

As the letter was a simple monochrome document, I will convert all the scanned images to the Grey colour space first, and then compile them in to a multi-page PDF. The file names are of the format “page01.jpg” “page02.jpg” “page03.jpg” etc and the input format is not important.

mogrify *.jpg -colorspace Gray -compress JPEG

convert *.jpg Filename.pdf

That is it. Really. It’s that simple.

I have not tested it, but if you have colour input images then you ought to omit the mogrify command.

Update 30/4/2015:
This gives slightly better results, I’ve been using it a lot recently:

convert input.* -resize 1240×1753 -units PixelsPerInch -density 150×150 -set page A4 output.pdf

An improvement would be to prevent ImageMagick rasterising svg files, particularly when I mix bitmaps, svgs and pdfs on the input side. Open to ideas at this point.

Converting fonts to paths in Ghostscript

June 1, 2014

This entry is mostly for my convenience, to make it easier to find in the future.

Source: http://latex-my.blogspot.de/2012/01/text-to-path-conversion-with.html

If you just want a one-off conversion at the command line:

gs -sDEVICE=pswrite -dNOCACHE -sOutputFile=”OutputFile-nofonts.ps” -q -dbatch -dNOPAUSE -dQUIET “InputFile.ps” -c quit

Unpacking D-Cinema content.

April 4, 2014

This entry is intended to be read after my earlier entry on a similar subject:
https://barrowbiker.wordpress.com/2013/03/29/conforming-and-converting-video-in-to-digital-cinema-package-format/

Why.

Having provided a (relatively) simple system for putting your content in to DCP format, I now present a simple system for recovering it. When considering publishing this information I have tried to anticipate some of the outcomes. I have discussed it with people whose judgement I trust. I use no exploit, or “hack” or “bypass” here. I trust that you will only use this information to process content you have the rights to, or only with the full authority of the copyright holder.
The DCI specification provides a means to protect content against unauthorised access, and against tampering. The cinema industry uses it every day. There is no excuse not to use content protection in the cinema industry, particularly when key management is now so streamlined and automated.

Requirements.

If you did not install the digital_cinema_tools package:
https://github.com/wolfgangw/digital_cinema_tools_distribution/wiki/Setup
then do it now because you will need it for the asdcp-test command

Other requirements are:
(1) OpenShot
(2) ImageMagick
(3) mencoder
(4) A working knowledge of how a DCI package is organised
(5) Lots of disk space
(6) A supply of tea, or your preferred beverage(s)

You might want to turn off image thumbnail creation, as this can easily generate in excess of 6000 files in your working folder. At various points in this tutorial you will find yourself looking for various bits of information about the content such as frame rate, aspect ratio e.t.c. Most of this is held in the Control Play List (CPL) file. The ASSETMAP will define which file is the CPL. The contents are held in XML, so open the ASSETMAP, CPL etc in a web browser.

As the DCI Specification is tightly defined, this procedure ought to work on any JPEG-2000 encoded Digital Cinema Package (DCP) with these conditions:
(a) Not encrypted (no KDM required)
(b) Not stereo (2D content)
(c) Consists of only one reel – most shorts, trailers, adverts, public service announcements etc.

Extracting the picture stream, and conversion from CIE 1931.

First, read the ASSETMAP file. This is found within the folder which holds all the files which (together) comprise the DCP. The ASSETMAP file should tell you where to find the PacKing List (PKL). Search for “<PackingList>” and look a few lines down for the name of the actual PKL file.
Open the PKL file, and look for “asdcpKind=Picture”. That will give you the name of the MXF file which holds the picture information. Also there should be a pointer to the MXF file for the sound, make a note of that for later.

For the purposes of this procedure, I will assume you have determined that the picture file is called “MXF-video.mxf”. Open a command window, cd to the correct folder and issue this command (changing the name of the MXF file to suit):

asdcp-test -x frame MXF-video.mxf

What will happen is asdcp-test will create files of the names frame000000.j2k, frame000001.j2k, frame000002.j2k e.t.c. One file per frame of the DCP. These will be in JPEG-2000 format.

You may be able to import these files directly in to your video editing software. I will provide means to convert them in to other formats, which are more readily understood.

What you should consider at this point is that you may lose some colour information. DCI content uses the CIE 1931 colour space model, and gives a maximum of 12 bits per colour component, therefore 36 bits per pixel. In theory you could convert these JPEG-2000 images to TIFF format, and preserve all that colour resolution, but not all applications understand 48 bits per pixel TIFF files.

To be fair, I’m not sure how much it matters as my display device is 10 bits per channel at best. If you’re using a notebook, you may well only have 6 bits per channel.

To convert to PNG files use this (with a tiny loss of colour accuracy):

mogrify -format png -alpha Off -resize 999x540 -gamma 0.384615 -set colorspace XYZ -colorspace sRGB -depth 8 *.j2c

Notes:
(a) The output images are resized, feel free to adjust the target size to suit your requirements. I’ve simply divided by 4 to get these figures.
(b) Notice the use of the unusual gamma, because in D-Cinema gamma is 2.6 at projection.
(c) Use “-depth 16” and “format tiff” if you want to preserve all colour resolution. Worth doing for selected stills, not worth it for transcoding to video.
(d) This will take a long time, go and make a cup of tea. Other beverages may be available.

At this point you can pick out your favourite still frame.

If you intend to proceed all the way to producing a consumer-friendly video of the content, then read on.

Sorting out the sound.

The sound is not so hard to deal with, as the DCI Specification requires uncompressed sound. Common media player applications such as VLC can play audio held in the MXF container format without any sort of conversion. For simplicity’s sake, and because this post is mainly about the picture, I suggest converting the sound to a 2 channel WAV file like this:

mplayer MXF-audio.mxf -ao pcm:file=audio.wav,fast -channels 6 -af pan=2:0.4:0:0:0.4:0.2:0:0:0.2:0.3:0.3:0.1:0.1

This command mixes the six channel sound down to two channels in a standard RIFF format WAV file. The pan option tells mplayer how to mix each input channel to make two output channels. (Source thank you, it sounds slightly better than the example in the manual)

Encoding the video and sound.

You can use some magic command line incantations for this, but it is easier to import the image sequence in to OpenShot along with the 2 channel sound file.

Within OpenShot, create a profile which matches your chosen picture resolution and frame rate. Refer back to the mogrify command you used earlier.

Notes:
(1) Frame rate is likely to be 24fps, as not all DCinema kit fully supports all valid frame rates. You will find it in the CPL file.
(2) The aspect ratio is likely to be 1.85, but look in the CPL file to confirm. Openshot will accept aspect ratios as a fraction, so you can use 185/100 or the simplest version as 37/20.
(3) The pixel aspect is “1/1”.

There is something which might trip you up. Check the CPL for the “<ReelList>” section. For the picture and sound there might be non-zero “<EntryPoint>” values. These values describe an offset within the video and audio, to show where playback should commence. Using the frame rate and offset (number of frames), calculate the offset between picture and sound. If both of these are zero, then it’s easier later on in OpenShot.

I did not set out to write an OpenShot tutorial, but there is a feature of OpenShot which is not well known. If you drag a file named similar to “image000000.png” to the Project File panel, OpenShot will recognise it as the first frame of a set of sequentially numbered frames. See this tutorial for the details. Add the sound file to the project in the same way.

Put the video on track 2 (upper), and sound on track 1 (lower).

If you have non-zero <EntryPoint> values: With reference to the offset you calculated earlier, move the video or sound left or right as required. If the picture needs to be ahead of sound, you can right-click and enter the offset with reference to the project time line.

Play it through to confirm correct synchronisation.

Use the Razor tool to remove the excess picture/sound from the beginning and end of the project as required. If you’re left with a blank space at the zero line of the project, move both tracks so they commence at zero on the timeline.

Export the project as (rendered) Video, check the profile in use is correct (matches resolution and frame rate) and choose sensible values for container format, video codec, audio codec and frame rate. Some versions of OpenShot (currently) seem to have a problem in saving the finished file to any other folder than /home, so don’t panic if the file is not where you expected it to be.

Tidying up.

(Use these commands with care)

rm *.j2c
rm *.png
rm *.tiff
rm audio.wav

Final words and bits that don’t fit anywhere else.

There was a discussion about adding support for converting XYZ colours to RGB to ffmpeg. I’m no stranger to compiling code from source, but I’ve not tried this method.
As with my previous post on this subject, I extend my thanks to the same four people – for the same reasons.
12/4/2014:
Actually you can use this with 3D material, start with asdcptest -3 -x frame … and it will output all left eye and right eye frames. I’ll leave it as an exercise for the reader about further processing of the data.

Conforming and converting video in to Digital Cinema Package format.

March 29, 2013

This might be quite a long read, make yourself comfy.

When I started using an action camera to record my biking, someone asked me if it was possible to play the video back at the local cinema. I will call this guy Dave, because that’s his name but it also has a degree of anonymity because it’s a popular name. At time I was working at a local cinema, which had recently changed all the film projectors for digital projectors. I doubt Dave was being completely serious about the idea, but it set me thinking about the possibilities.

I present a work-flow to convert the output of my camera (CamSports HD-S 720p). Reasonably you could use any digital video camera if you make the appropriate adjustments to the conforming instructions.

I use Ubuntu as my “mostly-used” operating system, this is tested on version 12.10. It should work on most, if not all, Debian-type distributions. An advantage of using linux for this task is that you don’t need to be worried about file-size or filename limitations, because you can save directly on to an EXT3 formatted disc, with an MBR type partition table.
You need lots of disk space, as you will be converting your video to a sequence of still frames, and doing conversions on that. The sound will grow in size too, because D-Cinema does not understand compressed sound (AC3, DTS and SDDS are so ‘old hat’). Consider having your OS installed on an SSD, with your workspace on a big “traditional” hard disk.

Installing the software, and general preparation.

Visit http://www.opendcp.org/ and download the corresponding package for your system. Install it manually:

sudo dpkg -i opendcp_0.27.1_xubuntu1210_i386.deb

If you get errors about other packages not being installed, they can usually be fixed with this command:

apt-get -f install

There are some other packages you will need:

sudo apt-get install openjpeg-tools
sudo apt-get install imagemagick
sudo apt-get install sox
sudo apt-get install ffmpeg

I am not sure if OpenDCP needs openjpeg-tools, but it’s useful to be able to sample check your JPEG2000 encoded frames.

Some other preparation, make yourself a work folder and some sub-folders within:

mkdir DCP_Project
cd DCP_Project
mkdir audio
mkdir tiff
mkdir j2k
mkdir mxf
mkdir dcp

Copy your video file in to the DCP_Project folder.

Conforming your source file.

This is where you will adjust your video and audio, to make it fit within the rigid formats D-Cinema uses. In this example I am using the file “20120624.mp4”. The first step is to use ffmpeg to convert the video in to a series of individual frames. Notice that I sneak in a frame-rate conversion here too:

ffmpeg -y -i 20120624.mp4 -an -r 24 -pix_fmt rgb24 -vcodec tiff tiff/%08d.tiff

These frames are all the wrong size, and need tiny black bars left and right. The target is a vanilla 2k, JPEG2000, 2D, 24fps DCP.

cd tiff
mogrify -resize 1920x1080 *.tiff
mogrify -border 39x0 -bordercolor Black *.tiff
cd ..

The frames should all be 1998×1080 pixels which corresponds to the “flat” DCI format.

The next job is the audio. My camera records one sound channel only, and it does that badly. For simplicity’s sake I will make that channel appear on the centre (screen) channel in the cinema, and supply silence for the other 5 channels:

ffmpeg -y -i 20120624.mp4 -acodec pcm_s24le -ar 48000 audio/audio.wav
cd audio
sox audio.wav left.wav remix 0
sox audio.wav right.wav remix 0
sox audio.wav center.wav remix 1
sox audio.wav sub.wav remix 0
sox audio.wav surrleft.wav remix 0
sox audio.wav surrright.wav remix 0
cd ..

Converting and creating the DCP.

Start the OpenDCP application and select the JPEG2000 tab. The default options should be correct (OpenJPEG, Cinema 2K, 24 frame rate, 125Mb/s bandwidth, sRGB source, X’Y’Z’ Transform, DPX Logarithmic does not matter for tiff input, DCI Resize: None).
Set the input directory to your “tiff” folder, and the output folder to your “j2k” folder. Click on Convert, and wait.

Optional: Check one or two sample images from the “j2k” folder, by opening them in GIMP.

In OpenDCP select the MXF tab next. Convert the sequence of JPEG2000 images (“j2k” folder) in to an MXF file. The options should be JPEG2000, SMPTE, frame rate 24. Leave Stereoscopic and Slideshow unselected. Set the picture input to your “j2k” folder, and the output should have filename “video.mxf” in the “mxf” folder.

Staying with the MXF tab, change the type option to “WAV” and select input type “Mono” and output type “5.1”. There are now six input files required (in order):
Left
Right
Center
Sub
Left Surround
Right Surround
Match those up with the six files created with sox earlier. Set the output file to be “audio.mxf” to be saved in the “mxf” folder, and create the MXF file.

Optional: Check listen to the audio.mxf using VLC.

This project does not have subtitles, so skip over that step and go to the DCP tab.

Use the Title Generator, as the DCI specification has a tightly controlled title naming system. This project is a “short” so that would be a good type or kind for setting up the Composition Parameters.
Adding a XML Digital Signature is a good idea, it detects if your DCP has been corrupted in transit. You might find the process of creating that signature seems to hang at 99%. This is a known issue with OpenDCP right now.
As this project only has one “reel” just fill in the Picture source (“video.mxf”) and Sound source (“audio.mxf”). Leave the Subtitle source blank. You might notice that frame counts are not the same, reduce the largest to make it the same as the smallest. This depends on your source material, and may also depend on the phase of the moon.
Create your DCP, and you’re nearly finished.

As you are using linux, you can use gparted to create your distribution disc (MBR partition table, EXT3 format) and copy over your completed Digital Cinema Package. A good thing is to create a folder with the same name as the package, and put the six files in that folder. In my example I created a DCP called “20120624_SHR_F_EN-XX_UK-U_51_2K_20130324_OPE_2D_OV” so I put all the files in a folder of that name.

Unmount the drive, and send it to your cinema.

Optional verification step.

You could follow the instructions at
https://github.com/wolfgangw/digital_cinema_tools_distribution/wiki/Setup
to check what you have created.

The general form of the command is to point it at the folder containing your DCP. Using my example:

dcp_inspect dcp

This gives the following output:

 dcp_inspect v1.2013.03.22: ["dcp"]
 Found 1 Assetmap candidate: ["ASSETMAP.xml"]
 AM 118cd216-6685-4f58-98ec-12f8dfb89bb3: Schema check: OK: dcp/ASSETMAP.xml

 Found 1 Assetmap
 Assetmap 118cd216-6685-4f58-98ec-12f8dfb89bb3: ASSETMAP.xml
 Assetmap 118cd216-6685-4f58-98ec-12f8dfb89bb3 lists 4 assets:
 e508a2c6-b28b-4ff8-8b7d-7bbf0bf152b4: e508a2c6-b28b-4ff8-8b7d-7bbf0bf152b4_pkl.xml
 ea68ce2b-a73a-45d3-ba8b-3a6059de7351: ea68ce2b-a73a-45d3-ba8b-3a6059de7351_cpl.xml
 c07f1811-7c8b-4d79-8920-d465c967bf02: video.mxf
 f05fef5c-86d4-4283-b19e-8dfa54c6bf2e: audio.mxf
 Assetmap 118cd216-6685-4f58-98ec-12f8dfb89bb3 lists 1 PKL:
 PKL file present: e508a2c6-b28b-4ff8-8b7d-7bbf0bf152b4: dcp/e508a2c6-b28b-4ff8-8b7d-7bbf0bf152b4_pkl.xml

 Found 1 Package
 PKL file present: e508a2c6-b28b-4ff8-8b7d-7bbf0bf152b4: dcp/e508a2c6-b28b-4ff8-8b7d-7bbf0bf152b4_pkl.xml

 PKL e508a2c6-b28b-4ff8-8b7d-7bbf0bf152b4: dcp/e508a2c6-b28b-4ff8-8b7d-7bbf0bf152b4_pkl.xml
 PKL e508a2c6-b28b-4ff8-8b7d-7bbf0bf152b4: Schema check: OK
 PKL e508a2c6-b28b-4ff8-8b7d-7bbf0bf152b4: Signature check: OK
 Signer:        /O=opendcp.org/OU=OpenDCP/CN=CS.opendcp.certificate.0.DCP/dnQualifier=1FPyevRn3ByXjBQLxlW93CoVobs=
 Signer issuer: /O=opendcp.org/OU=OpenDCP/CN=.opendcp.certificate.1.INTERMEDIATE/dnQualifier=oTcukRMxC8VtoIFyCQO9IpB9tDY=
 PKL e508a2c6-b28b-4ff8-8b7d-7bbf0bf152b4 lists 3 assets
 c07f1811-7c8b-4d79-8920-d465c967bf02: application/mxf: video.mxf
 c07f1811-7c8b-4d79-8920-d465c967bf02: Checking hash value: OK                                                       
 f05fef5c-86d4-4283-b19e-8dfa54c6bf2e: application/mxf: audio.mxf
 f05fef5c-86d4-4283-b19e-8dfa54c6bf2e: Checking hash value: OK                                                       
 ea68ce2b-a73a-45d3-ba8b-3a6059de7351: text/xml: ea68ce2b-a73a-45d3-ba8b-3a6059de7351_cpl.xml
 ea68ce2b-a73a-45d3-ba8b-3a6059de7351: Checking hash value: OK                                                       
 PKL e508a2c6-b28b-4ff8-8b7d-7bbf0bf152b4: Package size: 551.6 MB
 PKL e508a2c6-b28b-4ff8-8b7d-7bbf0bf152b4 lists 1 composition
 CPL file present: ea68ce2b-a73a-45d3-ba8b-3a6059de7351: dcp/ea68ce2b-a73a-45d3-ba8b-3a6059de7351_cpl.xml

 Found 1 Composition
 CPL file present: ea68ce2b-a73a-45d3-ba8b-3a6059de7351: dcp/ea68ce2b-a73a-45d3-ba8b-3a6059de7351_cpl.xml

 CPL ea68ce2b-a73a-45d3-ba8b-3a6059de7351: Schema check: OK
 CPL ea68ce2b-a73a-45d3-ba8b-3a6059de7351: Signature check: OK
 Signer:           /O=opendcp.org/OU=OpenDCP/CN=CS.opendcp.certificate.0.DCP/dnQualifier=1FPyevRn3ByXjBQLxlW93CoVobs=
 Signer issuer:    /O=opendcp.org/OU=OpenDCP/CN=.opendcp.certificate.1.INTERMEDIATE/dnQualifier=oTcukRMxC8VtoIFyCQO9IpB9tDY=
 CPL Id:           ea68ce2b-a73a-45d3-ba8b-3a6059de7351
 CPL file:         dcp/ea68ce2b-a73a-45d3-ba8b-3a6059de7351_cpl.xml
 CPL type:         SMPTE (http://www.smpte-ra.org/schemas/429-7/2006/CPL)
 ContentTitleText: 20120624_SHR_F_EN-XX_UK-U_51_2K_20130324_OPE_2D_OV
     Language audio and subtitles: EN-XX
 AnnotationText:   20120624
 ContentKind:      short
 IssueDate:        2013-03-24T05:59:50+00:00 (Sunday Mar 24 2013 05:59)
 Issuer:           <Not present>
 Creator:          OpenDCP 0.27.1
 Number of Reels:  1
 Reel 1:
   1031  00:00:42+23 @ 24/1  c07f1811-7c8b-4d79-8920-d465c967bf02  MainPicture    (SMPTE, 00:00:43+01, unencrypted, 1998x1080, pictures)
   1031  00:00:42+23 @ 24/1  f05fef5c-86d4-4283-b19e-8dfa54c6bf2e  MainSound    (SMPTE, 00:00:42+23, unencrypted, 6 channels, 48 kHz, 24 bps, audio)
 Total duration:
   1031  00:00:42+23 @ 24/1
 Composition kind: 2D/Monoscopic
 Composition type: SMPTE
 Composition complete

 Hint: CPL ea68ce2b-a73a-45d3-ba8b-3a6059de7351: Naming convention: Expected number of parts present in "20120624_SHR_F_EN-XX_UK-U_51_2K_20130324_OPE_2D_OV"
 Hint: CPL ea68ce2b-a73a-45d3-ba8b-3a6059de7351: Naming convention: 11 parts matching: {:film_title=>"20120624", :content_type=>"SHR", :aspect_ratio=>"F", :language=>"EN-XX", :territory_rating=>"UK-U", :audio_type=>"51", :resolution=>"2K", :studio=>"OPE", :date=>"20130324", :facility=>"2D", :package_type=>"OV"}
 Hint: CPL ea68ce2b-a73a-45d3-ba8b-3a6059de7351: Naming convention: 0 parts missing: {}
 Info: Inspected: /home/alexander/Videos/dcptest/dcp
 Info: Found 1 Package with total size 551.6 MB
 Info: Found 1 Assetmap, 1 Package (1 signed/1 verified), 1 Composition (1 signed/1 verified)
 Info: 0 Errors, 3 Hints

The important thing is “0 Errors”.

Obviously I’m not in a position to actually test this on a real D-Cinema system…

There are people who have had success with these tools, some examples:

http://bitfilms.blogspot.co.uk/2010/11/making-dcp-entirely-with-open-source.html
http://www.thefilmbakery.com/blog/creating-a-feature-film-dcp-using-opendcp

Finally, a big thank-you to other people like Diane Edwards, Daniel Backhouse, Andrew Bailey and Andrew Smith. You all provided me with the necessary impetus to learn the DCI specification to a much deeper understanding compared to anyone else I met during my time with Apollo Cinemas.

Getting the track listing for a K3B project.

March 22, 2013

Just a nod to Philip Yarra for figuring this out. Thank you, I found it useful.

Re-wrapping text files for the Amazon Kindle.

June 29, 2012

Please be aware there other e-book devices available. 🙂

While I’m between jobs I have found myself re-visiting some classic video games, and using game guides and walk-throughs to refresh my memory. Many of these guides are in the “old-skool” 40 column pre-wrapped text format. Here’s an example. It’s a very comprehensive guide too, but that’s by-the-by.

When I copied it to my Kindle, I found the text was being re-wrapped in an untidy way. It is because the file contains Line Feed characters, which the Kindle correctly uses to start a new line. Reaching back in to the dim and distant corners of my memory, I remembered having to solve this problem in the past.

As someone who used a RISC OS machine a lot more in the past, compared to the past 10 years or so, I turned to the Iyonix which sits on my desk next to my Linux box and started up !Zap. In a lot of ways, I still feel that !Zap has features which have not been bettered on other platforms, well not in free software anyway. The RISC OS developers sorted out USB a long time ago, so I could plug my Kindle directly in to the Iyonix and have it behave as a Mass Storage device.

The strategy is to search for any line which contains a non-zero number of characters, which is immediately followed by another line which contains a non-zero number of characters. I seem to recall that Darren Salt, one of the lead !Zap developers had suggested this years ago. (Apologies if I have that wrong).

Anyway, if you set up the search-and-replace (Shift-F4 within !Zap) with these options enabled: Raw, ‘\’ commands, Macros on.
Search:
\{\.\}\n\{\.\}

Replace:
&1 &2

Remember this will not work correctly for tables of contents, so start the search from the first line of the first paragraph, and remember to use the Forwards Replace, so it starts at the current cursor position. The relevant chapter on search and replace is here.

If any RISC OS users want to step in and improve this process, please comment.
If there is a Linux-based route to solve this problem, please let me know too.

Getting the Christmas geek on.

December 25, 2011

Firstly, I wish all readers a very happy Christmas. Or you can call it Saturnalia if you prefer.
Recently I saw this video, and I was struck by the creativity and level of effort invested by the creator. I could talk in great detail about how stepper motors can be driven at different rates to give different sounds. I could talk talk about how the simplicity of the harmonies of the sinusoidal waves give a pleasing and elegant sound – to my ears at least.
Over-riding all that is the idea that House of the Rising Sun is (for me) a classic song, from the days when musicians actually worked for a living, and wrote good music. Your mileage and musical tastes may vary.
Since I first saw that last week, I had an idea rolling around my head. There is a point in the video where that charming old oscilloscope is showing a sum of two waveforms, and the faster wave seems to be being modulated by a much slower wave. It’s at the 4 minute 20 mark from the start.
For me, this seems to be an ideal source to make an animated GIF.
I downloaded the entire video from youtube, and used the open source video editor PiTiVi to cut out the frames I wanted to re-use.
So I have a short mp4 file, and to convert it to individual frames I used mplayer:
mplayer -vo png oscope.mp4
In this command I specify that the Video Output should be in the PNG format, and to use the “oscope.mp4” file as in the input.
This gives a bunch of PNG files, all of the form “f00000001.png” where the number part increments.
The next step is to convert them to an animated GIF. I’d have liked to have used Peter Hartley’s InterGIF, but I couldn’t find find it in the standard Ubuntu repositories, and I couldn’t get it to compile on my Ubuntu box. That’s a problem for another day (or I can move the GIF files to my RISC OS box and use the RISC OS version of InterGIF).
I used ImageMagick which I installed on my Ubuntu box a long time ago:
convert -delay 3 -loop 0 f*.png OscopeLarge.gif
What this does is to take all the files which begin with “f” and are type PNG, and convert them in to a GIF file with a delay of 3 hundredths of a second between them, and that they should loop forever.
That gives a 13Mb GIF file. It’s very nice, but it’s a bit big for folk who like an ‘old skool’ animated GIF.
Going back to ImageMagick, and using the resize option:
convert -delay 3 -loop 0 -resize 640x360 f*.png OscopeMed.gif
convert -delay 3 -loop 0 -resize 320x180 f*.png OscopeSml.gif
These commands give the Medium and Small versions, which have sensible sizes of 3.5Mb and 997Kb respectively.

Update:
I’ve run the animated GIFs through Peter Hartley’s InterGIF. The medium version was reduced from 3.5Mb to 2.7Mb, and the small version was reduced from 997kb to 692kb. That’s about three-quarters in both cases. I’ve substituted the files on the server, as it will ease the load for my provider.

Trusted computing – there’s a place for it. Somewhere.

October 23, 2011

There’s been a lot of talk recently about “Trusted Computing” and UEFI secure booting.
I share the concern of most of the critics, on the grounds that when I buy my desktop PC then it is only me who decides what software runs on it.
On the other side of the discussion, will be the many companies and other organisations who (rightly) want to control what happens with their computing hardware.
There’s no need to fear UEFI.
If I’m considering buying a UEFI-enabled computer system, the first question I will ask the seller is does it allow Secure Boot to be disabled, under the user’s control? If the answer is any thing other than “Yes” then there’s no sale. Easy peasy.

 

I’m quite flexible on the subject of computer operating systems. I recognise that the idea of Microsoft’s next consumer OS having a secure boot process is (in principle) great[1]. At the same time I also give equal merit to the idea that I can (and do) use some flavour of Linux on my personal computer.

I’m not going to sit here all smug and say Linux is bullet-proof[2], but my experience has been overwhelmingly positive. Perhaps I’m biased, but I have lost count of the number of times I’ve had to clean-up Microsoft boxes due to malware infections[3].

[1] It would help the average non-technical user a lot.
[2] There are Linux viruses and malware. Thankfully they are very rare (like their hosts), and patches and new kernels are available very quickly to limit their spread.
[3] I have done this many times (gladly) for family and friends, to the point where I recommend Linux over anything else for a simple web-browsing machine for a beginner or non-technical user.

Fixing the get_iplayer script.

July 30, 2011

The get_iplayer script has a problem, it hasn’t been updated since the BBC have moved the iPlayer flash player file on their website. Without going in to the details, adequately covered here, here’s a fix:
Edit the script with your system text editor:
gedit /usr/bin/get_iplayer
Look at or near line 5827 where it has:
swfurl =>
And change it to point to the new URL of the player. The current location of the player is easy to find. A web browser will correctly follow the 301 “Moved Permanently” response to trying to HTTP GET this URL:
http://www.bbc.co.uk/emp/10player.swf?revision=18269_21576

Background:
This works in Ubuntu 11.04 Natty Narwal, I installed the get_iplayer script manually rather than using Synaptic. I think it will work in the same way if you have installed get_iplayer using Synaptic.
Please be sensible and don’t use it to download everything, be specfic about the programmes you want. Be sensible about not abusing the spirit of the iPlayer service – by deleting programmes after watching them.