Skip to main content

How to play content using JIT

JIT (Just-In-Time) playback makes it possible to play video formats that would otherwise require transcoding before being playable in a web browser.

Step 1: Set up a JIT backend

Playing files with Accurate Player JIT requires a JIT Backend. You can read more about how to set the backend up in this tutorial. The tutorial also includes an example frontend application, but we are only interested in the backend section.

Step 2: Configure a video file

JIT may play video files from a URL. It may also play a local file. In the latter case, the file has to be accessible on the host machine running the backend, and will be mounted into the container upon start.

Validate requires video- and audio stream information about the video to function properly. This information can be gathered using ffprobe, e.g.

ffprobe -print_format json -show_streams "https://jit-testmaterial.s3.eu-central-1.amazonaws.com/samples/I_Am_Legend_-_Trailer.mxf"

which gives us the result

{
"streams": [
{
"index": 0,
"codec_name": "mpeg2video",
"codec_long_name": "MPEG-2 video",
"profile": "4:2:2",
"codec_type": "video",
...
"r_frame_rate": "24000/1001",
"avg_frame_rate": "24000/1001",
"time_base": "1001/24000",
"start_pts": 0,
"start_time": "0.000000",
"duration_ts": 2954,
"duration": "123.206417",
"bit_rate": "25000000",
...
},
{
"index": 1,
"codec_name": "pcm_s24le",
"codec_long_name": "PCM signed 24-bit little-endian",
"codec_type": "audio",
"codec_tag_string": "[0][0][0][0]",
"codec_tag": "0x0000",
"sample_fmt": "s32",
"sample_rate": "48000",
"channels": 6,
...
}
]
}

The output will differ for different files. We extract the duration in frames, the frame rate and the channel count for the first audio stream. Now it's time to define the video file.

{
"type": "VIDEO",
"url": "https://jit-testmaterial.s3.eu-central-1.amazonaws.com/samples/I_Am_Legend_-_Trailer.mxf",
"metadata": [
{
"key": "filename",
"value": "I Am Legend - Trailer"
},
{
"key": "language",
"value": "en"
}
],
"container": {
"videoStreams": [
{
"frameRateNumerator": 24000,
"frameRateDenominator": 1001,
"duration": 2952
}
],
"audioStreams": [
{
"channels": 6
}
]
}
}

In the case of using a local file, the URL would look something like this instead:

"url": "/media/samples/I_Am_Legend_-_Trailer.mxf",

Video streams

The video streams needs to be configured with frameRateNumerator and frameRateDenominator together with the duration in frames.

Audio streams

The audio streams needs to be configured with channels, the number of channels, for example "channels": 2 for a regular stereo sound.

Step 3: Configure settings

Activate JIT playback by adding this settings block:

{
"jit": {
"iceServers": [
{
"urls": [
"stun:stun.l.google.com:19302",
"stun:stun1.l.google.com:19302",
"stun:stun2.l.google.com:19302",
"stun:stun3.l.google.com:19302",
"stun:stun4.l.google.com:19302",
]
}
],
"backendUrl": "http://localhost:8080",
"enabled": "always"
}
}

The backendUrl points to the JIT Backend setup in step 1, and in this example we use public STUN servers from google. You can read more about the settings here.

Try it out

Automatic quality

During playback the player will adjust the quality automatically based on your connection. When the player is paused, the backend server will send a higher resolution image.

Limitations

While JIT playback makes it possible to play more formats, it comes with limitations. For Validate this means that some features are disabled.

Audio

Muxed audio playback is supported but is limited to stereo playback. Even if the source file has more channels, only the first two channels of the first audio track will be played back. Switching between muxed audio tracks is not supported.

It is possible, however, to display waveforms for all channels if you generate and configure waveform files, as described in this guide.

Channel manipulation like mute, solo or rerouting audio channels is not supported.

Real-time audio visualization, like the VU-meters and Gonio-meters, does not work.

Discrete audio is not supported.

Subtitles

Discrete subtitles are supported but not muxed subtitles.

Video

It is not possible to switch between JIT, ABR and Progressive playback.