Timesaver: import and combine GoPro Footage with FFmpeg

I’ve been taking my GoPro to Sunday Morning Football (as it is known) for a while now, so I figured I’d automate the process of importing the footage (moving it from microSD) and combining it into one file (GoPro splits recordings by default).

So I have the following script:


DATE="$(date +%Y-%m-%d)"

if [ -e $GOPRO ]; then
        echo "Copying..."
        rsync -aP --info=progress2 --remove-source-files --include='*.MP4' $GOPRO/DCIM/100GOPRO/ $VIDEO_DEST/
        echo "Joining..."
        cd $VIDEO_DEST
        #cd $GOPRO/DCIM/100GOPRO/
        for file in `ls *.MP4`; do echo "file '$file'" >> stitch.txt; done
        #RECORD_DATE="$(ffprobe -v quiet `ls *.MP4 | head -n1` -show_entries stream=index,codec_type:stream_tags=creation_time:format_tags=creation_time | grep creation_time | head -n1| cut -d '=' -f 2| cut -d ' ' -f1)"
        # new format:
        RECORD_DATE="$(ffprobe -v quiet `ls *.MP4 | head -n1` -show_entries stream=index,codec_type:stream_tags=creation_time:format_tags=creation_time | grep creation_time | head -n1| cut -d '=' -f 2| cut -d ' ' -f1| cut -d 'T' -f1)"
        #echo "$RECORD_DATE"
        ffmpeg -y -f concat -i stitch.txt -c copy $RECORD_DATE.mp4
        echo "GoPro microSD not mounted?"


  • the microSD is already mounted before running (under /tmp/gopro) – I had considered automating this, but I figured running a script in response to insertion of removable media was a bad idea; I could add the mkdir and mount commands here, but since the latter requires root privileges I’d rather not and it is quickly recalled from bash history in any case
    • the $VIDEO_BASE directory is mounted and created (this is pretty stable)
    • the GoPro won’t number directories higher than 100GOPRO (eg 101GOPRO)- it possibly would if dealing with eg timelapse, but I am not covering that case
    • the GoPro will set creation time correctly; so far it has reset to the default date a few times, probably related to battery
    • I want to keep the source files around after creation (the script could remove them)

Given the above the script may seem a bit fragile – and it is definitely tightly coupled to my assumptions – but it’s done the job for a few weeks at least, and the commands it was based on have been pretty stable since I started recording football last year.

[Fixed] FTL – Blank Maps & Invisible Ships Problem

Update: fixed! The recently-released FTL by Subset Games has a problem with the 12.8 AMD Catalyst Drivers, whereby the jump map and enemy ships are not rendered See below) due to an issue with edge detection in anti-aliasing. The fix is to create a custom profile for FTLGame.exe in the Catalyst Control Center to over-ride the settings (support thread with instructions, and setting).


FTL Game - Invisible Ship

Update: Now with video!

(yes the overlaps the menu, but there’s not much interesting there anyway!)

Scrollback / Terminal History in screen or byobu

This is another case of “should have read the manual”, but there are ways to see previous output in both screen and byobu.

In screen: ctrl + a + [
In byobu: F7

These key combinations cause screen/byobu to enter copy mode, where you can navigate using vi keys, can set marks for copying using return and the like.

This should have been blindingly obvious, but I guess years ago I got used to using screen without scrollback. There more you know… the more it seems that you don’t know anything at all.

Plex Media Server Warning ‘Not Found’ Errors (Fixed)

The media browser on my LG TV has been acting up recently. Instead of listing the categories set up in Plex it pops up a dialog saying “Warning: Not Found”. It does this despite being able to see the Plex Media Server (going to ‘bowse sources’ or similar brings up the server’s name but selecting it gives the same error).

Fortunately Dunhillsmoker on the Plex forums had a solution:

  1. Stop plex service – sudo service plexmediaserver stop
  2. In Plex Plugins directory remove System and Framework bundle directories:
    • mv /var/lib/plexmediaserver/Library/Application\ Support/Plex\ Media\ Server/Plug-ins/System.bundle/ ~/plex
    • mv /var/lib/plexmediaserver/Library/Application\ Support/Plex\ Media\ Server/Plug-ins/Framework.bundle/ ~/plex
    • (note, depending on permissions you may need ot be root to do this)

    • Start plex service again: sudo service plexmediaserver start
    • This sorted the problem for me.

Adding Workspaces / Virtual Desktops in Cinnamon

Mousing to the “hot corner” in Cinnamon gives an overview of current workspaces, à la expose. Unfortunately a careless click can close one of those workspaces, as I found out last night. Equally, you may feel that the default 2 workspaces is too few and wish to expand upon that. Now, I think the numvber of workspaces should increase automatically*, but it’s nice to control such things. Unfortunately there is no “control panel” option to control the number of virtual desktops, and right clicking the workspace changer widget in the toolbar doesn’t seem to have any useful effect.

However, hit Ctrl+Alt+Down and there should be a ‘+’ icon on the right hand side which will add as many workspaces as you require.

Update: Apparently the hot-corner expose has the plus to add workspaces too. I guess I just didn’t see it there! Cheers James.

Lenny to Squeeze Upgrade Problems

saved my server. It wasn’t booting after an upgrade to Debian Squeeze, despite following the upgrade instructions. Connecting to the serial console showed there were problems with finding root (grub error while parsing number, error 23) which was at md1.

Changing the first line to root (hd0,0) and adding initrd /boot/initrd.img-2.6.32-5-amd64 allowed the system to boot normally. I’m not sure why grub-setup didn’t add the initrd line, but I can forgive that as it’s working now.

Remember to update grub’s config once you have it booting.

Solved: No Files In MPD (eg mpc ls)

I was doing my initial “is it working?” tests after reinstalling mpc, and mpc ls was not giving me any output. ncmpc was also showing no files. What I didn’t appreciate was that the music database is no populated by default- you have to issue an “update” command manually (or semi-manually by running a client that issues the command for you).

mpc update

and your directories should be searched!

Show Progress Bar During dd Copy

There are a number of ways of showing the progress of a dd copy. The easiest is sending the USER1 signal to the dd process, like:

dd if=FILE1 of=FILE2
pkill -USER1 dd

But that only gives a current status – eg 12345678 bytes transferred (11.77MB) … [8.56MB/s]. Not that helpful if you want an ongoing update. You can make it periodic by using the watch command:

watch -n 10 pkill -USR1 dd

Still not perfect. If you want a progress bar, ETA and so forth, you’re best off using pv, a utility that measures the speed of a file through a pipe. If you don’t know what that means, I’d recommend reading up on the UNIX philosophy and pipes, but basically it means you can tell what dd is doing. Use it like so:

pv FILE1 | dd of=FILE2

For my use, backing up a 500GB hard drive that I use with a NAS (an NSLU2 I’ve probably mentioned before), I used the following command:

sudo pv /dev/sde3 |dd of=~/tera/nslu2.img

/dev/de3 is the data partition on the drive
~/tera/nslu2.img is the image file I want written to a terabyte-sized hard drive, mounted at ~/tera/.

As a post-script, the reason I’m backing this drive up is my nslu2 is failing weirdly. It was running without a hitch for years, then it without apparent warning dismounted the drive in slot1 and reverted to running from flash. I only figured that out as I had to log in with an old password. Trying to start it up results in it beeping once every minute or so, with the ready status lamp flashing orange. It seems to go through a loop. I thought it was a temporary glitch, as when I plugged the drive into my desktop to check the thing was intact the partitions showed up, then when I plugged it back into the nslu2 and turned it on it worked fine.

That was 3 nights ago. This evening it’s done the same thing, except repeating the steps didn’t sort it out. Running the drive through some brief SMART diagnostics and a partition check shows up no problems, so I’m inclined to believe the problem lies in the nslu2. I’ll post again if I can sort it, but at this stage I think a re-flashing is in order. Only problem is I can’t remember what firmware I flashed onto the nslu2 in the first place. D’oh!