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

Hooks not working (runOnRead,runOnUnread,runOnRecordSegmentCreate,runOnRecordSegmentComplete) #3372

Open
1 of 13 tasks
Byorun opened this issue May 19, 2024 · 0 comments
Open
1 of 13 tasks

Comments

@Byorun
Copy link

Byorun commented May 19, 2024

Which version are you using?

v1.8.1

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 (please describe)

Describe the issue

I am trying to use several hooks in order to automate/track some things of the stream, but several hooks won't get triggered.
Only runOnReady and runOnNotReady are working

  • runOnRead : no execution, no logs even on debug (I am trying to capture the current viewer count with that)
  • runOnUnread: no execution, no logs even on debug (I am trying to capture the current viewer count with that)
  • runOnRecordSegmentCreate: [path livestream/byorun] runOnRecordSegmentCreate command launched in logs but the script is not executed
  • runOnRecordSegmentComplete: [path livestream/byorun] runOnRecordSegmentComplete command launched in logs but the script is not executed

All scripts are basically the same, only the final webhook url changes

#!/usr/bin/bash

WEBHOOK_URL="https://HOSTNAME/mediamtx/webhook/on-stream-ready"

curl -s -d "{\"MTX_PATH\":\"${1}\", \"MTX_QUERY\":\"${2}\", \"MTX_SOURCE_TYPE\":\"${3}\", \"MTX_SOURCE_ID\":\"${4}\"}" -H "Content-Type: application/json" -X POST $WEBHOOK_UR

If I start a stream the runOnReady hook is triggered (which can be confirmed by the mediamtx log and and the webserver log)
If I stop a stream the runOnNotReady hook is triggered (which can be confirmed by the mediamtx log and and the webserver log)
The rest does nothing.

Describe how to replicate the issue

  1. start the server
  2. configure external http auth
authHTTPExclude:
- action: playback
- action: read
- action: api
- action: metrics
- action: pprof

I disabled read and playback auth calls due to heavy server load due to too many auth post requests in case of LL-HLS streams

paths:
  # example:
  # my_camera:
  #   source: rtsp://my_camera
  "~^livestream/([a-z0-9]+)$":
    record: yes
    runOnReady: /usr/local/bin/mediamtx_on_stream_ready $MTX_PATH $MTX_QUERY $MTX_SOURCE_TYPE $MTX_SOURCE_ID $G1
    runOnNotReady: /usr/local/bin/mediamtx_on_stream_not_ready $MTX_PATH $MTX_QUERY $MTX_SOURCE_TYPE $MTX_SOURCE_ID $G1
    runOnRead: /usr/local/bin/mediamtx_on_stream_read $MTX_PATH $MTX_QUERY $MTX_READER_TYPE $MTX_READER_ID $G1
    runOnUnread: /usr/local/bin/mediamtx_on_stream_unread $MTX_PATH $MTX_QUERY $MTX_READER_TYPE $MTX_READER_ID $G1
    runOnRecordSegmentCreate: /usr/local/bin/mediamtx_on_record_segement_created $MTX_PATH $MTX_SEGMENT_PATH $G1
    runOnRecordSegmentComplete: /usr/local/bin/mediamtx_on_record_segement_completed $MTX_PATH $MTX_SEGMENT_PATH $G1
  # Settings under path "all_others" are applied to all paths that
  # do not match another entry.
#  all_others:
  1. publish with obs
  2. read with web browser

Did you attach the server logs?

no useful output even on log level debug other than the two lines mentioned above

Did you attach a network dump?

no

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant