Shinkai (Shinkai v0.2.0)

View Source

Media server for Elixir.

Configuration

Shinkai can be configured via a YAML file. By default, it looks for the configuration file at shinkai.yml relative to the current working directory. You can override this by setting the SHINKAI_CONFIG_PATH environment variable or by configuring the :config_path option in the :shinkai application environment.

The following configuration options are available:

Server

To configure the http server responsible for serving HLS streams.

  • enabled - Enable or disable the HTTP server.
  • port - Port number for the HTTP server.
  config :shinkai, :server,
    enabled: true,
    port: 8888
  server:
    enabled: true          # Enable or disable the HTTP server (default: true)
    port: 8888             # Port number for the HTTP server (default: 8888)

HLS

To configure HLS streaming options.

  • storage_dir - Directory to store HLS segments.
  • max_segments - Maximum number of segments to keep.
  • segment_duration - Segment duration in milliseconds.
  • part_duration - Part duration in milliseconds.
  • segment_type - Type of segments to generate, either fmp4, mpeg_ts, or low_latency.
  config :shinkai, :hls,
    max_segments: 7,
    part_duration: 500,
    segment_type: :mpeg_ts
  hls:
    storage_dir: "/path/to/hls/storage"  # Directory to store HLS segments (default: "/tmp/shinkai/hls")
    max_segments: 7                      # Maximum number of segments to keep (default: 7)
    segment_duration: 2000               # Segment duration in milliseconds (default: 2000)
    part_duration: 500                   # Part duration in milliseconds (default: 500)
    segment_type: "fmp4"                 # Type of segments to generate, either "fmp4" or "mpeg_ts" or "low_latency" (default: "fmp4")

RTMP

To configure the RTMP server.

  • enabled - Enable or disable the RTMP server.
  • port - Port number for the RTMP server.
  config :shinkai, :rtmp,
    enabled: true,
    port: 1935
  rtmp:
    enabled: true          # Enable or disable the RTMP server (default: true)
    port: 1935             # Port number for the RTMP server (default: 1935)

Paths

To configure media source paths. Each source should have a unique alphanumeric ID.

  paths:
    camera1:
      source: "rtsp://example.com/stream1"
    camera2:
      source: "rtsp://example.com/stream2"
    camera3:
      source: "rtmp://example.com/live/stream3"