Skip to content

allow to toggle recording on paths without a dedicated configuration #3718

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
2 of 13 tasks
pikachu937 opened this issue Sep 2, 2024 · 4 comments · May be fixed by #4576
Open
2 of 13 tasks

allow to toggle recording on paths without a dedicated configuration #3718

pikachu937 opened this issue Sep 2, 2024 · 4 comments · May be fixed by #4576
Labels
enhancement New feature or request general

Comments

@pikachu937
Copy link

Which version are you using?

v1.8.4

Which operating system are you using?

  • Linux amd64 standard
  • Linux amd64 Docker
  • Linux arm64 standard
  • Linux arm64 Docker
  • Linux arm7 standard
  • Linux arm7 Docker
  • Linux arm6 standard
  • Linux arm6 Docker
  • Windows amd64 standard
  • Windows amd64 Docker (WSL backend)
  • macOS amd64 standard
  • macOS amd64 Docker
  • Other (LXC)

Describe the issue

there is no way to change parameters inside the all_other path, for example, set the record to true or false for a specific stream published via ffmpeg or camera (which can publish on the server)

sending to the API to disable recording for a specific stream
127.0.0.1:9997/v3/config/paths/patch/65598042706279143845

{	
			"record": false
}

and everything would be fine if its confName parameter had the value 65598042706279143845, but since the confName parameter has the value all_others, we cannot change it for a specific stream (they differ in the name parameter), only for all at once, which is not correct

{
  "itemCount": 3,
  "pageCount": 1,
  "items": [
    {
      "name": "2222222222222222222222222222222222222222222222222222222222",
      "confName": "2222222222222222222222222222222222222222222222222222222222",
      "source": {
        "type": "rtspSource",
        "id": ""
      },
      "ready": true,
      "readyTime": "2024-09-02T10:24:46.565974242+03:00",
      "tracks": [
        "H264"
      ],
      "bytesReceived": 0,
      "bytesSent": 0,
      "readers": []
    },
    {
      "name": "655980427062791438457878",
      "confName": "all_others",
      "source": {
        "type": "rtspSession",
        "id": "76cb7ae2-62fb-4b22-a33c-db2986c0ccc2"
      },
      "ready": true,
      "readyTime": "2024-09-02T10:20:07.234365534+03:00",
      "tracks": [
        "H264"
      ],
      "bytesReceived": 21918014,
      "bytesSent": 273508,
      "readers": []
    },
    {
      "name": "mystream",
      "confName": "all_others",
      "source": {
        "type": "rtspSession",
        "id": "d2cda1ab-4b44-4a45-a760-4facff809d4f"
      },
      "ready": true,
      "readyTime": "2024-09-02T10:24:24.167664431+03:00",
      "tracks": [
        "H264"
      ],
      "bytesReceived": 2099677,
      "bytesSent": 273508,
      "readers": []
    }
  ]
}

{
  "name": "655980427062791438457878",
  "confName": "all_others",
  "source": {
    "type": "rtspSession",
    "id": "76cb7ae2-62fb-4b22-a33c-db2986c0ccc2"
  },
  "ready": true,
  "readyTime": "2024-09-02T10:20:07.234365534+03:00",
  "tracks": [
    "H264"
  ],
  "bytesReceived": 50294116,
  "bytesSent": 273508,
  "readers": []
}

Describe how to replicate the issue

  1. start the server
  2. publish with ...
  3. read with ...

Did you attach the server logs?

yes / no

Did you attach a network dump?

yes / no

@pikachu937
Copy link
Author

as I understand it, we need to add the ability to change parameters not only based on the confName parameter, but also on the source -> type parameter in each specific stream, because the type is different, there is rtspSource and there is rtspSession

{
      "name": "2222222222222222222222222222222222222222222222222222222222",
      "confName": "2222222222222222222222222222222222222222222222222222222222",
      "source": {
        "type": "rtspSource",
        "id": ""
      },
      "ready": true,
      "readyTime": "2024-09-02T10:24:46.565974242+03:00",
      "tracks": [
        "H264"
      ],
      "bytesReceived": 0,
      "bytesSent": 0,
      "readers": []
    }
{
      "name": "mystream",
      "confName": "all_others",
      "source": {
        "type": "rtspSession",
        "id": "d2cda1ab-4b44-4a45-a760-4facff809d4f"
      },
      "ready": true,
      "readyTime": "2024-09-02T10:24:24.167664431+03:00",
      "tracks": [
        "H264"
      ],
      "bytesReceived": 2099677,
      "bytesSent": 273508,
      "readers": []
    }

@aler9
Copy link
Member

aler9 commented Sep 24, 2024

Hello, yes, lots of users want to control the individual record setting of paths linked to a shared configuration. We just have to think about a viable architecture for doing this, because i cannot think about a unique solution.

Currently, the server works with a top-bottom approach in which settings are stored in "path configurations", and paths cannot change settings on their own. The advantage of this is that multiple paths can be updated at the same time, by just changing a parameter in the "path configuration".

A completely opposite strategy would be to copy "path configurations" inside paths when they are created, and allow paths to change their settings independently from configurations. The disadvantage of this is that it wouldn't be possible anymore to update paths by just updating their path configuration, since changes would have no effect.

Probably the best solution is a middle way in between.

@pikachu937
Copy link
Author

Hello everyone. Dear and mighty aler9, please tell me if you have any ideas or plans for implementing this? Thank you.

@aler9 aler9 changed the title change param in all_other over API allow to toggle recording on paths without a dedicated configuration Feb 25, 2025
@alex-eri
Copy link

alex-eri commented Mar 5, 2025

As workaround I do :

First call /v3/config/paths/add${path} with {record: true } to create configuration

Then call /v3/config/paths/patch${path} with {record: true } to update it if already exists.

Then call /v3/paths/get/${path} and check confName == name and if not get rtsp session id

Kick RTSP session with call /v3/rtspsessions/kick/${id} to reconnect client and use new configuration

jererobles added a commit to jererobles/mediamtx that referenced this issue May 28, 2025
When a new path configuration is added via the API with a name that exactly
matches an existing stream path, Mediamtx will now automatically hot reload
the path with the new configuration without requiring disconnection and
reconnection of publishers.

See bluenviron#3718
jererobles added a commit to jererobles/mediamtx that referenced this issue May 28, 2025
When a new path configuration is added via the API with a name that exactly
matches an existing stream path, Mediamtx will now automatically hot reload
the path with the new configuration without requiring disconnection and
reconnection of publishers.

See bluenviron#3718
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request general
Projects
None yet
3 participants