Skip to content

[out#0/rtsp @ 0x86dd1c0] Could not write header (incorrect codec parameters ?): Server returned 400 Bad Request] when publishing a local video via ffmpeg to MediaMTX with JWT configured #4226

Closed as not planned
@hothethien

Description

Which version are you using?

bluenviron/mediamtx:latest-ffmpeg

Which operating system are you using?

Linux amd64 Docker

Describe how to replicate the issue

  1. Start the MediaMTX container on Ubuntu 22.04
  2. Setup authentication via JWT
    authMethod: jwt
    authJWTJWKS: https://xxx/realms/mediamtx/protocol/openid-connect/certs
    authJWTClaimKey: mediamtx_permissions
  3. Use ffmpeg to publish a local .mp4 file to MediaMTX server with JWT
    ffmpeg -re -stream_loop -1 -i output.mp4 -c copy -f rtsp rtsp://10.8.0.88:8554/phucdesktop?jwt=MY_JWT
  4. It returned 400 bad request
    [out#0/rtsp @ 0x86dd1c0] Could not write header (incorrect codec parameters ?): Server returned 400 Bad Request

Server logs

2025/02/06 14:28:09 DEB [RTSP] [conn 10.8.0.88:49988] [c->s] ANNOUNCE rtsp://10.8.0.88:8554/phucdesktop?jwt=xxx RTSP/1.0
CSeq: 2
Content-Length: 489
Content-Type: application/sdp
User-Agent: Lavf61.1.100

v=0
o=- 0 0 IN IP4 127.0.0.1
s=No Name
c=IN IP4 10.8.0.88
t=0 0
a=tool:libavformat 61.1.100
m=video 0 RTP/AVP 96
b=AS:959
a=rtpmap:96 H264/90000
a=fmtp:96 packetization-mode=1; sprop-parameter-sets=Z01AH9oBQBbsBEAAAAMAQAAADIPGDKg=,aO88gA==; profile-level-id=4D401F
a=control:streamid=0
m=audio 0 RTP/AVP 97
b=AS:383
a=rtpmap:97 MPEG4-GENERIC/48000/6
a=fmtp:97 profile-level-id=1;mode=AAC-hbr;sizelength=13;indexlength=3;indexdeltalength=3; config=11B0
a=control:streamid=1

2025/02/06 14:28:09 INF [RTSP] [session 9a45d3f8] created by 10.8.0.88:49988
2025/02/06 14:28:09 DEB [RTSP] [conn 10.8.0.88:49988] [s->c] RTSP/1.0 400 Bad Request
CSeq: 2
Server: gortsplib

2025/02/06 14:28:09 INF [RTSP] [conn 10.8.0.88:49988] closed: path 'phucdesktop' is not configured
2025/02/06 14:28:09 INF [RTSP] [session 9a45d3f8] destroyed: not in use

BUT

I had run with the same configuration file, and on Docker Desktop Windows, it runs perfectly. I found that, JWT token was trimmed when run on Linux, but not on Windows

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions