Finding duration and pixel dimensions for a bunch of video files

As part of my #StillStanding project I need to handle a lot of video files on a daily basis. Today, I wanted to check the duration and pixel dimensions of a bunch of files in different folders. As always, I turned to FFmpeg, or more specifically FFprobe, for help. However, figuring out all the details of how to get out the right information is tricky. So I decided to ask ChatGPT for help....

August 2, 2023 · 2 min · 307 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

Video visualizations of mountain walking

After exploring some visualizations of kayaking, I was eager to see how a similar approach could work for walking. On a trip to the Norwegian mountains, specifically at Haugastøl, situated halfway between Oslo and Bergen, I strapped a GoPro Hero Black 10 on my chest and walked up and down a nearby hill called Storevarden. The walk was approximately 25 minutes up and down, and a fast-forward version of the video can be seen here:...

July 17, 2022 · 2 min · 319 words · ARJ

Kayak motion analysis with video-based horizon leveling

Last year, I wrote about video-based motion analysis of kayaking. Those videos were recorded with a GoPro Hero 8 and I tested some of the video visualization methods of the Musical Gestures Toolbox for Python. This summer I am testing out some 360 cameras for my upcoming AMBIENT project. I thought I should take one of these, a GoPro Max, out for some kayaking in the Oslo fjord. Here are some impressions of the trip (and recording)....

July 13, 2022 · 3 min · 590 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

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

June 11, 2022 · 6 min · 1193 words · ARJ

Merge multiple MP4 files

I have been doing several long recordings with GoPro cameras recently. The cameras automatically split the recordings into 4GB files, which leaves me with a myriad of files to work with. I have therefore made a script to help with the pre-processing of the files. This is somewhat similar to the script I made to convert MXF files to MP4, but with better handling of the temp file for storing information about the files to merge:...

March 31, 2022 · 1 min · 168 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....

February 12, 2022 · 1 min · 157 words · ARJ

Preparing videos for FutureLearn courses

This week we started up our new online course, Motion Capture: The Art of Studying Human Activity, and we are also rerunning Music Moves: Why Does Music Make You Move? for the seventh time. Most of the material for these courses is premade, but we record a new wrap-up video at the end of each week. This makes it possible to answer questions that have been posed during the week and add some new and relevant material....

January 28, 2022 · 2 min · 376 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