Sunday, 18 November 2012

HOWTO: Cut the end off a video file using ffmpeg

I had a video file from which I needed to cut the end off from a specific point. I didn't want to use a video editor since it seemed a simple enough task, so I went look for alternate solutions.

The following page gave me a solution using ffmpeg:
http://quickhowto.blogspot.com.au/2011/02/how-to-truncate-video-using-command.html

ffmpeg -vcodec copy -acodec copy -i [inputfile] -ss [start] -t [duration] [outputfile]

My first attempt failed because I specified a duration of 36 seconds and I wanted 36 minutes. Reading ffmpeg's man page confirmed that the duration needs to be specified in the format hh:mm:ss. In my case I needed "00:36:00".

Monday, 12 November 2012

FLOSS advertisements here

My blog tends to be quite sparse because I don't like to tell people about myself. However I realise I use some cool FLOSS which others may not know about. So .... I'm going to start advertising FLOSS here on my blog. Prepare yourselves for an onslaught of stuff. :)

Sunday, 11 November 2012

HOWTO: Store notes online and offline

I have mentioned on this blog several methods of storing notes so that they're available both online and offline. Since when online I usually have a browser open, it seems logical to seek browser-based solutions to the problem. The problem then was how to make these same notes available when offline. So far none of the services I have tried offered all the features I wanted.

Help is here, though, because I have thought of another method and am trialing this now. I won't go into a long explanation as to why I'm trying this method or how to set it up but simply present my current solution:

Installation Method

  1. Install Dropbox client
  2. Create a subdirectory in the Dropbox directory to contain the notes

Storage of notes
Individual notes are created as plain text files and stored in the "notes" directory (or a sub-directory).

Searching
Use the command-line tool 'grep' to search notes' content. An optional feature would be to added specially mark-up "tags" so that you could search by tag, finding matching notes. Example tags could include "todo", "project", "howto".

Formatting
While the notes themselves are plain text files, an optional extra is to use the Markdown markup method to apply formatting. When viewed in a text editor they are still easily read but when viewed using a Markdown viewer, their formatting makes complex notes more legible. One method is to install a Markdown viewer in your browser, give each note with Markdown markup an ".md" extension and associate files with an ".md" extension with the browser. I can then easily browse my notes in a file manager and easily view their contents.

Although I am using Dropbox in my current experiment, I could use a FLOSS alternative.

The beauty of this approach is that it is cross-platform, since each component is itself cross-platform.

Thursday, 1 November 2012

HOWTO: Create a simple, private online photo slideshow

TL;DR I can recommend PhotoSwipe to anyone who needs to create an online photo slideshow on their own web host.
I was recently asked to create an online photo slideshow. Despite being web savvy, I had never done anything like this so I asked my colleagues for suggestions. As a result I used PhotoSwipe, and found it was incredibly easy to get working. All I needed was a web host and access to upload the files which made up the slideshow application.
The steps required were:
  1. Download PhotoSwipe;
  2. Extract the contents of the PhotoSwipe zip file;
  3. Upload PhotoSwipe to a folder on the web host;
  4. Edit the index.html with the names of the images and configuration options;
  5. Upload the images.
Other hosted options such as Dropbox's native slideshow option would have achieved a similar result but in my case I needed to keep the slideshow private.

Tuesday, 17 January 2012

Troubleshooting GDM error message "Oh no! Something has gone wrong"

After a recent update of several packages I booted and instead of the GDM's login screen it showed me a full-screen error message featuring a wonderfully smiling monitor: "Oh no! Something has gone wrong." My first reaction was to panic but I soon calmed down. My problem was that I had never seen a fatal message like this from GDM and so didn't know how to diagnose the problem. I Googled the title of the message and found that the following log file should contain any detailed error messages that GDM is reporting.

/var/log/gdm/:0-greeter.log


I successfully logged in at a console (i.e. non-GDM) by appending "3" to the GRUB kernel line (which specifies the run level to be booted into). I then looked at the above log file and, amongst the messages found that the file "/usr/share/gnome-shell/theme/gdm.css" was reported missing. I confirmed that that file was not there. I'm not sure what package is supposed to contain it but from doing a "pacman-g2 -Qo <file>" on other files in the same directory, it seems it should have come with the Frugalware GDM theme. For the moment I copied this file from another distribution, logged out and rebooted. This time GDM started as normal and I could log in.

Problem solved! \O/

Monday, 31 October 2011

Online web-based notes

In a previous blog entry (http://phayz.wordpress.com/2011/04/11/online-and-offline-notes-for-chromeium/) I wrote that I had been trying to find a way of maintaining notes using the Chrom(e|ium) web browser. I wanted to be able to make a note of little bits and pieces of information via my web browser *plus* have these available when I was offline. At the time I settled on the Scratchpad extension because it did what I wanted and had a bonus of keeping notes in sync on Google Docs.

After a little while I stopped using Scratchpad because I didn't like how it looked, nor how it stored the notes on Google Docs. I later tried the SpringPad web service but this was much more than I wanted and offered an offline option only if using Chrome (or Chromium). I didn't want my choice limited by the browser I was using at the time. For the moment I am using a web-based service named SimpleNote (http://simple-note.appspot.com) because it's very simple but offers searching of notes. It doesn't work offline unfortunately but I usually need these notes when the PC is on and I have Internet connectivity most of the time. If I am desperate I could try one of the third-party applications which allow for notes to be exported.

Once again I'm happy at the moment with my choice. I may change my mind again, so be prepared for future blog entries on the topic. :D

Friday, 28 October 2011

HOWTO: Rotate a video using ffmpeg

Note:I am using Linux and have not tested this on other operating systems, so your results may vary.

I recently received a video from someone with a request to post it to a video hosting site. It all sounded simple until I found that the video had been recorded using an iPad in landscape mode so when I played the video the image was rotated. Before posting it I was going to have to rotate the video so that playback looked normal but how was I going to do that?

I first considered a video editor but the ones I considered had too many dependencies so I continued my search and eventually found a solution here: http://stackoverflow.com/questions/3937387/rotating-videos-with-ffmpeg, which gave instructions on using ffmpeg's "transpose" feature to rotate the video.

For my task here's the command line I used. This is to entered as one line, but may be appear wrapped in your browser:
ffmpeg -i <input_video_filename> -vf "transpose=1" -r 30 -sameq -acodec copy <output_video_filename>

The "transpose" function is one of ffmpeg's many video filters which, according to the ffmpeg man page is used to "Transpose rows with columns in the input video and optionally flip it." Below is a list of other transpose parameters and what they do. For full details, refer to the transpose video filter section of ffmpeg's man page for details of the necessary values.


0 = 90CounterCLockwise and Vertical Flip (default)
1 = 90Clockwise
2 = 90CounterClockwise
3 = 90Clockwise and Vertical Flip


Note: In this example I used three additional parameters:

  • "-acodec copy" parameter, which instructs ffmpeg to copy the audio, not process it again (Note: Thanks to a comment on this blog entry from Tim;

  • "-sameq" parameter so that the video's original quality was not lost during the rotation because without it ffmpeg degraded quality;

  • "-r 30" to maintain a framerate of 30 frames per second.