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 13, 2022 · 1 min · 107 words · ARJ

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). ...

August 9, 2022 · 2 min · 285 words · ARJ

Removing audio hum using a highpass filter in FFmpeg

Today, I recorded Sound Action 194 - Rolling Dice as part of my year-long sound action project. The idea has been to do as little processing as possible to the recordings. That is because I want to capture sounds and actions as naturally as possible. The recorded files will also serve as source material for both scientific and artistic explorations later. For that reason, I only trim the recordings non-destructively using FFmpeg. ...

July 13, 2022 · 2 min · 303 words · ARJ

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.pdf and label them with something like image-001-010.png, where the first number refers to the page and the second is a count of images. ...

June 16, 2022 · 1 min · 135 words · ARJ

Em-dash is not a hyphen

I have been doing quite a lot of manuscript editing recently and realize that many people—including academics—don’t understand the differences between the symbols hyphen, en-dash, and em-dash. So here is a quick explanation: hyphen (-): is used to join words (“music-related motion”). You type this character with the Minus key on the keyboard, so it is the easiest one to use. en-dash (–): is used to explain relationships between two concepts (“action–sound couplings”) or in number series (0–100). I haven’t found a way to type this on Ubuntu, but on Windows, you can use the Alt key and press the ASCII code 0150. On Mac, you get it by pressing the Option key together with the Minus key. In Markdown and HTML code, it can be written with the command –. In LaTeX, it is written --. em-dash (—): is used to break up a sentence—like this one—and can be used instead of commas (,). On Ubuntu, it can be typed with the Alt gr key together with the Minus key. On Windows, you can use the Alt key and press the ASCII code 0151. Mac is the most logical, using the Option and Shift keys together with Minus. In Markdown and HTML code, it can be written as —. In LaTeX, it is written ---. Looking around, I see that it is actually even more complex than this. On a How-To Geek page I learned that the minus sign used in mathematics (−7) is not a hyphen but has its own ASCII code and HTML representation: −. I also learned that from a typographical perspective, there are also “non-breaking hyphens” (‑), “figure dash” (‒), and “horizontal bar” (―). ...

May 13, 2022 · 2 min · 329 words · ARJ

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). That was achieved with this one-liner: ...

April 13, 2022 · 1 min · 162 words · ARJ

Edit video rotation metadata in FFmpeg

I am recording a lot of short videos these days for my sound actions project. Sometimes the recordings end up being rotated, which is based on the orientation sensor (probably the gyroscope) of my mobile phone. This rotation is not part of the recorded video data, it is just information written into the header of the MPEG file. That also means that it is possible to change the rotation without recoding the file. It is possible to see the rotation by looking at the metadata of a file: ...

February 12, 2022 · 1 min · 157 words · ARJ
Frame differencing image of dancer.

Frame differencing with FFmpeg

I often want to create motion videos, that is, videos that only show what changed between frames. Such videos are nice to look at, and so-called “frame differencing” is also the start point for many computer vision algorithms. We have made several tools for creating motion videos (and more) at the University of Oslo: the standalone VideoAnalysis app (Win/Mac) and the different versions of the Musical Gestures Toolbox. These are all great tools, but sometimes it would be nice also to create motion videos in the terminal using FFmpeg. ...

January 9, 2022 · 2 min · 246 words · ARJ

Pre-processing Garmin VIRB 360 recordings with FFmpeg

I have previously written about how it is possible to “flatten” a Ricoh Theta+ recording using FFmpeg. Now, I have spent some time exploring how to process some recordings from a Garmin VIRB camera. Some hours of recordings The starting point was a bunch of recordings from our recent MusicLab Copenhagen featuring the amazing Danish String Quartet. A team of RITMO researchers went to Copenhagen and captured the quartet in both rehearsal and performance. We have data and media from motion capture, eye tracking, physiological sensing, audio, video, and more. The plan is to make it all available on OSF. ...

December 21, 2021 · 6 min · 1191 words · ARJ

How to use quotation marks in academic writing

Quotation marks are used for different things in texts. Sometimes they are used to mark actual quotations, things that people have said and written. Other times they are used to mark a word, such as this is “funny”. Some people also use them to Single vs double quotes There is not a right or wrong when it comes to using single (’) or double (") quotes. Different style guides say different things, so use whatever is suggested. In any case, the most important is being consistent. ...

November 10, 2021 · 1 min · 146 words · ARJ