NNStreamer run-time configurations

Users may alter behaviors by supplying the "nnstreamer.ini" file or updating environmental variables.

There are three layers of configurations, with higher priority from the top:

  • Environmental variables (highest priority,)
  • Configuration file (if not specified, it's /etc/nnstreamer.ini)
  • Hardcoded default values (lowest priority)

Note: in Tizen, you cannot specify the location of nnstreamer.ini with env-var.

For search locations, files in the locations of higher priorities are found first.

For other values, the values configured with higher priorities override those with lower priorities.

Environmental Variables

  • NNSTREAMER_FILTERS: the search location for tensor-filter subplugins
  • NNSTREAMER_DECODERS: the search location for tensor-decoder subplugins
  • NNSTREAMER_CUSTOMFILTERS: the search location for custom tensor-filters.
    • Note that users may specify the full absolute path of a custom filter to ignore this effect.
  • NNSTREAMER_CONVERTERS: the search location for tensor-converter subplugins
  • NNSTREAMER_CONF: the path to .ini NNStreamer configuration file. (/etc/nnstreamer.ini if not specified)

The intention of these is to override default values of .ini files without the capability/need to update /etc/nnstreamer.ini file in run-time.

However, in many embedded devices, as in Tizen, such capabilities are prohibited for security reasons.


Configuration File (.ini, /etc/nnstreamer.ini by default)

  • [common]
    enable_envvar=true/false
    # You may disable NNStreamer's environmental variables with this.
    # However, with envvar, the location of nnstreamer.ini may be altered.
    # Thus, this is effective only NNSTREAMER_CONF envvar is disabled (__TIZEN__ disables it)
    
    enable_symlink=true/false
    # If this is false, subplugin files should not be sym-linked. (regular files only)
    
    [filter]
    filters=PATH
    # The search location for tensor-filter subplugins
    # By default, /usr/lib/nnstreamer/filters/
    
    customfilters=PATH
    # The search location for custom tensor-filters.
    # By default, /usr/lib/nnstreamer/customfilters/
    # Note that users may specify the full absolute path of a custom filter to ignore this effect.
    
    framework_priority_tflite=FW1,FW2,FW3,...
    # If a .tflite file is given for tensor-filter or "Single" API,
    # which neuural network framework should be used.
    # If multiple frameworks are given, NNStreamer will try
    # from the left.
    # By default, tensorflow-lite,nnfw,armnn,edgetpu
    
    [decoder]
    decoders=PATH
    # The search location for tensor-decoder subplugins
    # By default, /usr/lib/nnstreamer/decoders/
    
    [converter]
    converters=PATH
    # The search location for tensor-converter subplugins
    # By default, /usr/lib/nnstreamer/converters/
    
    [element-restriction]
    restricted-element=element1,element2,element3,...
    # If this is set, only the GStreamer elements in the list and NNStreamer's elements are allowed with NNStreamer "Pipeline" API.
    # We know that the ,ini configuration name is weird and we may update it soon. (e.g., allowed-elements)
    # If you do not want to restrict the usage of GStreamer elements, do not define this configuration key.
    
    [tensorflowlite]
    enable_nnapi=true/false
    # For tensorflow-lite subplugin, enable NNAPI. This can be overriden for each instance with GStreamer property values in a pipeline.
    
    [pytorch]
    enable_use_gpu=true/false
    # For pytorch subplugin, enable GPU. This can be overriden for each instance with GStreamer property values in a pipeline.

Hardcoded Default Values

  • Ini file location: /etc/nnstreamer.ini
  • Filter subplugin path: /usr/lib/nnstreamer/filters/
  • Decoder subplugin path: /usr/lib/nnstreamer/decoders/
  • Custom filter paths: /usr/lib/nnstreamer/customfilters/
    • Note that users may specify the full absolute path of a custom filter to ignore this effect.
  • Converter subplugin path: /usr/lib/nnstreamer/converters/


Related Code: /gst/nnstreamer/nnstreamer_conf.{c, h}

Updated at 2020-04-07, based on commit 5ed942e6, (NNStreamer 1.5.1)