No internet connection
  1. Home
  2. Technical Support

H264 working in LAN but failover to mjpeg in remote access via IP

By Sajid @sajidwebdev
    2023-07-26 17:54:32.029Zassigned to
    • @cghague

    I am getting following error while trying to use H264 format for video in Setting when accessing Tinypilot machine remotely(via IP). but H264 works fine when tinypilot machine accessed in LAN.


    Any suggestion?

    • 4 replies
    1. C

      Hi Sajid, thanks for reaching out! I’m sorry to hear you’re having issues with H.264.

      TinyPilot uses the WebRTC protocol to stream H.264 video, which has different network requirements when compared to MJPEG. Could you please let me know a bit more about how you are connecting? For example, are you using port forwarding or a service such as Tailscale?

      1. SSajid @sajidwebdev
          2023-07-26 19:50:57.828Z

          443 port forwarded on router to access Tinypilot machine via direct IP address. not using Tailscale

          1. Thank you for confirming! WebRTC requires that both your browser and the TinyPilot device can receive connections from each other. Unfortunately, this means that, while MJPEG video will work with basic port forwarding, WebRTC and H.254 won’t.

            I completely understand that H.264 is preferable to MJPEG, and so I’m pleased to be able to report that we’re working on adding support for the STUN protocol. The STUN protocol allows your browser and TinyPilot device to communicate without you needing to to open any extra ports.

            I don’t have a timeframe for when this will be available, but it’s something we’re actively working on. I’d recommend watching our changelog and our blog as the update will be announced there.

            1. CCharles Hague @cghague2023-08-10 23:09:40.716Z2023-08-11 18:39:24.389Z

              We’re still working on implementing STUN support, but if you’d prefer not to wait, enabling this functionality from the command line is now possible.

              You can enable STUN support by connecting over SSH and running the following commands:

              # Use Google's public STUN server.
              # Change this to a different address if you'd prefer not to use Google's STUN server.
              sudo sed --in-place --expression='/nat:/,/}/d' /etc/janus/janus.jcfg && \
                { sudo tee --append /etc/janus/janus.jcfg << EOF
              nat: {
                stun_server = "${STUN_SERVER}"
                stun_port = ${STUN_PORT}
                } && sudo systemctl restart janus ustreamer tinypilot

              If you’d like to revert this change, you can do so with the following commands:

              sudo sed --in-place --expression='/nat:/,/}/d' /etc/janus/janus.jcfg && \
                sudo systemctl restart janus ustreamer tinypilot