{"id":25418979,"url":"https://github.com/wakabayashik/srt-live-reflect","last_synced_at":"2025-05-08T22:45:37.006Z","repository":{"id":111935908,"uuid":"571919712","full_name":"wakabayashik/srt-live-reflect","owner":"wakabayashik","description":"srt live stream reflector","archived":false,"fork":false,"pushed_at":"2024-07-03T00:16:07.000Z","size":153,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-07T20:55:14.030Z","etag":null,"topics":["cpp","live","srt"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wakabayashik.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-11-29T07:01:24.000Z","updated_at":"2024-07-03T00:16:10.000Z","dependencies_parsed_at":"2025-02-16T18:35:34.340Z","dependency_job_id":"c8504f74-94f6-4f31-8278-ca88396ddae3","html_url":"https://github.com/wakabayashik/srt-live-reflect","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wakabayashik%2Fsrt-live-reflect","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wakabayashik%2Fsrt-live-reflect/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wakabayashik%2Fsrt-live-reflect/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wakabayashik%2Fsrt-live-reflect/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wakabayashik","download_url":"https://codeload.github.com/wakabayashik/srt-live-reflect/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252954375,"owners_count":21830902,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpp","live","srt"],"created_at":"2025-02-16T18:35:28.716Z","updated_at":"2025-05-07T20:55:22.206Z","avatar_url":"https://github.com/wakabayashik.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# srt-live-reflect\nreflect srt live stream\n\n## § build\n### requirements\n* libsrt\n  * vcpkg install libsrt:x86-windows-static\n  * vcpkg install libsrt:x64-windows-static\n* libcurl\n  * vcpkg install curl:x86-windows-static\n  * vcpkg install curl:x64-windows-static\n* aws-sdk-cpp (optional: *USE_AWSSDK=1*)\n  * vcpkg install aws-sdk-cpp:x64-windows-static\n  * vcpkg install aws-sdk-cpp:x86-windows-static\n* boost\n\n## § command line arguments\n### conf=**{{path to configuration file}}**\n* **default** : *\"./srt-live-reflect.conf\"*\n\n## § configuration file\n### srt-live-reflect.conf (JSON)\n* acccepts C style, C++ style comment and trailing commas\n```json\n{\n  \"name\": \"srt-live-reflect\",\n  \"cainfo\": \"\",                // path to certificate authority (CA) bundle (empty to skip CA verification) (default:\"\")\n  \"srtloglevel\": \"error\",      // srt log level [\"debug\" / \"note\" / \"warning\" / \"error\" / \"fatal\"] (default:\"error\")\n  \"logger\": {\n    \"target\": \"\",              // path to log directory (empty to disable logging) (default:\"\")\n    \"level\": \"info\",           // log level [\"trace\" / \"debug\" / \"info\" / \"warning\" / \"error\" / \"fatal\"] (default:\"info\")\n    \"max_size\": 1073741824,    // maximum total log size (default:1024*1024*1024)\n    \"max_files\": 30,           // maximum number of log files (default:30)\n  },\n  \"aws\": {\n    \"enabled\": false,          // enable or disable AWSSDK (default:false)\n    \"loglevel\": \"error\",       // AWSSDK log level [\"trace\" / \"debug\" / \"info\" / \"warning\" / \"error\" / \"fatal\"] (default:fallback to \"logger.level\")\n    \"logprefix\": \"AWSSDK\",     // prefix for logs from AWSSDK (default:\"AWSSDK\")\n    \"region\": \"ap-northeast-1\",// AWS region to be used (default:not specified)\n  },\n  \"reflects\": [{\n    \"app\": \"live\",\n    \"port\": 14501,\n    \"backlog\": \"5\",\n    \"option\": {                // srt options (pre-bind)\n      \"udpsndbuf\": 65536,\n      \"udprcvbuf\": 65536,\n      // ... (see:option)\n    },\n    \"publish\": {\n      \"stats\": 600,            // period to print statistics in seconds (0:disabled) (default:0)\n      \"option\": {              // srt options for publish (pre)\n        \"linger\": 0,\n        // ... (see:option)\n      },\n      \"access\": [              // static access control for publish\n        {\n          \"allow\":\"192.168.11.0/24\", // allow from 192.168.11.0/24\n          \"name\":\"stream-*\"          // apply only resouce name matches (default:\"*\") (see:streamid)\n        },\n        {\"deny\":\"all\"}         // deny all others\n      ],\n      \"on_pre_accept\": \"http://127.0.0.1:8090/on_pre_accept_publish\", // dynamic access control for publish\n      // \"on_accept\": \"http://127.0.0.1:8090/on_accept_publish\"       // comment out\n    },\n    \"play\": {\n      \"option\": {              // srt options for play (pre)\n        \"maxbw\": 0,\n        \"inputbw\": 0,\n        \"oheadbw\": 25,\n        // ... (see:option)\n      },\n      \"access\": [              // static access control for play\n        {\"allow\":\"127.0.0.1\"},\n        {\"deny\":\"all\"}\n      ],\n      // \"on_pre_accept\": \"http://127.0.0.1:8090/on_pre_accept_play\",\n      // \"on_accept\": \"http://127.0.0.1:8090/on_accept_play\"\n    },\n    \"loopRecs\": [{\n      \"name\": \"stream-A\",        // resource name to be recorded\n      \"dir\": \"./stream-A\",       // path to directory where the recorded files will be created (default:\"./\" + resource name)\n      \"data_extension\": \".dat\",  // extension for data files (default:\".dat\")\n      \"index_extension\": \".idx\", // extension for index files (default:\".idx\")\n      \"segment_duration\": 600,   // duration of the recorded file per segment in seconds (default:600)\n      \"total_duration\": 3600,    // total duration of loop recording in seconds (default:3600)\n      \"index_interval\": 100,     // indexing interval for a recording file in milliseconds (default:100)\n      \"prefetch\": 1000,          // time (in milliseconds) when to start prefetching the next segment during playback (0 to disable prefetch) (default:1000)\n      \"queue\": 0,                // maximum time (in milliseconds) to queue the ingress data when recording (0 to disable queue) (default:0)\n      \"s3\": {                    // \"aws.enabled\" should be set to true when using AWS S3\n        \"bucket\": \"bucket-A\",    // AWS S3 bucket name to store the recorded files (empty to disable S3 upload) (default:\"\")\n        \"folder\": \"stream-A\",    // folder name on AWS S3 bucket (default:hostname + \"/\" + resource name)\n        \"bufsiz\": 18800,         // buffer size used when playback the stream from AWS S3 (default:188*100)\n      },\n    }]\n  }]\n}\n```\n\n## § option\n* (refs.) [SRT API Socket Options](https://github.com/Haivision/srt/blob/master/docs/API/API-socket-options.md)\n\n## § streamid\n* (refs.) [SRT Access Control (Stream ID) Guidelines](https://github.com/Haivision/srt/blob/master/docs/features/access-control.md)\n* in case of ffmpeg, streamid is specified by **-srt_streamid** option\n\n### common\n* **r** : resource name identifies the name of the resource\n* **m** : mode expected for this connection\n  * **request** (default) : the caller wants to receive the stream\n  * **publish** : the caller wants to send the stream data\n\n### for playback of loop recording\n* **at** : specifies requested position of recorded data\n  * **ISO string** : specifies the date and time to be requested in ISO8601 syntax (ex.:\"20230317T123000+0900\")\n  * **now-{{sec}}** : specifies the time seconds before the current time\n  * **now** (default) : specifies live stream instead of recorded data\n* **gap** : specifies the action to be taken when the stream reaches a gap in the recorded data.\n  * **skip** (default) : skip to the next recorded data without waiting\n  * **wait** : wait for a time corresponding to the gap before starting the next recorded data\n  * **break** : break the stream when a gap appears\n* **speed** : specifies playback speed (synonym: **x**)\n  * **1** (default) : normal play speed\n\n## § service (windows)\n* make it service with [nssm](https://nssm.cc/)\n\n### install\n```bat\nset nssm={{path to nssm.exe}}\nset dir={{directory where srt-live-reflect is}}\n\"%nssm%\" install srt-live-reflect \"%dir%\\srt-live-reflect.exe\"\n\"%nssm%\" set srt-live-reflect DisplayName srt-live-reflect\n\"%nssm%\" set srt-live-reflect Description srt-live-reflect service\n\"%nssm%\" set srt-live-reflect AppDirectory \"%dir%\"\nnet start srt-live-reflect\n```\n\n### remove\n```bat\nset nssm={{path to nssm.exe}}\nnet stop srt-live-reflect\n\"%nssm%\" remove srt-live-reflect confirm\n```\n\n## § service (linux)\n* make it service with systemd\n\n### {{directory where srt-live-reflect is}}/startup.sh\n```sh\n#! /bin/sh\ncd `dirname $0`\nexport LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib64:/usr/local/lib\n./srt-live-reflect conf=./srt-live-reflect.conf\n```\n\n### /etc/systemd/system/srt-live-reflect.service\n```\n[Unit]\nDescription=srt-live-reflect service\nAfter=network.target\n\n[Service]\nType=simple\nExecStart={{directory where srt-live-reflect is}}/startup.sh\nRestart=always\nUser={{user}}\nGroup={{group}}\n\n[Install]\nWantedBy=multi-user.target\n```\n\n## § work with ffmpeg\n\n### publish\n\u003e ffmpeg -re -stream_loop -1 -i **{{path to movie file}}** -c:v copy -c:a copy -f mpegts -pes_payload_size 0 -srt_streamid #!::r=**{{stream name}}**,m=publish srt://**{{host}}**:**{{port}}**\n\n### playback\n\u003e ffplay -srt_streamid #!::**{{stream name}}**,m=request srt://**{{host}}**:**{{port}}**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwakabayashik%2Fsrt-live-reflect","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwakabayashik%2Fsrt-live-reflect","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwakabayashik%2Fsrt-live-reflect/lists"}