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

unsupported video message type when pulling from nginx-rtmp #2384

Closed
1 of 13 tasks
teowoz opened this issue Sep 20, 2023 · 5 comments · Fixed by #2808
Closed
1 of 13 tasks

unsupported video message type when pulling from nginx-rtmp #2384

teowoz opened this issue Sep 20, 2023 · 5 comments · Fixed by #2808
Labels
bug Something isn't working rtmp

Comments

@teowoz
Copy link

teowoz commented Sep 20, 2023

Which version are you using?

v1.1.0

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

When MediaMTX tries to open rtmp:// input coming from FFmpeg through nginx-rtmp-module, unsupported video message type message is displayed in log and it fails.

Type ids vary, I've encountered 15, 25, 26 and 27.

(before upgrade from 1.0.3 to 1.1.0, the error was unsupported video codec with id 6 or 13)

In some cases (when nginx-rtmp runs on localhost, but I'm not sure whether it's the actual reason), stopped: timed out is logged instead - I've already reported it as #2383

Describe how to replicate the issue

#2383 blocks me from writing detailed replication instructions, so I'll skip nginx-rtmp stream setup.

  1. start the server: MTX_API=true MTX_APIADDRESS=:9997 MTX_LOGLEVEL=debug ./mediamtx mediamtx.yml
  2. add pull stream using the API: curl -vv -d '{"source":"rtmp://my-nginx-rtmp-server/stream_test/bunny","sourceOnDemand":true}' -X POST -H 'Content-Type: application/json' http://localhost:9997/v2/config/paths/add/test
  3. try to read with ffprobe: ffprobe rtmp://localhost/test

Did you attach the server logs?

yes, unsupported_video_codec.log

Did you attach a network dump?

yes,
unsupported_video_codec.pcap.gz

@aler9 aler9 added bug Something isn't working rtmp labels Oct 17, 2023
@aler9
Copy link
Member

aler9 commented Oct 17, 2023

Hello, i've simulated your RTMP source by using the network dump you provided and encountered the error "unsupported video codec", so i produced a nightly release that includes #2520 and doesn't have the video codec check. Let me know if it works or if there's another error. In the second case, a sample file that can be passed from FFmpeg to nginx-rtmp-module and then MediaMTX would be of great help, since the network dump doesn't contain additional packets past the one that generates the video codec error.

mediamtx_v1.2.0-2-g1e1456d_darwin_amd64.tar.gz
mediamtx_v1.2.0-2-g1e1456d_darwin_arm64.tar.gz
mediamtx_v1.2.0-2-g1e1456d_linux_amd64.tar.gz
mediamtx_v1.2.0-2-g1e1456d_linux_arm64v8.tar.gz
mediamtx_v1.2.0-2-g1e1456d_linux_armv6.tar.gz
mediamtx_v1.2.0-2-g1e1456d_linux_armv7.tar.gz
mediamtx_v1.2.0-2-g1e1456d_windows_amd64.zip

@teowoz
Copy link
Author

teowoz commented Nov 15, 2023

I managed to reproduce similar error on localhost, by modifying nginx-rtmp config. It turns out that wait_video on; breaks MediaMTX:

2023/11/15 11:57:00 DEB [path fromnginx] [RTMP source] connecting
2023/11/15 11:57:01 ERR [path fromnginx] [RTMP source] invalid body size
2023/11/15 11:57:06 DEB [path fromnginx] [RTMP source] connecting
2023/11/15 11:57:07 ERR [path fromnginx] [RTMP source] invalid body size
2023/11/15 11:57:10 INF [path fromnginx] [RTMP source] stopped: timed out

How to replicate the issue

Tested with MediaMTX 1.3.0.

  1. create nginx.conf with content:
events {}

rtmp {
    server {
        listen 1935;
        application live {
                live on;
                wait_video on;
        }
    }
}
  1. start nginx-rtmp on a non-standard port and with our customized config, e.g. with Docker: docker run -d -p 1936:1935 -v $PWD/nginx.conf:/etc/nginx/nginx.conf:ro --name nginx-rtmp tiangolo/nginx-rtmp
  2. transmit to nginx-rtmp: ffmpeg -re -f lavfi -i testsrc2=r=25 -f lavfi -i anoisesrc=color=brown -c:v libx264 -g 25 -c:a aac -f flv rtmp://127.0.0.1:1936/live/aaaaaa
  3. start MediaMTX: MTX_API=true MTX_APIADDRESS=:9997 MTX_LOGLEVEL=debug ./mediamtx mediamtx.yml (config is the default provided with binary release package)
  4. add pull stream using the API: curl -vv -d '{"source":"rtmp://127.0.0.1:1936/live/aaaaaa","sourceOnDemand":true}' -X POST -H 'Content-Type: application/json' http://localhost:9997/v2/config/paths/add/fromnginx
  5. try to probe stream from MediaMTX: ffprobe rtmp://localhost/fromnginx, ffprobe will return Input/output error and MediaMTX will show invalid body size
  6. see that the same stream is readable using ffprobe directly: ffprobe rtmp://127.0.0.1:1936/live/aaaaaa

When trying to stream from the nginx-rtmp instance I was using when reporting this bug for the first time, different error is printed in MediaMTX log: unsupported video codec: 8 (and doesn't depend on actual video codec - it is 8 for both h264 and mpeg2video). But disabling wait_video in its config also fixes it.

@aler9
Copy link
Member

aler9 commented Dec 14, 2023

Hello, this should be fixed by #2808. Please test this nightly release and let me know if it works (click on artifacts, binaries):
https://github.com/bluenviron/mediamtx/actions/runs/7207849258

Copy link
Contributor

This issue is mentioned in release v1.4.1 🚀
Check out the entire changelog by clicking here

Copy link
Contributor

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 Jun 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working rtmp
Projects
None yet
2 participants