Skip to content
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

raw query for the publisher not available in hooks #2483

Closed
1 task done
zeridon opened this issue Oct 10, 2023 · 4 comments · Fixed by #2522
Closed
1 task done

raw query for the publisher not available in hooks #2483

zeridon opened this issue Oct 10, 2023 · 4 comments · Fixed by #2522
Labels
enhancement New feature or request rtmp

Comments

@zeridon
Copy link

zeridon commented Oct 10, 2023

Which version are you using?

v1.1.1-32-g9de6423

Which operating system are you using?

  • Linux amd64 standard

Describe the issue

We are streaming via RTMP and consuming via HLS. We are using external authentication. RTMP itself starts to stream to rtmp://server.com:1935/some/path?token=xoxo-token

This leads to starting a path called some/path

When the path is ready to be streamed by clients (HLS) we want to runOnReady a script.sh which does some internal housekeeping and additional notifications. For this we need query to be available in some form (similar to externalAuthenticationURL is perfect).

Describe how to replicate the issue

externalAuthenticationURL: http://127.0.0.1:8085/auth
rtsp: no
webrtc: no
srt: no
rtmp: yes
rtmpAddress: 0.0.0.0:1935
rtmpEncryption: "no"

hls: yes
# encryption is enabled

paths:
  "~^(some|not-some|test)/(path|other)(.*)":
    source: publisher
    runOnReady: /usr/local/bin/notis-send.sh started $G2 $G1 $G3
  1. start the server
  2. publish with: ffmpeg -re -i src.flv -c copy -f flv rtmp://server.com:1935/some/path?token=xoxo-token&internal_param=xxx
  3. read with: does not matter

G3 capture group does not exists. There is also nothing in the env, there are no additional (usable) vars in the invocation of the script

Did you attach the server logs?

no

Did you attach a network dump?

no

@aler9 aler9 added bug Something isn't working rtmp enhancement New feature or request and removed bug Something isn't working labels Oct 17, 2023
@aler9
Copy link
Member

aler9 commented Oct 17, 2023

Hello,
Regarding the presence of G1, G2, G3, i created this script:

#!/bin/sh

echo $1
echo $2
echo $3

env

and i ran it with the configuration you provided:

paths:
  "~^(some|not-some|test)/(path|other)(.*)":
    source: publisher
    runOnReady: ./my_script.sh started $G2 $G1 $G3

The script worked correctly and printed the arguments:

started
path
some

and then the entire environment:

MTX_SOURCE_TYPE=rtmpConn
HOSTNAME=alex
SHLVL=1
MTX_PATH=some/path/tte
HOME=/root
G1=some
RTSP_PATH=some/path/tte
G2=path
G3=/tte
MTX_SOURCE_ID=24ef314c-0fe2-4603-adf5-638c4bfd0b68
_=/usr/local/go/bin/go
TERM=xterm
PATH=/go/bin:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
GOPATH=/go
PWD=/s
RTSP_PORT=8554
GOLANG_VERSION=1.20.10

So i could not found any bug here.

Regarding the possibility of using query parameters in hooks, i'll add an additional environment variable that contains query parameters. Next time please create two separate issues.

@zeridon
Copy link
Author

zeridon commented Oct 19, 2023

Correct. If streaming to rtmp://server.com:1935/some/path/otherthings?token=xoxo-token&internal_param=xxx G3 is populated. Probably i misunderstood how path is being consumed by mediamtx.

Thanks for #2522 that was exactly what i needed.

@aler9
Copy link
Member

aler9 commented Oct 28, 2023

added in v1.2.1

Copy link
Contributor

github-actions bot commented May 1, 2024

This issue is being locked automatically because it has been closed for more than 6 months.
Please open a new issue in case you encounter a similar problem.

@github-actions github-actions bot locked and limited conversation to collaborators May 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request rtmp
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants