01.9.18

Introducing Videobox: How AI can help you understand the contents of your videos

Companies are trying to understand the content of their videos, automatically and at very large scale. So far, Machine Box boxes were built for images, but today we are introducing Videobox: a simple and effective way to bring video support to Facebox, Tagbox and Nudebox.

What is Machine Box?

Machine Box puts state of the art machine learning capabilities into Docker containers so developers can easily incorporate natural language processing, facial detection, image recognition, and more into their own apps, very quickly.

The boxes are built for scale, so when your app really takes off just add more boxes horizontally, to infinity and beyond. Oh, and it’s way cheaper than any of the cloud services and your data doesn’t leave your infrastructure.

What is Videobox?

Videobox is a new box (Docker container) that runs videos through other Machine Box services.

In conjunction with Facebox, you can see who appears in a video, how often and at what times.

Videobox + Facebox = appearances of people at different times in the video

If Facebox doesn’t recognise the people, Videobox will still group them up so at least you know that the different faces belong to the same person.

With Tagbox, you can get a deep understanding of what is going on in the video.

With Nudebox, you can find regions of the video that contain nudity or adult content, and which might not be suitable for broadcast.

How Videobox works

Using environment variables, you tell Videobox where your other boxes are hosted, and it uses their APIs to process the individual frames extracted from the video.

The results are collated into an easy to understand format, that’s optimised for common use cases.

You can decide the frequency of frames (by specifying either the number of frames, or a number of seconds to skip between extractions) and control other behaviours, such as confidence thresholds and other box specific options.

The flow for how Videobox does its magic is relatively simple:

  1. You send a video to Videobox (either by POSTing the file, or by submitting a URL)
  2. Videobox breaks the video into frames
  3. Each frame is processed by the other boxes
  4. Individual frame data is returned to Videobox
  5. Videobox collates the exploded data into an overview

You can use the simple Videobox APIs to check the status of long running tasks, and get the results once they’re complete.

See it in action for yourself

To see Videobox running for real on your own videos for free, you’ll need to have Docker installed, a computer with a terminal, and a web browser.

You really don’t have to be too technical to get this working, this guide works for managers too, so give it a go.

We recommend using Docker compose to spin up the boxes you need for a good demo.

Make sure you have the latest boxes because we update them periodically to make them more awesome. Open a terminal and type each of these lines, one at a time:

docker pull machinebox/tagbox:latest
docker pull machinebox/facebox:latest
docker pull machinebox/nudebox:latest
docker pull machinebox/videobox:latest

While that’s working away, create a new folder on your development machine called videoboxdev, and add the following docker-compose.yml file:

version: '3'
services:
  facebox1:
    image: machinebox/facebox
    environment:
      - MB_KEY=${MB_KEY}
    ports:
      - "8081:8080"
  tagbox1:
    image: machinebox/tagbox
    environment:
      - MB_KEY=${MB_KEY}
    ports:
      - "8082:8080"
  nudebox1:
    image: machinebox/nudebox
    environment:
      - MB_KEY=${MB_KEY}
    ports:
      - "8083:8080"
  videobox:
    image: machinebox/videobox
    environment:
      - MB_KEY=${MB_KEY}
      - MB_VIDEOBOX_FACEBOX_ADDR=https://facebox1:8080
      - MB_VIDEOBOX_TAGBOX_ADDR=https://tagbox1:8080
      - MB_VIDEOBOX_NUDEBOX_ADDR=https://nudebox1:8080
    ports:
      - "8080:8080"

Use a text editor like TextEdit on a Mac or Notepad on Windows to create this file.

Each of the services describes a single box. We use environment variables to provide the requisite MB_KEY and to tell Videobox about the other boxes. If you haven’t setup your key yet, head over to the Machine Box website to get one for free.

To execute this configuration, open a terminal and navigate to the videoboxdev folder and run:

docker-compose up

All the boxes will spin up.

Now open https://localhost:8080 in your browser to access the Videobox console:

Videobox has a console just like the other boxes

Click on the Console button, and choose one of the samples to process, and click POST. Or tap the POST the file to choose a video from your local hard drive.

The progress bar visualises data from the /videobox/status/{id} endpoint

After a while, you’ll be presented with the results that visualise the JSON payload that you get back from Videobox:

Videobox will group faces up (giving each one a unique group ID) so it’s useful even if it doesn’t know who the face belongs to