Part 1 of FFmpeg series for live video and audio capture in Claris FileMaker

FFmpeg, Part 1: Capturing Live Video and Audio in FileMaker

FFmpeg is a free and open-source software project consisting of a suite of libraries and programs for handling video, audio, and other multimedia files and streams. At its core is the command-line FFmpeg tool itself, designed for processing of video and audio files. It is widely used for format transcoding, basic editing (trimming and concatenation), video scaling, video post-production effects, and standards compliance.

Wikipedia

A New Tool in our Developer’s Toolbox

This year, we’ve been able to delve into a fascinating tool which we’ve not had the opportunity to use before – FFmpeg, an open-source command line tool for capturing and managing video within Claris FileMaker.

A client approached us with their need to take recorded videos from a collection of cameras (which are controlled via API calls from the FileMaker solution), transcode the video files, then merge the videos into a grid for playback. We were up for the challenge and exploration.

FFmpeg

Our research into how to tackle this project led us down the path of finding FFmpeg, which provides some interesting capabilities. We were able to use it to transcode the MKV files* from the cameras into MP4 (a more commonly accepted format), which meant writing some thorough interaction with the command line tool in a complex, fault-tolerant way.

In the final analysis it turned out that the project also required more sophisticated video streaming, so we combined functionality from web viewers and FFplay to stream both audio and video from the selected cameras. We’ll dive more into that process in part two of this blog series.

In part three, we’ll cover some specifics of handling the MP4 conversion and video manipulation. And in part four we’ll wrap up with the successes we found with this project plus some lessons learned that we will carry into future work. 

Use Case for Capturing Videos and Saving Recordings

These days, there are a number of video cameras that are network-accessible and use cloud storage. Our client wanted to use cameras that are not only network-accessible, but that could be controlled from FileMaker. They also wanted to save and download the recordings to a local device for further video enhancement.

First We Looked into Handbrake as a Solution

Our first approach was to try using Handbrake to do what the solution needed. Similar to FFmpeg, Handbrake is UI-based open source software for video transcoding that can be called via command line. 

After reading through the Handbrake documentation, we discovered that FFmpeg is the core element of Handbrake, so we removed the dependency and went straight to the foundation.

FFmpeg Allows the Control of Processing Files Locally

There are a few APIs that could get us close to the result the client wanted, but since part of their target audience includes customers in rural areas with sparse internet coverage, the solution can’t rely on public APIs. FFmpeg allows us to process the files locally, using CLI commands generated from within the FileMaker solution. 

The FFmpeg Functionality has been Surprisingly Reliable

Currently, the project is in its final stages of development. Now that we have defined the functions and figured out the transcoding calculations, the FFmpeg functionality has been surprisingly reliable. We discovered that FFmpeg is quite heavy on the CPU, especially with higher resolution videos, so we’ve had to make some adjustments to allow users to turn on/off certain features in order to expedite processing times. We’ll talk more about that, and other scenarios we encountered, in a future post. All-in-all, FFmpeg has been an exciting tool to incorporate into a Claris FileMaker solution.

Stay Tuned for More Details

Keep an eye out for more specifics in the rest of this series:

  • PART 2: The Process of Streaming Both Audio and Video From Select Cameras
  • PART 3: Specifics of Doing the MP4 Conversion and Video Manipulation
  • PART 4: Successes Found and Important Lessons Learned

* What are MKV Files?

Matroska video files originated in Russia in 2002, getting their name from the Russian word for nesting dolls, matryoshka. 

How-To Geek’s article explains the files are not an audio or video compression format. They are actually multimedia container formats that can incorporate audio, video, and subtitles into a single file—even if those elements use different types of encoding. Designed to be future proof and not become outdated, several key features were included to make such longevity happen.

  • Fast seeking
  • Chapter, menu, and metadata support
  • Different selectable audio and video streams
  • Online streaming compatibility
  • Subtitle (hard-coded and soft-coded) support
  • Error recovery, to allow for playback of corrupted files

There are several common applications that create MKV files, such as Adobe Premiere Pro, Final Cut Pro, Sony Vegas, OBS Studio, MakeMKV, Bandicam, Format Factory, VLC, and Freemake.

ChatGPT chimes in to say, “It’s important to note that while MKV is a versatile container format that supports multiple audio, video, and subtitle codecs, it may not be as universally supported as more common formats like MP4. Before sharing or distributing MKV files, ensure that the target devices or platforms can handle this format properly. If compatibility is a concern, you might consider converting MKV files to more widely supported formats.”

Need Input for Your Own Video or Audio Project?

Contact us to discuss ways we can assist with your development, or how we can create a solution for your specific situation. We love to use the full capabilities of the Claris FileMaker platform! Our team is also experienced with implementing a variety of integrations to achieve the results your business needs to see.

About the Author

Joe Ranne is a Senior Application Developer at Portage Bay Solutions. Whether on a bicycle in a remote forest or 10 hours into a solution refactor, he always enjoys a good problem to solve.

Leave a Reply

Your email address will not be published. Required fields are marked *