Skip to content

Playback options

CVEDIA-RT playback options are included on the Input configuration window, available at the Instance menu.


Controlling playback

CVEDIA-RT allows controlling playback on two different ways. You can pause the application code entirely and run each iteration step by step, or just pause the input and keep the processing running normally the same frame.

Pause and Step Processing

You can pause and step the application processing with the buttons available on the instances menu on the left side


When the instance is paused, you can step the application, causing just a process iteration to be run at a time


Pause Input Playback

You can pause just the input playback and keep the application processing running


This way its possible to change regions and keep the input source paused to analyze a specific frame continuously

Playlist Information

It's also possible to configre an instance to run a playlist of videos.


When hovering over the (ℹ️) icon next to the timeline on the Input panel, the current playlist state is displayed

Playback controls


Show the current playing URI controls


  • Play / Pause : Play /Pause playback
  • Previous Source : Load the previous source on the playlist (if configured)
  • Previous Frame : Load the previous frame (to be used when playback is paused)
  • Next Frame : Load the next frame (to be used when playback is paused)
  • Next Source : Load the next source on the playlist (if configured)

Playback configuration

Run videos only once

It's possible to instruct CVEDIA-RT to run its input video only once, instead of repeating the playback. To do this you can do the following:

  • Set the Repeat Mode to No Repeat (2), which disables repeating the playback.

    This can be done in the instance configuration using the following config:

        "Input": {
            "VideoReader": {
                "repeat_mode": 2

    It's also possible to set the Repeat Mode in the Lua code of the instance, by using:


    Repeat Mode options

    The are three options for repeat mode:

    • Repeat All : 0
    • Repeat One File : 1
    • Repeat None = 2

When using this options, the playback will stop on the end of the video. If you also need to stop the instance at the end of the playback, you can do it in Lua by checking if the playback has ended. The following snippet can be used:

    if input:playlistReachedEnd() then
        instance:stop()  -- instance = Instance object returned from api.thread.getCurrentInstance()

Control playback speed/fps

CVEDIA-RT allows defining some properties which control playback speed and sampling rate/fps:

There are two different systems working together to retrieve the input frames:

  • Input Module: The Input module is the parent of all input handlers, it will query the configured Input handler in a separate thread and fill an internal buffer with frames, which are returned when calling Input:readMetaFrames from Lua.

  • Input handlers: The different input handlers (video file, rtsp, etc.) are responsible for the low level retrieval of the frame data, and can have their own buffers and sampling rates as well.

In the Input module configuration we can configure the following:

  • buffer_sampling_rate : The rate, in fps, at which the Input module will query the source for data. Default: 0 (Maximum)


When setting the frame rate to "1", the Input module will load the buffer queue one time per second, and the Input:readMetaFrames function will return one valid frame per second, all the other calls made when the buffer is empty will return an invalid frame

  • buffer_size : The size of the internal Input buffer. Even when not calling Input:readMetaFrames, in a separate thread, Input is retrieving the frames to an internal buffer, so they can be returned when called. The size of this internal queue is controlled with this property. Default: 2

  • free_run_mode : If free run mode is chosen, then the buffer will discard old frames when the queue is full, and will continue reading new ones. In free run mode, the reader will not wait for the Input:readMetaFrames to be called to discard the queue, and so every frame read will be at the same timeline as the source. When free run mode is disabled, the video will "wait" for the Input:readMetaFrames call to progress.

So, for fps=1 and buffer_size=2, free_run_mode=true in the Instance config file we would have:

    "Input": {
        "buffer_sampling_rate": 1,
        "buffer_size": 2,
        "free_run_mode": true

In the Input handlers that support it, we can configure the following:

  • real_time : The source will be read according to the input fps. So, for video files, the file_sampling_rate will be the file fps. This property has priority over file_sampling_rate property. Default: true

  • file_sampling_rate : The rate at which the input source will be read on the low level. When the Input module queries the handler, it will return frames based on this rate. This property is not used if real_time is enabled. Default: 0

Common Configurations

real_time = false, file_sampling_rate = x -> Target FPS will be x fps real_time = false, file_sampling_rate = 0 -> Target FPS = 0 -> Will be as fast as possible real_time = true, file_sampling_rate = any -> Target FPS will be input FPS