Open Source Tools for working with Audio Visual files

Posted on by

✨?Open source software for AV processing?✨

For my blog post this week, I decided to make a derivative of my upcoming code4lib talk with Ashley Blewer, and write some mini-tutorials for using some of the open source audio visual processing software that we will discuss in our talk. In this post, I’ll talk briefly about why open source tools are important in audio visual workflows, and then get right to the tutorials. The tutorials won’t be comprehensive, but I hope they provide an entryway into using open source software for working with audio visual materials.

??open source??

So first, what is open source software and why is it important to have and use? The Open Source Initiative defines it as “software that can be freely used, changed, and shared (in modified and unmodified form) by anyone.” In my personal experience using it, open source software is accessible free of charge and findable on a code repository such as GitHub. This offers an alternative to proprietary software that you have to license to use, and whose source code you don’t have access to. Personally, I’ve felt really excited about open source software since beginning my residency, but open source software isn’t for everyone, and that’s cool too.
Open source software has particular importance in the context of audio visual archiving and preservation workflows for a few reasons. First, much of the software typically used to work with audio visual materials is proprietary which leaves archivists at the whim of the software company. This is fine until the software is updated and changes in functionality, often not in favor of the work archivists do. Second, video editing software, and the software and hardware used to capture analog video signals during digitization is often costly, on top of the technological needs necessary for working with large video files like significant storage and computer processing power. By using open source software, audiovisual archivists can retain more control over their workflows, save money, and participate within a larger context of the creation of tools that serve the needs of the community.

? On to the tutorials! ?

All of these tutorials (and homebrew) are for Mac OS X… Sorry Windows and Linux users!

To begin, you’ll want to open the terminal application on your computer, and if you aren’t familiar with that, here are a few resources you might want to look at first: The Command Line crash course or Code Academy’s command line course.

There’s a few things you’ll need to do to get set up to easily use and update these technologies. I recommend installing a package manager called homebrew. Homebrew is enormously helpful in making sure that all your open source software stays up to date, and that you can always access the new versions quickly and easily. Visit this link to download homebrew.

I found the homebrew installation process fairly straightforward, and when I ran into any errors, a quick google search of the problem I was having lead me straight to a GitHub issue tracker thread with directions on how to resolve the problem I was having. I installed homebrew a long time ago, before I started my residency and knew a lot about the command line, so I’m confident that most of you will be able to download it without too many problems (if you don’t have it already!). If you have any trouble with downloading homebrew, please don’t hesitate to get in touch! If you really don’t want to download homebrew, you’ll just have to download scripts individually and move them around your computer in a way that I’m not capable of instructing…

Once you have homebrew you can download everything that I’m about to show you from the terminal application using the following command:

brew install [name of software]

To update the software that you have installed through homebrew, type brew update && brew upgrade, and all of the software that has been updated since the last time you entered that command will download to your computer:

via GIPHY

〰 ffimprovisor 〰

The first piece of software that I’m going to demonstrate is actually ffmpeg, but through a very helpful tool/interface called ffimprovisr- which was created by a team during the 2015 AMIA/DLF Hack day, and is part of the AMIA Open Source GitHub repository. ffmpeg is a powerful open source software for transcoding video, but instructions on how to implement it can be daunting to beginners. An ffmpeg command uses the following structure ffmpeg -i [file input] options (called flags) [file output]. Figuring out which flags you need to have to perform certain tasks is the difficult part. Cue ffimprovisr! ffimprovisr is a GitHub site that contains different ffmpeg commands, with instructions on what each of the flags mean, that you can cut and paste into the terminal.

If you haven’t already, install ffmpeg using homebrew: brew install ffmpeg

In this first gif, I’m creating an h264 file using the following command pasted from ffimprovisr
ffmpeg -i [input file] -c:v libx264 -c:a copy [outputfile]

ffimprovisr1

In this other gif, I’m using the following command to make an ISO to burn to a DVD using the following command: ffmpeg -i input_file -aspect 4:3 -target ntsc-dvd output_file.mpg

via GIPHY

? mediainfo/mediaconch ?

to obtain mediainfo if you do not already have it, type brew install mediainfo into the terminal

mediainfo is a helpful tool that can be used to find out information about your audio visual file, such as the codec, format, compression, scan type and order, and information about each of the audio tracks. To use mediainfo, just type mediainfo into the terminal and drag in the file. If you want the terminal output to be with XML tags, your command will look like this:

mediainfo -f –language=raw –output=xml [file]

via GIPHY

Running the command in the terminal will just output the information in the terminal, which is useful for investigating what type of file you have, but not that useful for creating metadata. To create an XML file with mediainfo metadata, I recommend using mediaconch from the command line and typing the following prompt:
mediaconch -mi -fx [input file] | xml fo > ~/Desktop/mediainfo.xml

what does this prompt do exactly? Let’s break it down piece by piece:
mediaconch – calls the mediaconch software
-mi outputs a mediainfo report
-fx formats the report to xml
| is a pipe, which connects the information from the first command into a new command
xml fo creates the xml document
> writes whatever output information to a file
~/Desktop/mediainfo.xml dictates the path to and creates the actual file on your desktop

via GIPHY

We use mediainfo and mediaconch in our workflow at CUNY TV in the makemetadata script.

MediaConch has another functionality through a GUI, where you can test the conformance of your files to a standards specification. To download the GUI (no command line needed), visit https://mediaarea.net/MediaConch/

In the example below, I’m using the GUI to test a file that I already know is not going to conform to the FFV1/Matroska standard. First, I choose a policy, and then I choose how my report will be displayed. Finally, I choose the file I want to check. The result is a policy report that tells you whether or not your video file passed.

via GIPHY

✔️ ⁉️ qc tools

QC Tools is a program that assists in finding errors in digital audio-visual files. QC Tools was initially developed in collaboration by Dave Rice, the Dance Heritage Coalition, and the Bay Area Video Coalition through an NEH grant, and has since grown into an open source project that is partnering with Indiana University to enhance QC Tools functionality. We use QC Tools at CUNY TV as a way to perform quality control on our digitized and migrated files to detect errors that may have occurred during the digitization process or that are a result of the tape itself.

To use QC Tools, download and open the software, and then drag your video file in. In the initial screen, you’ll see Y, U, and V values, as well as diff and saturation. Across the top you’ll see different check boxes, and if you hover over them, there’s an explanation of their purpose. If you spot an error or a value that seems abnormal, you can click on the frame at the bottom of the screen, which opens up a new viewer and allows you to play the file through different filters.

via GIPHY

? ? media microservices ➡️ ?

Last in this tutorial are CUNY TV’s very own media microservices. media microservices use bash and ffmpeg to transcode, package, and deliver audio visual assets. I’m going to demonstrate how to use makeyoutube, which is a short bash script that creates a youtube upload compliant file out of one or multiple file inputs. We use this script in our workflow to create access copies, which then get delivered to our webteam.

To download mediamicroservices using homebrew, type the following command into terminal:

brew install mediamicroservices/mm/mm

this gives you access to all of the media microservice scripts, many of which work in the same way as makeyoutube (makebroadcast, makedvd, makeflv, makeframes, makelossless, makemp3, makepodcast, makeprores, makeresourcespace). It also downloads all the dependent software used by mediamicroservices, such as ffmpeg.

To use makeyoutube, type makeyoutube into the command line, and then drag in your input file or files, and press enter. Using ffmpeg, makeyoutube will transcode each of the files, and then place the transcoded versions into a directory on your Desktop called access. That directory will also contain a directory called logs, which will have ffmpeg logs of the processes performed on the file. See the gif below:

via GIPHY

If you would like to choose where the file should be delivered to, your command will change slightly. You will still type makeyoutube, followed by -d and the file path to the directory (an easy way to do this is to drag the directory into the terminal in the same way you drag the file in), and then the input.

The command should look like this: makeyoutube -d [path/to/directory/] [input file or files]

? ingestfile

ingestfile is a script that creates an archival information package from a video file input. This script is very tailored to our workflow here at CUNY TV, so it may not be super useful except to provide one example of how archival information packages can be created. The package contains a service copy suitable for broadcast, as well as multiple access copies, and metadata for the original file and each derivative. In order to use ingestfile, you’ll need to first run a script called mmconfig. Because there is a significant amount of automatic movement of files and delivery, the user has to first designate these locations on their computer for the script to run. By creating a configuration file, you are setting particular locations on your computer as variables that will get used at various points in the script. The variables you must set in order to run ingest file are:
⭐️OUTDIR_INGESTFILE (a directory in which your files are processed, on my computer’s desktop I just made a directory called OUTDIR_INGESTFILE)
⭐️AIP_STORAGE (a directory where the resulting package is written to, again, can just be a directory by the same name on your desktop)
⭐️PODCASTDELIVER (the directory where the podcast access files are delivered, again can just be a directory by the same name on your desktop)
⭐️YOUTUBEDELIVER (same deal as podcastdeliver)

via GIPHY

Once you set up your configuration file, you can use ingestfile. To begin the script, type ingestfile into the terminal and press enter. There is a short question and answer session, where you’ll be prompted to provide a unique Media ID for the package, as well as some volume and field settings. Once you’ve answered those questions, the process begins and does not require further intervention from the user. You can create a queue if you’d like to process more than one file, by choosing the queue option and then in a new terminal tab, repeating the same process.

via GIPHY

If you prefer a GUI (graphical user interface), type ingestfile -e.

via GIPHY

Those are all the demos for today. If you’re having trouble with any of the technical aspects of using these tools, please don’t hesitate to get in touch.

2 thoughts on “Open Source Tools for working with Audio Visual files

  1. Pingback: Vol. 9, no. 27 | I-Heritage.info

Comments are closed.