Service: Media Probe - EyevinnOSC/community GitHub Wiki

Media Probe

Media Probe (source, serviceId eyevinn-function-probe) is a serverless media function that inspects a media file or stream and returns its metadata in a single HTTP call. It is built on FFprobe and packaged as a lightweight REST service. Service page: https://app.osaas.io/dashboard/service/eyevinn-function-probe. In Eyevinn Open Source Cloud (OSC) it is a long-running service instance.

What it can do

  • Return codecs, tracks, frame rates, resolution, bitrate and duration for a video file or stream.
  • Validate media before transcoding, build QC pipelines or audit content libraries.
  • Serve interactive API documentation at /api/docs.

Creating an instance

Media Probe has no dependencies on other OSC services. Create it with create-service-instance, serviceId: "eyevinn-function-probe":

{ "name": "myprobe" }

Wait for it to be running (wait-for-service-ready or get-instance-status) and get the URL with describe-service-instance.

Options

Option Required Type Meaning
name Yes string Name of the instance. Short alphanumeric name, at most 20 characters.

Media Probe has no other options.

Using the instance

Send a POST request to /api with a JSON body containing medialocator:

curl -X POST https://<your-instance-url>/api \
  -H "Content-Type: application/json" \
  -d '{"medialocator": "https://maitv-vod.lab.eyevinn.technology/VINN.mp4/master.m3u8"}'

The response is a JSON object with track and format metadata:

{
  "streams": [
    { "index": 0, "codec_name": "h264", "codec_type": "video", "width": 1920, "height": 1080, "r_frame_rate": "25/1", "bit_rate": "4000000", "duration": "120.00" },
    { "index": 1, "codec_name": "aac", "codec_type": "audio", "sample_rate": "48000", "channels": 2 }
  ],
  "format": { "duration": "120.00", "size": "60000000", "bit_rate": "4000000", "format_name": "mov,mp4,m4a,3gp,3g2,mj2" }
}

As a pre-flight check before transcoding:

async function probeMedia(instanceUrl, mediaUrl) {
  const response = await fetch(`${instanceUrl}/api`, {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({ medialocator: mediaUrl })
  });
  if (!response.ok) throw new Error(`Probe failed: ${response.status}`);
  return response.json();
}

const metadata = await probeMedia('https://<your-instance-url>', 'https://example.com/video.mp4');
const videoTrack = metadata.streams.find(s => s.codec_type === 'video');
console.log(`Resolution: ${videoTrack.width}x${videoTrack.height}`);
console.log(`Codec: ${videoTrack.codec_name}`);
console.log(`Duration: ${metadata.format.duration}s`);

With the OSC CLI:

osc create eyevinn-function-probe myprobe

Resources