Ready-to-use SRT / WebRTC / RTSP / RTMP / LL-HLS media server and media proxy that allows to read, publish, proxy, record and playback video and audio streams.
MIT License
12.36k
stars
1.53k
forks
source link
Docker says all is well, but every method to stream to server fails #3739
Have not received a reply in three weeks, thought it would be prudent to raise it as an issue at this point.
There's a good chance this is me being unable to read the documentation properly or something, but even in that worst case we can improve the documentation, if the code itself is all fine.
Originally posted by **darkshoxx** August 16, 2024
### Question
Hi,
while my goal is to stream to and from the server using OBS, I'm trying everything in my power to stream to my server, but each method gives me an error. I have followed the instructions on docker hub and github.
I'll start with my specs, then I'll explain how each method I tried (OBS, python + OpenCV, FFMPEG, VLC, WebRTC)
# Specs and Setup
I run Win 11 with a clean install of Docker Desktop (yes I have rebooted), I have WSL 2.1.5.0
I have no additional antivir to the Windows ones (
I have used strictly only
`docker pull bluenviron/mediamtx`
and
`docker run --rm -it --network=host bluenviron/mediamtx`
and I get the status
```
2024/08/16 18:02:20 INF MediaMTX v1.8.5
2024/08/16 18:02:20 INF configuration loaded from /mediamtx.yml
2024/08/16 18:02:20 INF [RTSP] listener opened on :8554 (TCP), :8000 (UDP/RTP), :8001 (UDP/RTCP)
2024/08/16 18:02:20 INF [RTMP] listener opened on :1935
2024/08/16 18:02:20 INF [HLS] listener opened on :8888
2024/08/16 18:02:20 INF [WebRTC] listener opened on :8889 (HTTP), :8189 (ICE/UDP)
2024/08/16 18:02:20 INF [SRT] listener opened on :8890 (UDP)
```
in the command line and status `running` in docker desktop.
# Attempts
## Ffmpeg
I have an mp4 file that I have converted to a .ts file with ffmpeg, called room.ts. Running
`ffmpeg -re -stream_loop -1 -i room.ts -c copy -f rtsp rtsp://localhost:8554/mystream`
brings up a huge status list
```
ffmpeg version 7.0.2-full_build-www.gyan.dev Copyright (c) 2000-2024 the FFmpeg developers
built with gcc 13.2.0 (Rev5, Built by MSYS2 project)
configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libaribb24 --enable-libaribcaption --enable-libdav1d --enable-libdavs2 --enable-libuavs3d --enable-libxevd --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxeve --enable-libxvid --enable-libaom --enable-libjxl --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libharfbuzz --enable-liblensfun --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-dxva2 --enable-d3d11va --enable-d3d12va --enable-ffnvcodec --enable-libvpl --enable-nvdec --enable-nvenc --enable-vaapi --enable-libshaderc --enable-vulkan --enable-libplacebo --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libcodec2 --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
libavutil 59. 8.100 / 59. 8.100
libavcodec 61. 3.100 / 61. 3.100
libavformat 61. 1.100 / 61. 1.100
libavdevice 61. 1.100 / 61. 1.100
libavfilter 10. 1.100 / 10. 1.100
libswscale 8. 1.100 / 8. 1.100
libswresample 5. 1.100 / 5. 1.100
libpostproc 58. 1.100 / 58. 1.100
Input #0, mpegts, from '.\room.ts':
Duration: 00:13:13.99, start: 1.423000, bitrate: 848 kb/s
Program 1
Metadata:
service_name : Service01
service_provider: FFmpeg
Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, unknown/bt709/unknown, progressive), 1920x1080, 60 fps, 60 tbr, 90k tbn
Stream #0:1[0x101](und): Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 163 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
```
however I get no changes on the server or the ffmpeg terminal. Trying to exit via Ctrl+C I get
```
[out#0/rtsp @ 000001919d4ddb00] Could not write header (incorrect codec parameters ?): Immediate exit requested
Exiting normally, received signal 2.
```
I've tried different variants using ffmpeg, including streaming the mp4 file itself, but all to no avail.
Adding in/out rules for UDP/TCP port 8554 did not change this result.
## OBS Studio
Following the instructions I set Service to custom, server to rtmp://localhost and streamkey to `mystream` (but also tried without).
When I hit "Start Streaming" I get the error about 10 seconds later: "Failed to connect to server"
Adding in/out rules for TCP port 1935 did not change this result.
## python + OpenCV
using a python 3.10 venv with opencv-python 4.10.0.84 and the exact script from the readme file, I get the error
```
Traceback (most recent call last):
File "PATH REDACTED\scratch.py", line 23, in
raise Exception("can't open video writer")
Exception: can't open video writer
```
## WebRTC
By readme I should open `http://localhost:8889/mystream/publish` in a browser, which gives an "Unable to connect" error, so does `http://localhost:8889` itself.
Adding in/out rules for UDP port 8889 did not change this result.
## VLC
Similar to ffmpeg. Ctrl+S, I choose a file to stream, add an RTSP server with port 8554. Nothing happens. I get no error but also no feedback.
# Additional Comments
I'm (obviously) new to rtsp servers and the like. This docker is the third solution I've tried after FFMPEG itself and VLC itself. I've attempted multiple hours of troubleshooting on each of these attempts and it led to nowhere.
I cannot even figure out if I'm doing something wrong with the server, or something is wrong in each of my attempts to stream to it. Since I usually assume myself to be at fault, I post this as a discussion here and not as a github issue.
Any and all help is greatly appreciated.
This issue is being automatically closed because it does not follow the issue template.
Please reopen the issue and make sure to include all sections of the template.
Have not received a reply in three weeks, thought it would be prudent to raise it as an issue at this point. There's a good chance this is me being unable to read the documentation properly or something, but even in that worst case we can improve the documentation, if the code itself is all fine.
Discussed in https://github.com/bluenviron/mediamtx/discussions/3664