Read my book

I wrote books about Webpack and React. Check them out!

Wednesday, September 1, 2010

Book Review - Python Multimedia: Beginner's Guide

Disclaimer: I received a digital review copy of this book from the publisher, Packt Publishing.
This time I will be taking a look at "Python Multimedia: Beginner's Guide" by Ninad Sathaye. It's a part of Packt's "Beginner's Guide" series that focuses on learning by doing. The idea is that a complete newcomer should be able to pick the book and start rocking. This is apparent in the highly detailed explanations of the book. You certainly won't be left to your own devices!

The book shows how to perform various multimedia (still images, video, audio) related tasks in sort of a recipe form. The freely available example chapter and articles [1][2][3][4][5] illustrate the approach chosen. Table of contents gives a nice overview on issues covered.

I believe those new to Python and multimedia in general have the most to gain by studying the examples shown in the book. They should provide enough inspiration for tackling more difficult problems. I do think, however, that it's a bit lacking from an advanced user's point of view. Some may also find the approach and writing style used problematic.

I will expand on these thoughts next as I share my impressions with the book with you next.


Impressions

Approach

I am a bit torn by the approach used in the book. There are plenty of useful, albeit verbose, examples in the book. I believe it would have been beneficial to have some solid, clear theory included. In my view it helps a lot if you understand the basics of the domain you are dealing with before delving into it. Each domain has its own assumptions that are best explained in detail.

As it is the theory has been interspersed amongst the examples. This is true particularly for the image manipulation and animation sections. I found the explanation of the architecture of GStreamer adequate, though.

Content

The book covers a nice range of various multimedia related topics including image manipulation (PIL), animation (Pyglet), audio (GStreamer) and video (GStreamer). Considering this is more of a cook book I would have appreciated simple recipes on the following issues:
  • How to use numpy and PIL to generate images (pixel-wise image generation)?
  • How to set up a scene graph and how to use it?
  • How to use particles (Lepton?) in Pyglet?
  • How to handle collision detection and physics (pymunk?) in Pyglet?
In addition I would have found some sort of overview of currently available libraries and their capabilities useful.

Even though the book uses Pyglet in some of its examples it really doesn't get into 3d. I can understand this as  the subject would easily deserve a book of its own.

I found it nice that the book shows how to use PyQt in various examples (thumbnail maker, audio player, video player). Perhaps it would have been interesting to use some other library for implementing the UI for thumbnail maker for instance just to see what kind of difference it makes. I'm fine with PyQT, though.

Code

The book depends quite heavily on additional code available from Packt. There were times when naming used in the book did not match the names of the files. This was particularly true for media files (images and such).

There were times when I felt the code could use some cleaning up. For example the naming of methods and variables did not conform with PEP-8 as they were in camelCase. In some cases I would have been inclined to compose the code a bit differently and use more template driven programming. I guess this issue comes down to programming style to some extent.

It was also a bit curious to see absolute paths being used in various examples. It would have been nicer to use relative paths instead. Fortunately it's easy to work around this issue just by using a trick like "nom_path = os.path.join(sys.path[0], "Nom nom nom.mp3")" .

Writing Style

If there's one word to describe the writing style used it would be "verbose". At times paragraphs just felt too long. The sentence structures used felt a bit awkward at times.

I highly recommend checking out the sample chapter and articles I linked to earlier in order to see if the author's style is fitting for you.

Verdict

If you are looking for a cook book on various multimedia related tasks, I believe "Python Multimedia: Beginner's Guide" just might fit the bill. I think a lot depends on whether or not you are comfortable with the approach and writing style used. The book didn't do the trick for me but perhaps it works for someone else.