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

Majestic RTMP push does not work with MediaMTX, OvenMediaEngine and SRS #189

Open
iGraveD opened this issue Sep 8, 2024 · 13 comments
Open
Labels
low priority Not considered without funding rtmp

Comments

@iGraveD
Copy link

iGraveD commented Sep 8, 2024

Required information

  • Camera board id: ISVP, T31X
  • OpenIPC version: 2.4.08.24-lite
  • installation method: Majestic version which came with OpenIPC

Issue description

Like libnginx-mod-rtmp, which I reported earlier, these media servers (MediaMTX, OvenMediaEngine and SRS) don't work with Majestic as a video source over RTMP protocol. While, for example, they perfectly work with FFmpeg.

Expectations

I expected that Majestic is compatible with majority of media server programs.

Steps to reproduce

With MediaMTX:

  1. Download it from its release page, unpack and run.
  2. Push a stream from OpenIPC / Majestic / Settings / Output to rtmp://[MediaMTX]/mystream.
  3. Open http://[MediaMTX]:8889/mystream with your browser.
  4. The video in the browser does not play.
  5. Close streaming from OpenIPC / Majestic / Settings / Output.
  6. Stream a movie with FFmpeg, like this:
ffmpeg -re -i ./video.avi -c:v libx264 -c:a aac -bf 0 -f flv rtmp:/[MediaMTX]/mystream
  1. The video in the browser , which you opened earlier, starts playing.

With the same settings, RTMP stream from OpenIPC / Majestic perfectly works with YouTube.

Information to attach

video0:
  enabled: true
  codec: h264
  fps: 20
  bitrate: 4096
  rcMode: vbr
  gopSize: 1.0
  gopMode: normal
  profile: base
  size: 1920x1080
@flyrouter flyrouter added majestic low priority Not considered without funding rtmp and removed majestic labels Sep 8, 2024
@skilurius skilurius reopened this Sep 8, 2024
@skilurius
Copy link
Collaborator

Please test the following build: t31.lite.tar

@MalgathThelamin
Copy link

MalgathThelamin commented Sep 18, 2024

Majestic: master+91ad576, 2024-09-17

  • nginx-mod-rtmp: SUCCESS, but with some problems, which don't affect the video playback:
    • Its statistics don't not show video size and FPS
    • The stream at least one time disappeared from the statistics. However, the video continued to play.
  • go2rtc: FAIL go2rtc.log
  • MediaMTX: SUCCESS
  • OvenMediaEngine: FAIL ovenmediaengine.log
  • SRS: FAIL srs.log

@skilurius
Copy link
Collaborator

skilurius commented Sep 18, 2024

  • nginx-mod-rtmp requires some additional metadata for resolution and fps, generally this information could be extracted from nal units (ffprobe/ffmpeg does this).
  • SRS Can you please elaborate the exact problem, the log shows no issues.
  • go2rtc Can you provide an example for a reference test with ffmpeg?

@MalgathThelamin
Copy link

MalgathThelamin commented Sep 18, 2024

  • nginx-mod-rtmp I'm sorry, I don't understand. You mean, that Majestic doesn't send this metadata, it is by design and you are not planning to implement it?
  • SRS If I push the video from Majescic to rtmp://192.168.0.2/myapp/mystream, it does not play at http://192.168.0.2:8080/myapp/mystream.m3u8. If I stop Majestic and push a video with ffmpeg to the 1st URL, video plays at the 2nd URL. Isn't Drop ts segment, sequence_no=0, uri=mystream-0.ts, duration=2147456875ms in the log file an error?
  • go2rtc does not work even with ffmpeg. I raised an issue in go2rtc repository. Please don't pay any more attention to this program.

@MalgathThelamin
Copy link

SRS

When video does not play, it looks like this in the log file:

[2024-09-18 17:52:04.004][INFO][4671][4v5653rw] HTTP #0 192.168.1.205:55576 GET http://192.168.0.2:8080/myapp/mystream.m3u8, content-length=-1
[2024-09-18 17:52:04.004][WARN][4671][4v5653rw][2] http miss file=./objs/nginx/html/myapp/mystream.m3u8, pattern=/, upath=/myapp/mystream.m3u8

The ./objs/nginx/html/myapp/ folder contains only one file: mystream-0.ts.tmp.

When I push the video with ffmpeg, mystream.m3u8 file appears in the folder first, then mystream-#.ts files start to appear.

@skilurius
Copy link
Collaborator

skilurius commented Sep 18, 2024

I tested the following scenario:

docker run --rm -it -p 1935:1935 -p 8080:8080 ossrs/srs:6 objs/srs -c conf/docker.conf
docker run --rm -it -p 1935:1935 airensoft/ovenmediaengine:latest

cli -s .outgoing.server rtmp://192.168.1.85/app/live
ffprobe rtmp://192.168.1.85/app/live

SRS seems to work fine, but OvenMediaEngine requires more debugging.

I'm sorry, I don't understand. You mean, that Majestic doesn't send this metadata, it is by design and you are not planning to implement it?

This might follow at a later time, currently the most important part is to have overall compatibility with the listed applications.

Isn't Drop ts segment, sequence_no=0, uri=mystream-0.ts, duration=2147456875ms in the log file an error?

Indeed, this should be addressed on the next build

@MalgathThelamin
Copy link

MalgathThelamin commented Sep 18, 2024

Sorry, I am not familiar with Docker.
I have compiled the latest version of SRS now from source according to the manual.

git clone -b develop https://github.com/ossrs/srs.git
cd srs/trunk
./configure
make
./objs/srs -c conf/srs.conf

Can you test this scenario, please?

srs.log

ffprobe shows the following output:

ffprobe rtmp://192.168.0.2/myapp/mystream

ffprobe version 5.1.6-0+deb12u1+rpt1 Copyright (c) 2007-2024 the FFmpeg developers
  built with gcc 12 (Debian 12.2.0-14)
  configuration: --prefix=/usr --extra-version=0+deb12u1+rpt1 --toolchain=hardened --incdir=/usr/include/aarch64-linux-gnu --enable-gpl --disable-stripping --disable-mmal --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libglslang --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librist --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sand --enable-sdl2 --disable-sndio --enable-libjxl --enable-neon --enable-v4l2-request --enable-libudev --enable-epoxy --libdir=/usr/lib/aarch64-linux-gnu --arch=arm64 --enable-pocketsphinx --enable-librsvg --enable-libdc1394 --enable-libdrm --enable-vout-drm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-libplacebo --enable-librav1e --enable-shared
  libavutil      57. 28.100 / 57. 28.100
  libavcodec     59. 37.100 / 59. 37.100
  libavformat    59. 27.100 / 59. 27.100
  libavdevice    59.  7.100 / 59.  7.100
  libavfilter     8. 44.100 /  8. 44.100
  libswscale      6.  7.100 /  6.  7.100
  libswresample   4.  7.100 /  4.  7.100
  libpostproc    56.  6.100 / 56.  6.100
[flv @ 0x5573a8ceb0] Video codec (0) is not implemented. Update your FFmpeg version to the newest one from Git. If the problem still occurs, it means that your file has a feature which has not been implemented.
[flv @ 0x5573a8ceb0] If you want to help, upload a sample of this file to https://streams.videolan.org/upload/ and contact the ffmpeg-devel mailing list. ([email protected])
[flv @ 0x5573a8ceb0] Changing the codec id midstream is not implemented. Update your FFmpeg version to the newest one from Git. If the problem still occurs, it means that your file has a feature which has not been implemented.
[flv @ 0x5573a8ceb0] If you want to help, upload a sample of this file to https://streams.videolan.org/upload/ and contact the ffmpeg-devel mailing list. ([email protected])
[flv @ 0x5573a8ceb0] Could not find codec parameters for stream 1 (Video: flashsv, bgr24): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
Input #0, flv, from 'rtmp://localhost/myapp/mystream':
  Metadata:
    |RtmpSampleAccess: true
  Duration: N/A, start: 0.019000, bitrate: 128 kb/s
  Stream #0:0: Audio: aac, 44100 Hz, mono, fltp, 128 kb/s
  Stream #0:1: Video: flashsv, bgr24, 1k tbr, 1k tbn

@skilurius
Copy link
Collaborator

skilurius commented Sep 19, 2024

[flv @ 0x5573a8ceb0] Video codec (0) is not implemented. Update your FFmpeg version to the newest one from Git. If the problem still occurs, it means that your file has a feature which has not been implemented.

You need to update ffmpeg (to support H265) or use H264 instead.

Do you have a reference for OvenMediaEngine?
I tested the following, which is working on SRS:

wget http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4
ffmpeg -re -i BigBuckBunny.mp4 -c copy -f flv rtmp://192.168.1.85/app/live
ffprobe rtmp://192.168.1.85/app/live

@MalgathThelamin
Copy link

MalgathThelamin commented Sep 19, 2024

You need to update ffmpeg (to support H265) or use H264 instead.

Oh, my mistake. I completely forgot, that 2 days ago I noticed, that YouTube started accepting H265 stream from T31X (wasn't accepting a month ago), and forgot to switch back.

After switching Majestic back to H264:

  • ffprobe shows correct stream information
  • The stream shows up in SRS console (http://192.168.0.2:8080/console/en_index.html > Streams)
  • The stream plays normally at http://192.168.0.2:8080/myapp/mystream.flv
  • HLS files are not being created in ./objs/nginx/html/myapp/ normally, and, therefore, the stream does not play at http://192.168.0.2:8080/myapp/mystream.m3u8.

srs.log

If I push a video with ffmpeg, HLS files are being created normally.

Do you have a reference for OvenMediaEngine?

Rephrase your question, please.

@MalgathThelamin
Copy link

I also noticed, that from time to time, the stream disappears

  • from SRS console, while http://192.168.0.2:8080/myapp/mystream.flv continues playing
  • from nginx-mod-rtmp console, while http://192.168.0.2:8080/myapp/mystream.m3u8 continues playing

@MalgathThelamin
Copy link

MalgathThelamin commented Sep 20, 2024

I also noticed, that Majestic on ssc378de streams perfectly to all applications, including SRS (HLS at http://192.168.0.2:8080/myapp/mystream.m3u8) and OvenMediaEngine.

@skilurius
Copy link
Collaborator

skilurius commented Sep 20, 2024

Rephrase your question, please.

I mean if you have a working reference test to verify the initial function, for example:

docker run --rm -it -p 1935:1935 airensoft/ovenmediaengine:latest
wget http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4
ffmpeg -re -i BigBuckBunny.mp4 -c copy -f flv rtmp://192.168.1.85/app/live
ffprobe rtmp://192.168.1.85/app/live

I also noticed, that Majestic on ssc378de streams perfectly to all applications, including SRS

Interesting, that could indicate a problem or incompatibility on the (ingenic) sdk. I will try to verify this later.

@MalgathThelamin
Copy link

I test OvenMediaEngine like this. My installation method is partially based on its documentation, but uses the latest source and does not install the program.

git clone https://github.com/AirenSoft/OvenMediaEngine
cd OvenMediaEngine/src
../misc/prerequisites.sh
make release
cd bin/RELEASE
mkdir conf
cp ../../../misc/conf_examples/Server.xml conf
./OvenMediaEngine

Publishing a video file:

wget http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4
ffmpeg -re -i BigBuckBunny.mp4 -c copy -f flv rtmp://192.168.0.2/app/live
ffprobe http://192.168.0.2:3333/app/live/llhls.m3u8

The output shows a correct stream information.
The video is playable at http://192.168.0.2:3333/app/live/llhls.m3u8.

Publishing a H264/AAC stream from ssc378de to rtmp://192.168.0.2/app/live.
The ffprobe output is correct.
The video is playable.

Publishing a H264/AAC stream from t31x to rtmp://192.168.0.2/app/live.
ffprobe does not finish. The last line it outputs is:

[http @ 0x5586d02040] Opening 'http://192.168.0.2:3333/app/live/seg_1_236_audio_LY3jRMta_llhls.m4s?session=31_WR2Hxv8P' for reading

The video is not playable.
ovenmediaengine.log is full of errors:

[2024-09-21 07:40:52.968] E [AW-LLHLS0:61186] FMP4 Packager | fmp4_storage.cpp:347  | LLHLS stream (#default#app/live) / track (0) - the duration of the segment being created exceeded twice the target segment duration (2147483682.0 ms | expected: 6000) because there were no IDR frames for a long time. This segment is forcibly created and may not play normally.
[2024-09-21 07:40:52.998] I [SPRTMP-t1935:61180] RTMPProvider | rtmp_chunk_parser.cpp:572  | Timestamp is rolled for stream id: 1: last TS: 15176267091929, parsed: 151733, new: 15178414575797
[2024-09-21 07:40:52.998] W [Decaac:61261] Transcoder | transcoder_filter.cpp:129  | Timestamp has changed abnormally.  15165529673569 -> 15176267091929

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
low priority Not considered without funding rtmp
Projects
None yet
Development

No branches or pull requests

4 participants