Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Official Unity Render Streaming Introduction & FAQ

Discussion in 'Unity Render Streaming' started by kazuki_unity729, Sep 10, 2019.

  1. donov

    donov

    Joined:
    Apr 15, 2013
    Posts:
    55
    I am trying to send video from the browser to Unity and I get an error when setting the local description in Unity OnOffer from the browser
    "Network Error: Failed to set local answer sdp: Failed to set local video description recv parameters for m-section with mid='0'."
     
  2. kazuki_unity729

    kazuki_unity729

    Unity Technologies

    Joined:
    Aug 2, 2018
    Posts:
    803
    I guess you are using the v2.3.0 package which has a bug related to your issue.
    Please try the hotfix version v.2.3.1.
     
  3. donov

    donov

    Joined:
    Apr 15, 2013
    Posts:
    55
    Or just a guide for how to use the app2.js example on the Unity side would help. I must be missing something.
    I thought something with the transceiver configuration could be wrong
     
  4. jejhosua

    jejhosua

    Joined:
    Aug 3, 2020
    Posts:
    5
    Hello I have the same error sending from Unity to Unity. Did you find a solution for this?
     
  5. kazuki_unity729

    kazuki_unity729

    Unity Technologies

    Joined:
    Aug 2, 2018
    Posts:
    803
    How about the 2.3.1 which latest version of the WebRTC package?
     
  6. alloplastic

    alloplastic

    Joined:
    Jun 30, 2015
    Posts:
    18
    Hi,

    I’m getting a scrambled video stream and wanted to ask if this image indicates the likely problem. A codec mismatch? A mismatch is frame sizes? (I have tried to regularize to 1280 x 720.)

    I have had success with hardware encoding in various setups. This problem is related to software encoding on my local PC (Windows 10, NVIDIA video card).

    I’ve updated to WebRTC 2.3.1 in both of the Unity projects.

    Components in my setup:
    • Unity Server, based on the Unity Render Streaming package version 2.2.2, which I manually updated for compatibility with WebRTC 2.3.1.
    • Unity Client, based on the WebRTC 2.3.1 sample called “VideoReceive.”
    • Signaling Server, based on the NodeJS server included with Unity Render Streaming 2.2.2.
    Hardware encoding, whether on my local PC or in the cloud, works great for any configuration involving:
    • Unity Server
    • Signaling Server
    • Web Browser (again using the sample web app from Unity Render Streaming 2.2.2.)
    The image is from testing with software encoding on my local PC with:
    • Unity Server
    • Signaling Server
    • Unity Client
    Please let me know if you have any ideas. I’d be happy to provide more info if necessary.

     
  7. jejhosua

    jejhosua

    Joined:
    Aug 3, 2020
    Posts:
    5
    I'm using 2.3.1 already. This version solves the wrong string ICE error but not this one.

    Network Error: Failed to set local answer sdp: Failed to set local video description recv parameters for m-section with mid='0'
     
  8. donov

    donov

    Joined:
    Apr 15, 2013
    Posts:
    55
    I still have this issue, was about to try WebRTC 2.3.1 but if you say its not working as well we need some help from Unity then
     
  9. Bivens32

    Bivens32

    Joined:
    Jul 8, 2013
    Posts:
    36
    Is there a way to stream video from the browser using python? I'm trying to use opencv on a video stream from Unity and WebRTC seems like it might be an easy way to do that.
     
  10. donov

    donov

    Joined:
    Apr 15, 2013
    Posts:
    55
    any news about looking in to this?
     
  11. kazuki_unity729

    kazuki_unity729

    Unity Technologies

    Joined:
    Aug 2, 2018
    Posts:
    803
    This issue might be caused by the flag of the hardware encoder. If you enable to use the hardware encoder, the codec is determined to H.264.
    Currently, the H.264 decoder is not supported, so the ICE exchange should be failed.
     
  12. donov

    donov

    Joined:
    Apr 15, 2013
    Posts:
    55
    Confirmed, it works with software encoding.
    Any road map on H.264 decoder and mobile support as well
     
    jejhosua likes this.
  13. kazuki_unity729

    kazuki_unity729

    Unity Technologies

    Joined:
    Aug 2, 2018
    Posts:
    803
    @alloplastic
    I guess your issue is similar to this post.
    https://forum.unity.com/threads/unity-render-streaming-introduction-faq.742481/page-12#post-6760897
     
  14. fourbb

    fourbb

    Joined:
    Jul 22, 2020
    Posts:
    13
    Hello,
    I created a renderTexture1 to use as the targetTexture for the camera, and used the constructor videoStreamTrack (String Label, renderTexture Source) to create a track from Texutre1,
    but the screen is black on the browser side.
    do you have any suggestions to fix this or can you provide the code for captureStreamTrack ()
     
  15. alloplastic

    alloplastic

    Joined:
    Jun 30, 2015
    Posts:
    18
    @kazuki_unity729 - Thank you for the reply. Turns out the issue was the resolution. I just stumbled on one more place in the configuration where I had a different video resolution. Once I changed that to 1280x720 the video came through clearly.

    So: confirmed that software-based streaming works from a Unity server to a Unity client.
     
    DuckStock likes this.
  16. kazuki_unity729

    kazuki_unity729

    Unity Technologies

    Joined:
    Aug 2, 2018
    Posts:
    803
    Thanks for the sharing.
    Currently, the configuration of video resolution might be difficult to understand.
    We need to consider the way to easier it.
     
    EirikWahl likes this.
  17. timcsy

    timcsy

    Joined:
    Aug 25, 2020
    Posts:
    1
    I wonder how to stream the specific track to the specific channel (by channel id or other method), thanks!
     
  18. baobab

    baobab

    Joined:
    Oct 16, 2013
    Posts:
    1
    [WebRTC] SetAnswerDesc : error : Failed to set remote answer sdp: Failed to set remote video description send parameters for m-section with mid='1'.
    I have developed with unity webrtc library 2.3.1, and have used it well with software encoding.
    But when I tested nvidia [NVIDIA Tesla T4], I got the error.
    The answer sdp was the following. What's the problem?

    v=0
    o=- 323691294067975285 3 IN IP4 127.0.0.1
    s=-
    t=0 0
    a=group:BUNDLE 0 1 2
    a=msid-semantic: WMS
    m=audio 54722 UDP/TLS/RTP/SAVPF 111 110
    c=IN IP4 1.227.95.66
    a=rtcp:9 IN IP4 0.0.0.0
    a=candidate:2698998123 1 udp 2113937151 f66dc19f-2b5b-4ba2-ab03-196f453ec558.local 54722 typ host generation 0 network-cost 999
    a=candidate:842163049 1 udp 1677729535 1.227.95.66 54722 typ srflx raddr 0.0.0.0 rport 0 generation 0 network-cost 999
    a=ice-ufrag:1Xot
    a=ice-pwd:+NEt3AVx+4p6SjXfameS/0ah
    a=ice-options:trickle
    a=fingerprint:sha-256 18:63:3F:F4:BA:87:7B:52:4C:B7:3B:97:69:D8:30:3A:77:DE:1B:96:A6:43:2D:FF:1C:63:D7:F8:3C:6C:40:48
    a=setup:active
    a=mid:0
    a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level
    a=extmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
    a=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
    a=extmap:4 urn:ietf:params:rtp-hdrext:sdes:mid
    a=extmap:5 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id
    a=extmap:6 urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id
    a=inactive
    a=rtcp-mux
    a=rtpmap:111 opus/48000/2
    a=rtcp-fb:111 transport-cc
    a=fmtp:111 minptime=10;useinbandfec=1
    a=rtpmap:110 telephone-event/48000
    m=video 9 UDP/TLS/RTP/SAVPF 127 126 125 102 98 99 100
    c=IN IP4 0.0.0.0
    a=rtcp:9 IN IP4 0.0.0.0
    a=ice-ufrag:1Xot
    a=ice-pwd:+NEt3AVx+4p6SjXfameS/0ah
    a=ice-options:trickle
    a=fingerprint:sha-256 18:63:3F:F4:BA:87:7B:52:4C:B7:3B:97:69:D8:30:3A:77:DE:1B:96:A6:43:2D:FF:1C:63:D7:F8:3C:6C:40:48
    a=setup:active
    a=mid:1
    a=extmap:14 urn:ietf:params:rtp-hdrext:toffset
    a=extmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
    a=extmap:13 urn:3gpp:video-orientation
    a=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
    a=extmap:12 http://www.webrtc.org/experiments/rtp-hdrext/playout-delay
    a=extmap:11 http://www.webrtc.org/experiments/rtp-hdrext/video-content-type
    a=extmap:7 http://www.webrtc.org/experiments/rtp-hdrext/video-timing
    a=extmap:8 http://www.webrtc.org/experiments/rtp-hdrext/color-space
    a=extmap:4 urn:ietf:params:rtp-hdrext:sdes:mid
    a=extmap:5 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id
    a=extmap:6 urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id
    a=recvonly
    a=rtcp-mux
    a=rtcp-rsize
    a=rtpmap:127 VP8/90000
    a=rtcp-fb:127 goog-remb
    a=rtcp-fb:127 transport-cc
    a=rtcp-fb:127 ccm fir
    a=rtcp-fb:127 nack
    a=rtcp-fb:127 nack pli
    a=rtpmap:126 VP9/90000
    a=rtcp-fb:126 goog-remb
    a=rtcp-fb:126 transport-cc
    a=rtcp-fb:126 ccm fir
    a=rtcp-fb:126 nack
    a=rtcp-fb:126 nack pli
    a=fmtp:126 profile-id=0
    a=rtpmap:125 VP9/90000
    a=rtcp-fb:125 goog-remb
    a=rtcp-fb:125 transport-cc
    a=rtcp-fb:125 ccm fir
    a=rtcp-fb:125 nack
    a=rtcp-fb:125 nack pli
    a=fmtp:125 profile-id=2
    a=rtpmap:102 VP9/90000
    a=rtcp-fb:102 goog-remb
    a=rtcp-fb:102 transport-cc
    a=rtcp-fb:102 ccm fir
    a=rtcp-fb:102 nack
    a=rtcp-fb:102 nack pli
    a=fmtp:102 profile-id=1
    a=rtpmap:98 red/90000
    a=rtpmap:99 rtx/90000
    a=fmtp:99 apt=98
    a=rtpmap:100 ulpfec/90000
    m=application 9 UDP/DTLS/SCTP webrtc-datachannel
    c=IN IP4 0.0.0.0
    a=ice-ufrag:1Xot
    a=ice-pwd:+NEt3AVx+4p6SjXfameS/0ah
    a=ice-options:trickle
    a=fingerprint:sha-256 18:63:3F:F4:BA:87:7B:52:4C:B7:3B:97:69:D8:30:3A:77:DE:1B:96:A6:43:2D:FF:1C:63:D7:F8:3C:6C:40:48
    a=setup:active
    a=mid:2
    a=sctp-port:5000
    a=max-message-size:262144
     
  19. kazuki_unity729

    kazuki_unity729

    Unity Technologies

    Joined:
    Aug 2, 2018
    Posts:
    803
    That is impossible.
    What do you want to make using it?
     
  20. kazuki_unity729

    kazuki_unity729

    Unity Technologies

    Joined:
    Aug 2, 2018
    Posts:
    803
    The software decoder is not supported H.264 codec, so you need to use the software encoder, Unfortunately.
     
  21. Willchenyang

    Willchenyang

    Joined:
    Jul 20, 2018
    Posts:
    14
    Is it possible to pause the webrtc transmission? I have case where I need to stream a render texture only when user input something, basically I only render and transmit as needed. Maybe I should use socket in this case? Thanks !
     
  22. caxictpd

    caxictpd

    Joined:
    Dec 6, 2018
    Posts:
    3
    I already managed to stream on my local network, but when I run webstreming.exe I only have the option to use the local IP (127.0.0.0 or the local lan 192.168.14.17) I have a fixed public IP and I want to be able to enter from outside of my LAN for streaming.


    upload_2021-2-9_14-19-51.png


    upload_2021-2-9_14-19-39.png


    When I open the window of my public IP, if I have the menus but not the streaming of the 3D space:




    upload_2021-2-9_14-23-47.png
    upload_2021-2-9_14-20-52.png

    Additionally I have this error:
    upload_2021-2-9_14-26-46.png

    And I do not know what happens.

    Any ideas?
     
    unity_gmarte likes this.
  23. kazuki_unity729

    kazuki_unity729

    Unity Technologies

    Joined:
    Aug 2, 2018
    Posts:
    803
  24. kazuki_unity729

    kazuki_unity729

    Unity Technologies

    Joined:
    Aug 2, 2018
    Posts:
    803
    501? I have never seen this error code...
    Do you know what request occurs this error?
     
  25. maramak

    maramak

    Joined:
    Mar 7, 2016
    Posts:
    13
    Hi!
    I tried to test the operation of the SimpleRenderStreamingURP scene. In the browser, the 'Light on', 'Light off' and 'Play audio' buttons work as expected, but you can't control the camera from the browser window. In the Unity console, an error appears:
    I use Unity 2020.2.3.f1, Unity Render Streaming Version 2.2.2-preview, WebRTC Version 2.2.1-preview. Unity, webserver.exe and Firefox browser are running localy on the same PC (Windows 10 x64).

    Please tell me how can I get rid of the error?

    UPD. Sometimes a miracle happens and I manage to control the camera in Unity from the browser window and vice versa (control the browser camera from the Unity window). However, the error described above still appears in the console. There were also cases where I could either control the camera in Unity from the browser window, or control the camera in the browser from the Unity window, but not both at the same time... In general, the behavior changes whenever I refresh the page in the browser and restart the webserver.exe
     
    Last edited: Feb 11, 2021
  26. kazuki_unity729

    kazuki_unity729

    Unity Technologies

    Joined:
    Aug 2, 2018
    Posts:
    803
    Thanks for sharing.
    Can it be reproduced on Chrome?
    I will try it on the latest Firefox.
     
  27. maramak

    maramak

    Joined:
    Mar 7, 2016
    Posts:
    13
    Yes, same behaviour also reproduces in Chrome. May be the problem is in not stable connection with stun:stun.l.google.com:19302 Ice server... I will try to set up local Ice server and test this issue.
     
  28. kazuki_unity729

    kazuki_unity729

    Unity Technologies

    Joined:
    Aug 2, 2018
    Posts:
    803
    Thanks,
    What protocol are you using for the signaling?
    Websocket or HTTP?
     
  29. maramak

    maramak

    Joined:
    Mar 7, 2016
    Posts:
    13
    HttpSignaling, url: http://localhost
     
  30. kazuki_unity729

    kazuki_unity729

    Unity Technologies

    Joined:
    Aug 2, 2018
    Posts:
    803
  31. maramak

    maramak

    Joined:
    Mar 7, 2016
    Posts:
    13
    No, this is not an error I receive. Mine is about: "Network Error: Failed to set remote answer sdp: Called in wrong state: kStable"

    Local ice server did not fix the issue.
     
  32. kannan-xiao4

    kannan-xiao4

    Unity Technologies

    Joined:
    Nov 5, 2020
    Posts:
    76
    Hi, @SunnyChow

    We rename app2.js to bidirectional/main.js.
    and we implement main page for web client on version 3.0 ( currently develop branch).
    Please see new main page (source code here ).

    I checked that sample is working with Unity(Birdirectional Scene)-Browser.

    Thanks
     
    SunnyChow likes this.
  33. kazuki_unity729

    kazuki_unity729

    Unity Technologies

    Joined:
    Aug 2, 2018
    Posts:
    803
    If I remember right, This error occurs when the available codec is not found in two peers.
    Could you check the settings "hardware encoder support"?
     
  34. DuckStock

    DuckStock

    Joined:
    Jul 25, 2016
    Posts:
    9
    Any chance you have your source for this connection flow posted anywhere :)? (Unity server to client instead of browser). I am working on a similar implementation and would appreciate it as a resource.
     
  35. wechat_os_Qy005by_pzfV0HmWZxb1lf6fQ

    wechat_os_Qy005by_pzfV0HmWZxb1lf6fQ

    Joined:
    Jan 26, 2021
    Posts:
    7
    Hi!
    I'm trying to deal with buttons. How to handle button click events in renderstreaming? Thank you all!
     
  36. kazuki_unity729

    kazuki_unity729

    Unity Technologies

    Joined:
    Aug 2, 2018
    Posts:
    803
    Unity client sample is contained in the next version of Unity Render Streaming.
    We will publish it soon.

    You can see the manual for these samples here.
    https://github.com/Unity-Technologi...ity.renderstreaming/Documentation~/samples.md
     
    DuckStock and lmoskun like this.
  37. kazuki_unity729

    kazuki_unity729

    Unity Technologies

    Joined:
    Aug 2, 2018
    Posts:
    803
    Where is the button placed? Browser or Unity?
     
  38. wechat_os_Qy005by_pzfV0HmWZxb1lf6fQ

    wechat_os_Qy005by_pzfV0HmWZxb1lf6fQ

    Joined:
    Jan 26, 2021
    Posts:
    7
    Button in Unity.
    I have two ideas to respond to the button event in unity in renderstreaming. The web side detects the button in unity canvas and sends the button click event to the unity side after clicking the mouse (is it difficult for the web side to implement it?). The other is that the unity side detects whether the button has been clicked according to the position of the mouse click and performs related operations (this may have applicability problems).

    I hope you can provide some ideas to realize it, thank you!
     
  39. salvolannister

    salvolannister

    Joined:
    Jan 3, 2019
    Posts:
    50
    I have trouble visualizing the second stream and I was wondering if any of you had the same issues.
    If I stream locally using the default sample scene and a modified version of the webApp I manage to see the videoThumbnail almost all the time, while if I stream with a public IP only the first stream get shown on the main page.
    I have no error in the browser console log and nothing in the unity one as well.
    How can I discover what is happening?

    Unity version 2019.4.11f1
    PKG version 2.2.2
     
  40. salvolannister

    salvolannister

    Joined:
    Jan 3, 2019
    Posts:
    50
    It's not difficult, the webapp already reads click and mouse position continuously and send it to the Unity Instance.
    Then this one creates a fake input as it was really happening in unity, this is done in RemoteInput.cs while the input created is then read in SimpleCameraController.cs.

    I know it may sound complicated but reading this two scripts you will manage to do what you want
     
  41. DuckStock

    DuckStock

    Joined:
    Jul 25, 2016
    Posts:
    9
  42. wechat_os_Qy005by_pzfV0HmWZxb1lf6fQ

    wechat_os_Qy005by_pzfV0HmWZxb1lf6fQ

    Joined:
    Jan 26, 2021
    Posts:
    7
    Sorry, I can't understand it.

    In my opinion, webapp can only judge whether the mouse clicks or not, and where the mouse clicks. When the mouse clicks, it will only send the sendmouse event information, not the buttonclick event. Therefore, webapp can't judge whether the clicking position is a button element in unity. The ButtonClick event in remoteinput.cs only occurs when the mouse clicks on the button element in browser.

    So how can I simply and universally respond to the button click event in unity?
     
  43. salvolannister

    salvolannister

    Joined:
    Jan 3, 2019
    Posts:
    50
    You are right, button click event has nothing to do with the button click event you would like to achieve.
    What would probably help you is understanding well what happens after the send mouse event in the webApp and how those information are used by the unity Instance.

    This function
    Code (CSharp):
    1.  InputSystem.QueueStateEvent(RemoteMouse, new MouseState {
    2.                 position = pos,
    3.                 delta = delta,
    4.                 buttons = button
    5.             });
    creates a fake input based on the information received from the internet. If I were you I would try to add a canvas and see if it already works without any more efforts, in the negative case I would try to create a fake ray-cast as It was done with this function for the mouse movement.
     
  44. wechat_os_Qy005by_pzfV0HmWZxb1lf6fQ

    wechat_os_Qy005by_pzfV0HmWZxb1lf6fQ

    Joined:
    Jan 26, 2021
    Posts:
    7
    I see what you mean. But in my case, the unity instance can't capture the button click event. I can't find the reason. Is it because of the coordinate problem that I didn't actually click the button?
     
  45. PilerT

    PilerT

    Joined:
    Aug 18, 2019
    Posts:
    3
    Thank you for your contribution to this awesome project.

    But I have trouble when I use the latest version of render streaming (v2.2.2)

    How can I stream only one camera and allow all other browser can control the camera? The Sample is multi camera but it seem to write badly cannot stream one camera.

    Also, client of unity editor cannot control the camera as well
     
    Last edited: Mar 1, 2021
  46. patsku

    patsku

    Joined:
    Feb 4, 2020
    Posts:
    1
    First, nice work with the render streaming, we have found it very useful!

    However, at the moment we are having trouble getting high enough framerates even though hardware is not fully utilized. It seems that video encoding is currently fully synchronous with rendering meaning that the render thread waits for the encoder to finish before it starts rendering cameras for the next frame. It does not affect latency but has a major effect on throughput. Are there any plans to implement asynchronous encoding or multithreading with the render streaming plugin? We are using Nvidia hw encoding (NVENC).
     
  47. Williano7

    Williano7

    Joined:
    Sep 23, 2019
    Posts:
    5
    Please can anyone walk me through the process of getting user inputs from the browser? I have followed the guide in the documentation but it didn’t work.

    I tried this from the URS docs but it didn’t.
    // Create a RemoteInput instance
    RemoteInput input = RemoteInputReceiver.Create();
    channel.OnMessage = bytes => input.ProcessInput(bytes);


    // Get the keyboard device, process on w key press
    Keyboard keyboard = input.RemoteKeyboard;
    if(keyboard.wKey.isPressed)
    {
    // ...
    }

    Can anyone give me a simple example of how to get user input from the browser to control a game object in my scene?
     
  48. Williano7

    Williano7

    Joined:
    Sep 23, 2019
    Posts:
    5
    I want to attach a new script to game object and control it with keyboard input from the browser. Please can you walk me through the process of doing that? I followed the documentation but is still not working.
     
  49. Williano7

    Williano7

    Joined:
    Sep 23, 2019
    Posts:
    5

    I want to attach a new script to game object and control it with keyboard input from the browser. Please can you walk me through the process of doing that? I followed the documentation but is still not working
     
  50. Williano7

    Williano7

    Joined:
    Sep 23, 2019
    Posts:
    5

    I want to attach a new script to game object and control it with keyboard input from the browser. Please can you walk me through the process of doing that? I followed the documentation but is still not working