Todotxt on Android and Ubuntu

I’m a big fan of good tools, however struggle to find products that fit me because there are some key constraints:

  • I use Linux (specifically Ubuntu 14.10)
  • I don’t use a pointing device. At all. If I can’t use a tool from the keyboard, I can’t use it at all (as a side effect, I use keyboard enablers in my browser so if your website has “helper” keyboard shortcuts, I probably can’t use that either)
  • My other devices (phone, tablet, work phone) are all android

Taken together, this makes finding tools a challenge – but I’ve had good experiences with todotxt and the ecosystem around it. Continue reading

Simple Video Editing on Ubuntu

In this series of posts about my screencasting toolchain, I’ve already written about using wmctrl to resize windows accurately and about using Kazam to capture snippets of video from various applications. This post describes my adventures in trying to glue the video snippets together.

Graphical Video Editing

For most people, it probably makes sense to use a graphical video editor, such as KDEnlive, OpenShot or Pitivi. I tried the latter two and found them sufficiently crashy that I was unable to get a video out of them that I could play back. This might be a result of my total lack of knowledge of, and respect for, containers, codecs, and … really whatever else I needed to know and didn’t. I presume the crashiness was me doing something wrong as I know that others do use these tools successfully.

I’m also a commandline sort of person. I have difficulty in using a pointing device for any length of time, and I found that I was able to capture the videos tightly enough that I just needed to glue them together rather than actually edit.

Ffmpeg

Ffmpeg is a commandline linux tool that is the biggest swiss army knife of video tools you have ever seen. There’s just one problem: on ubuntu, the program called ffmpeg is actually an alias for avconv, which is a fork of ffmpeg that is missing some key elements, such as the ability to concatenate videos. The upshot of which is that I downloaded and compiled my own copy of ffmpeg for this project. Once I had that, things got easier :)

I used this guide to get my ffmpeg tool and all the dependencies set up: https://trac.ffmpeg.org/wiki/UbuntuCompilationGuide

Ffprobe

Ffprobe is a tool that looks at a video file and gives information about it. One thing that I found about combining videos is that matching resolutions and encodings are really important – sometimes you can create what looks like a valid output file, only to have it unable to play in some players. To use it:

ffprobe video.mp4

I found this very useful, so I thought I’d add a note about it here. I tested my videos in VLC, it seems a bit less tolerant than the standard gnome player, so it was a good way to check if the videos would play. There’s also a simpler version of VLC that shows fewer controls: cvlc (I found it handy).

Combining Videos with Ffmpeg

Once I had the genuine version of ffmpeg compiled, I used that to combine my videos. First of all, I created an input file which contained a list of videos. Here’s an example of my

input.txt

file:

file 'wireshark1.mp4'
file 'wireshark2.mp4'
file 'wireshark3.mp4'
file 'wireshark4.mp4'
file 'wireshark5.mp4'
file 'wireshark6.mp4'
file 'wireshark7.mp4'

(can you guess what this was a video of?)

Then I used the following command to use this input file and create a resulting video of these videos played one after another:

./ffmpeg -f concat -i input.txt -c copy wireshark-demo.mp4

This can look successful and still produce a bit of a strange video if all your video files aren’t precisely the same resolution and format, but I was able to get results pretty quickly once I knew I had to get those things right in recording. The time spent planning the videos paid back several times over, as it was easy to just recapture one piece of the sequence if the need arose.

Ffmpeg is a beast, powerful but superbly complex, and it was tough going to find the commands I needed even without the “wrong” fork of the project being the default with ubuntu! Hopefully this post will remind me next time what to do, and if it helps you too, then awesome :) Feel free to leave additional tips and tricks in the comments.

Screencasting in Ubuntu: Kazam

If you’ve ever seen a live demo, you will know that these things are fraught with danger. Even if the wifi works, the presenter knows what they are doing, and nothing crashes, you’ll often end up watching someone explaining something to their laptop in detail, or clearly demonstrating their inability to type. Either way, it doesn’t make good, informative content, which is why I never ever demo in a conference talk – I’m there to entertain and time is always of the essence. At this point, you can probably guess why I’m writing a blog post about my screencasting toolchain – I simply pre-record whatever it is that I want to show in the talk.

On an ubuntu platform, I’ve had a few false starts with video over the years, and mostly avoided it. But now my “Debugging HTTP” talk really does make more sense if you can see the process of something broken, what the tools show, and how to understand that information and fix the problem.

Kazam

kazam-close Continue reading

Accurate Ubuntu Window Sizing with Wmctrl

I’m working on a bunch of screencasts at the moment (more posts to come) and one of the things that tripped me up the most was getting all the windows the same size, so that the resulting videos are the same size and can easily be put back together. Enter wmctrl, a very nice linux tool that can do all of this for me.

I’m aiming to have a series of windows all sized at 800×600, and the first step is to look at a list of windows in wmctrl:

wmctrl -lG

wmctrl-lg

The -l switch provides a list, and the -G switch shows the geometry of the windows. This is especially useful if you want to place something on a second monitor, you can look where a correctly-placed window would go and then use those co-ordinates! Also beware that windows positioned at the origin of a desktop space rarely end up where you expect them to go.

To set a new geometry for a window, we use the -e switch to specify what that should be. The format is:

"gravity, X, Y, width, height"

For gravity, try zero. X and Y are the co-ordinates of the top left hand corner of the window, and width and height hopefully you can guess. It’s also acceptable to pass -1 for any of these values for the window to retain its current setting.

To specify a window, we use the -r switch to indicate to wmctrl which window wants the resize. You can give the title of the window, or the identifier shown in the list output, but I found it most useful to use the special value ":SELECT:" and then just click on the window I wanted to affect. Therefore the command I used the most became:

wmctrl -r ":SELECT:" -e "0, -1, -1, 800, 600"

As a final tip, make sure (by resizing the window to something definitely smaller than the desktop it is on) that the window is not maximised – if it is, it will stay that way and you will wonder what you are doing wrong.

The Tree Command

Today I’m working on a little tutorial (about writing RESTful services, for this site) and I used the tree command to illustrate the file and directory layout of the project. I love this little command and use it frequently, but it isn’t very well known so here’s a quick example. Continue reading

Gearman Priorities And Persistent Storage

I have been writing a bit about Gearman lately, including installing it for PHP and Ubuntu, actually using it from PHP and also how I use persistent storage with Gearman. I’m moving on to look at adding jobs of different priorities.

I use Gearman entirely as a point to introduce asynchronous-ness in my application. There is a complicated and image-heavy PDF to generate and this happens on an automated schedule. To do this, I use the GearmanClient::doBackground method. This inserts a priority 1 job into my queue.

Using the doHighBackground() and the doLowBackground() methods insert jobs into the queue and checking out my persistent storage I see that the priorities work like this:

priority method
0 doHighBackground()
1 doBackground()
2 doLowBackground()

Gearman works out which task is the next highest priority and will hand it to the next available worker – which means that I can set my automated reporting lower priority than the reports requested by real live people wanting them now, and everyone is happy!

Apache on Ubuntu/Debian

Apache on Debian. Ubuntu

When I first started using Ubuntu, I was coming from a distro journey that started with FreeBSD and took in Mandrake and Gentoo along the way; I hadn’t worked with any Debian-based systems before and was new to the way that Apache is configured on those platforms.

Continue reading

Combining PDF Files With Pdftk

I’m currently delivering all my talks with PDF format slides, using Jakob’s PDF Presenter Console, which is awesome but lacks a “goto slide” button and is a little slow to click forward. It doesn’t matter for a short talk but I had 200+ slides for my ZCE preparation tutorial at the Dutch PHP Conference and I was concerned about losing my place! Therefore I split my slides up into several decks, but still need to publish them as a whole.

For years I’ve used PDF Shuffler for this sort of thing but I wondered if there was an easy way of doing this from the command line this time, since I literally wanted to glue together a bunch of files one after another. Predictably, there is and it’s called pdftk – the PDF Toolkit. Continue reading

PDF Presenter

Recently I’ve switched how I prepare and deliver presentations, using LaTeX to mark up the content and producing PDF slides from that. Which is great but I miss having some of the during-presentation functionality of LibreOffice such as a timer and being able to see what’s on the next slide. Happily for me, there’s a PDF Presenter Console on github and it does what I need!

Getting the thing installed was a bit of a puzzle as it has many dependencies (and that’s just the compiler) but I now have it working like a dream on both my laptop and my netbook. I discovered that it didn’t work with my presenter mouse but with a bit of help from a friend, I have a patch for that and now when I’m presenting I see something like this:

You can set which screen show this, and which shows just the main slide, and you can also set what duration the countdown timer should start from. One really key feature is that the timer doesn’t start counting until you advance from the first slide … unlike in open office where I usually put up the title slide during the break before my talk, then have to stop and start the presentation to reset the clock so I’ve got some vague idea of my running time!

So in true open source form, there’s a tool out there already (thanks Jakob, and thanks for responding to my emails!), and I was able to adapt it to my use case, or rather Kevin was able to! I would love to have the presenter console packaged so I could recommend it for more users, but for now I have a great open source solution enabling me to do what I’m good at – delivering content.

Installing Gearman for PHP and Ubuntu

I’ve been using Gearman lately in a project that I’m working on, and of course a month later when I came to deploy the code, I had to look up all over again what was required for a gearman server in order to put it on the new platform. Here is the short version for my future reference (and yours, if you like)

Continue reading