Skip to content

How to play rtp stream?

Summary

Can't play rtp stream

Minimal project and steps to reproduce

I want to play the broadcast stream (there may be 20~30 clients).

I use ffmpeg to generate rtp stream.

ffmpeg -hwaccel_output_format cuda -re -stream_loop -1 -i MH.mp4 -s 1920x1080 -r 30 -vcodec h264_nvenc -an -pix_fmt yuv420p -preset p3 -f rtp rtp://127.0.0.1:1234>M_rtp_h264.sdp

get sdp file, M_rtp_h264.sdp.

I want to play in unity, but not working. (use VLCMinimalPlayback.cs)

_mediaPlayer.Media = new Media(new Uri("D:\\M_rtp_h264.sdp"));

Environment

  • OS: windows
  • Version windows 10
  • Unity Version : 2020.3.5f1
  • Device: PC
  • LibVLC version and architecture
  • LibVLCSharp version
  • VLC Unity plugin version : 0.1.7 (from Unity Store)
  • Scripting backend used : VLCMinimalPlayback.cs

Possible fixes

Edited by 蔡杰廷