Below you will find pages that utilize the taxonomy term “ubuntu”
December 9, 2022
Optimizing JPEG files
I have previously written about how to resize all the images in a folder. That script was based on lossy compression of the files. However, there are also tools for optimizing image files losslessly. One approach is to use the .jpgoptim](https://github.com/tjko.jpgoptim) function available on ubuntu. Here is an excellent explanation of how it works.
Lossless optimization As part of moving my blog to Hugo, I took the opportunity to optimize all the images in all my image folders.
September 18, 2022
Convert HEIC photos to.jpg
A quick note-to-self about how I managed to download a bunch of photos from an iPhone and convert them to.jpg on my laptop running Ubuntu 22.04.
As opposed to Android phones, iPhones do not show up as a regular disk with easy access to the DCIM folder storing photos. Fortunately, Rapid Photo Downloader managed to launch the iPhone and find all the images. Unfortunately, all the files were stored as HEIC files, using the High Efficiency Image File Format.
August 13, 2022
Convert a folder of LibreOffice .ODT files to .DOCX files
I don’t spend much time in traditional “word processors”, but when I do, it is usually in LibreOffice. Then I prefer to save the files in the native .ODT format. But it happens that I need to send a bunch of files to someone that prefers .DOCX files. Instead of manually converting all the files, here is a short one-liner that does the trick using the magical pandoc, the go-to tool for converting text documents.
August 9, 2022
Add fade-in and fade-out programmatically with FFmpeg
There is always a need to add fade-in and fade-out to audio tracks. Here is a way of doing it for a bunch of video files. It may come in handy with the audio normalization script I have shown previously. That script is based on continuously normalizing the audio, which may result in some noise in the beginning and end (because there is little/no sound in those parts, hence they are normalized more).
June 16, 2022
Export images from a PDF file
I have previously written about how to export each of the pages of a PDF file as an image. That works well for, for example, presentation slides that should go on a web page. But sometimes there is a need to export only the images within a page. This can be achieved with a small command line tool called pdfimages.
One way of using it is:
pdfimages -p -png file.pdf image This will export all images in file.
June 11, 2022
Adding subtitles to videos
In my ever-growing collection of FFmpeg-related blog posts, I will today show how to add subtitles to videos. These tricks are based on the need to create a captioned version of a video I made to introduce the Workshop on NIME Archiving for the 2022 edition of the International Conference on New Interfaces for Musical Expression (NIME). This is the video I discuss in this blog post:
Note that YouTube supports turning on and off the subtitles (CC button).
April 13, 2022
Programmatically resizing a folder of images
This is a note to self about how to programmatically resize and crop many images using ImageMagick.
It all started with a folder full of photos with different pixel sizes and ratios. That is because they had been captured with various cameras and had also been manually cropped. This could be verified by running this command to print their pixel sizes:
identify -format "%wx%h\n" *.JPG Fortunately, all the images had a reasonably large pixel count, so I decided to go for a 5MP pixel count (2560x1920 in 4:3 ratio).
August 12, 2021
Soft drop shadows in LibreOffice Draw
My new book will be published Open Access, and I also aim only to use open-source tools as part of the writing process. The most challenging has been to figure out how to make nice-looking illustrations.
Parts of the book are based on the Ph.D. dissertation that I wrote a long time ago. I wrote that on a MacBook and made all the illustrations in OmniGraffle. While it was quite easy to make the switch to Ubuntu in general, OmniGraffle has been one of the few programs I have really missed in the Linux world.
March 18, 2021
Splitting audio files in the terminal
I have recently played with AudioStellar, a great tool for “sound object”-based exploration and musicking. It reminds me of CataRT, a great tool for concatenative synthesis. I used CataRT quite a lot previously, for example, in the piece Transformation. However, after I switched to Ubuntu and PD instead of OSX and Max, CataRT was no longer an option. So I got very excited when I discovered AudioStellar some weeks ago. It is lightweight and cross-platform and has some novel features that I would like to explore more in the coming weeks.
March 1, 2021
Flatten file names in the terminal
I am often dealing with folders with lots of files with weird file names. Spaces, capital letters, and so on, often cause problems. Instead of manually fixing such file names, here is a quick one-liner (found here) that can be run in the terminal (at least on Ubuntu) to solve the problem:
rename 'tr/ A-Z/-a-z/' -- * It is based on a simple regular expression, replacing any spaces with hyphens, and changing any capital letters to lower case.
January 2, 2021
Create timelapse video from images with FFmpeg
I take a lot of timelapse shots with a GoPro camera. Usually, I do this with the camera’s photo setting instead of the video setting. That is because I find it easier to delete unwanted pictures from the series that way. It also simplifies selecting individual photos when I want that. But then I need a way to create a timelapse video from the photos easily.
Here is an FFmpeg one-liner that does the job:
March 15, 2020
Flattening Ricoh Theta 360-degree videos using FFmpeg
I am continuing my explorations of the great terminal-based video tool FFmpeg. Now I wanted to see if I could “flatten” a 360-degree video recorded with a Ricoh Theta camera. These cameras contain two fisheye lenses, capturing two 180-degree videos next to each other. This results in video files like the one I show a screenshot of below.
These files are not very useful to watch or work with, so we need to somehow “flatten” them into a more meaningful video file.
February 21, 2020
Creating image masks from video file
As part of my exploration in creating multi-exposure keyframe image displays with FFmpeg and ImageMagick, I tried out a number of things that did not help solve the initial problem but still could be interesting for other things. Most interesting was the automagic creation of image masks from a video file.
I will use a contemporary dance video from the AIST Dance Video Database as an example:
The first step is to extract keyframes from the video file using this one-liner ffmpeg command:
February 21, 2020
Creating multi-exposure keyframe image displays with FFmpeg and ImageMagick
While I was testing visualization of some videos from the AIST database earlier today, I wanted to also create some “keyframe image displays”. This can be seen as a way of doing multi-exposure photography, and should be quite straightforward to do. Still it took me quite some time to figure out exactly how to implement it. It may be that I was searching for the wrong things, but in case anyone else is looking for the same, here is a quick write up.
November 29, 2019
Creating individual image files from presentation slides
How do you create full-screen images from each of the slides of a Google Docs presentation without too much manual work? For the previous blog post on my Munin keynote, I wanted to include some pictures from my 90-slide presentation. There is probably a point and click solution to this problem, but it is even more fun to use some command line tools to help out. These commands have been tested on Ubuntu 19.
September 28, 2019
Installing Ubuntu on a HP Pavilion laptop
So I decided to install Ubuntu on my daughter’s new laptop, more specifically an HP Pavilion. The choice of this particular laptop was because it looked nice, and had good specs for the money. It was first after the purchase I read all the complaints people have about the weird UEFI implementation on HP laptops. So I started the install process with some worries.
Reading on various forums, people seemed to have been doing all sorts of strange things to be able to install Ubuntu on HP laptops, including modifying the UEFI setup, changing the BIOS, and so on.
September 28, 2019
Which Linux version to choose for a 9-year old?
My 9-year old daughter is getting her first laptop. But which OS should she get started with?
I have been using various versions of Ubuntu as my main OS for around 5 years now, currently using Ubuntu Studio on my main laptop. This distro is based on XFCE, a very lightweight yet versatile OS. The reason for choosing Ubuntu Studio over the regular XUbuntu was to get a bunch of music apps by default.
May 19, 2019
Rotate lots of image on Ubuntu
I often find myself with a bunch of images that are not properly rotated. Many cameras write the rotation information to the EXIF header of the image file, but the file itself is not actually rotated. Some photo editors do this automagically when you import the files, but I prefer to copy files manually to my drive.
I therefore have a little one-liner that can rotate all the files in a folder:
November 25, 2018
Sort images based on direction (portrait/landscape)
I have lots and lots of photos on my computer (and servers!). Sometimes I have a pile of photos of which I want to find only the ones that are in portrait or landscape mode. This can be done manually for a few images, but browsing through thousands of them is more tricky. Then I often tend to use a nifty little shell script that I found here. It effectively sorts all images into two folders automagically.
May 18, 2018
Trim video files using FFmpeg
This is a note to self, and hopefully others, about how to easily and quickly trim videos without recompressing the file.
I often have long video recordings that I want to split or trim. Splitting and trimming are temporal transformations and should not be confused with the spatial transformation cropping. Cropping a video means cutting out parts of the image, and I have another blog post on cropping video files using FFmpeg.
January 3, 2017
Move windows between screens on Ubuntu
As part of the fun of reinstalling an OS, you need to set up all the small things again (and you also get rid of all the small things you had set up and that you don’t need any longer…). This message is mainly a note to self about how to move windows between screens on Ubuntu with a key combination, found at stackexchange:
Install CompizConfig Settings Manager: sudo apt install compizconfig-settings-manager compiz-plugins-extra Run Compiz from the dash Click Window Management Enable the Put plug-in (select the check-box) Click on Put Configure the shortcut for Put to next Output (click enable).
January 3, 2017
Remove standard bookmarks in Nautilus
Yet another note to self on how to fix things in Ubuntu after a fresh install, found at askubuntu, this time to remove the standard bookmarks in the Nautilus file browser. I use a different setup of folders, and don’t really need these unused bookmarks. I wish it could have been easier to just right-click and delete to remove them (like for your own bookmarks), but it turns out to be a bit more tricky.
December 27, 2016
Split PDF files easily using Ubuntu scripts
One of the fun parts of reinstalling an OS (yes, I think it is fun!), is to discover new software and new ways of doing things. As such, it works as a “digital shower”, getting rid of unnecessary stuff that has piled up.
Trying to also get rid of some physical mess, I am scanning some piles of paper documents. This leaves me with some large multi-page PDFs that I would like to split up easily.
December 27, 2016
Starting afresh
After four years as Head of Department (of Musicology at UiO), I am going back to my regular associate professor position in January. It has been a both challenging and rewarding period as HoD, during which I have learned a lot about managing people, managing budgets, understanding huge organizations, developing strategies, talking to all sorts of people at all levels in the system, and much more.
I am happy to hand over a Department in growth to the new HoD (Peter Edwards).
June 29, 2016
Shell script for compressing PDF files on Ubuntu
Back on OSX one of my favourite small programs was called PDFCompress, which compressed a large PDF file into something more manageable. There are many ways of doing this on Ubuntu as well, but nothing really as smooth as I used to on OX.
Finally I took the time to figure out how I could make a small shell script based on ghostscript. The whole script looks like this:
#!/bin/sh gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.
April 8, 2016
Finally moving from Apple's Keynote to LibreOffice Impress
Apple’s Keynote has been my preferred presentation tool for about a decade. For a long time it felt like the ideal tool, easy to use, powerful and flexible. But at some point, probably around the time when the iOS version of Keynote came along, the Mac version of Keynote started loosing features and became more limited than it had used to be. Since then, I have experienced all sorts of problems, including non-compatibility of new and old presentation file versions, problems with linked video files, crashes, etc.
August 3, 2015
Add date to files in Ubuntu
Even though I have been running Ubuntu as my main OS for more than a year now, I am still trying to figure out a good workflow. One thing I have been missing from my former OSX setup was the ability to quickly and easily prepend the date to a number of files. Having moved my files between many different OSes, hard drives, network drives, etc. over many years, I know that the files’ creation dates will break at some point.
April 12, 2015
Simple video editing in Ubuntu
I have been using Ubuntu as my main OS for the past year, but have often relied on my old MacBook for doing various things that I haven’t easily figured out how to do in Linux. One of those things is to trim video files non-destructively. This is quite simple to do in QuickTime, although Apple now forces you to save the file with a QuickTime container (.mov) even though there is still only MPEG-4 compression in the file (h.
June 4, 2010
Boot problems Ubuntu 10.04
Just as I started to believe that Ubuntu had matured to become a super-stable and grandma-friendly OS, I got an unexpected black screen on boot of Ubuntu 10.04 on a Dell Latitude D400. After some googling I have found a solution that works:
On boot, hit the `e’ button when the grub menu shows up. Then add the following after “quiet splash”: [i915.modeset=1]{style=“font-family: monospace;”}
If this works and you get into the system, you can do this procedure to change the grub loader permanently:
January 12, 2009
Triple boot on MacBook
I am back at work after a long vacation, and one of the first things I started doing this year was to reinstall several of my computers. There is nothing like a fresh start once in a while, with the added benefits of some extra hard disk space (not reinstalling all those programs I never use anyway) and performance benefits (incredible how fast a newly installed computer boots up!).
I have been testing Ubuntu on an Asus eee for a while, and have been impressed by how easy it was to install and use.