Running time 2 min

Capture Card to MediaMTX for WebRTC and RTSP

Turn a USB HDMI capture card into a MediaMTX stream on Windows. Find the card in FFmpeg and play the same video and audio over WebRTC and RTSP.

Illustrated title card for the guide: Capture Card to MediaMTX for WebRTC and RTSP

With a DirectShow-compatible USB HDMI capture card already connected to your Windows PC, use FFmpeg to publish its video and audio to MediaMTX over RTSP. Open the same stream in a browser with WebRTC or in an RTSP player. FFmpeg capture devices · MediaMTX publishing and playback

Find the capture card’s DirectShow inputs

Start with the card already connected and its video and audio inputs available through DirectShow. FFmpeg DirectShow devices

On Windows 10 or later, download and extract Gyan’s ffmpeg-release-essentials.zip. It includes ffmpeg and ffplay, with the libx264 and libopus libraries used below. Run the commands from a command-line session where the extracted ffmpeg is available by name. Start by listing the DirectShow inputs. FFmpeg downloads · Windows build contents · DirectShow commands

ffmpeg -list_devices true -f dshow -i dummy

Copy the video and audio device names for the feed you want. To list the supported options for the video input, replace VIDEO DEVICE with its name and run the following command. DirectShow device options

ffmpeg -list_options true -f dshow -i video="VIDEO DEVICE"

Start MediaMTX with local access

Download and extract the standalone MediaMTX archive for Windows x64. Before starting it, replace the entire authInternalUsers block in the bundled mediamtx.yml with the block below. It allows publishing and reading on mystream from the same PC. MediaMTX installation · Configuration edits · Access rules

authInternalUsers:
  - user: any
    ips: ["127.0.0.1", "::1"]
    permissions:
      - action: publish
        path: mystream
      - action: read
        path: mystream

Save the file and double-click mediamtx.exe. MediaMTX installation · Bundled configuration

Publish the capture feed

Substitute the DirectShow names for VIDEO DEVICE and AUDIO DEVICE. The command encodes H.264 video and stereo Opus audio. Browsers do not support H.264 B-frames over WebRTC. DirectShow input syntax · RTSP transport · MediaMTX publisher examples · Browser codec support

ffmpeg -f dshow -i video="VIDEO DEVICE":audio="AUDIO DEVICE" -c:v libx264 -pix_fmt yuv420p -preset ultrafast -c:a libopus -ar 48000 -ac 2 -f rtsp -rtsp_transport tcp rtsp://localhost:8554/mystream

Play the same feed over both protocols

Keep FFmpeg running and check for live picture and sound in both players. Each player reads mystream from MediaMTX. Browser playback · RTSP playback · FFmpeg RTSP playback options

PlaybackOpen on the capture PC
WebRTCVisit http://localhost:8889/mystream in your browser.
RTSPUse a command-line session where the extracted ffplay is available by name. Run ffplay -rtsp_transport tcp rtsp://localhost:8554/mystream.

Watch from a second device on your LAN

For example, if the MediaMTX PC is at 192.168.1.40 and the viewer is at 192.168.1.50, append the entry below to the existing authInternalUsers list. Replace the example viewer IP with the actual viewer IP. MediaMTX access rules

  - user: any
    ips: ["192.168.1.50"]
    permissions:
      - action: read
        path: mystream

Set webrtcAdditionalHosts: ["192.168.1.40"] in mediamtx.yml, substituting the server’s LAN IP. Save the file. Use that IP in place of localhost in both playback addresses. MediaMTX configuration · WebRTC connectivity · Browser playback · RTSP address syntax

With the default listeners, allow the viewer to reach TCP port 8554 for RTSP over TCP and TCP port 8889 plus UDP port 8189 for WebRTC if the host firewall blocks playback. If WebRTC cannot establish the media connection, check the advertised server IP and whether the firewall blocks UDP 8189. Keep this setup on a trusted LAN. MediaMTX listener settings · WebRTC connectivity

Evidence and limits. These steps were adapted from the MediaMTX v1.21.4 and FFmpeg documentation checked on November 26, 2026. The setup was not run for this guide. MediaMTX version reference

Sources

Everything this guide was cut from, in the order it is cited.

  1. MediaMTX protocol overview
  2. MediaMTX standalone installation
  3. MediaMTX configuration
  4. MediaMTX v1.21.4 configuration reference
  5. FFmpeg downloads
  6. Gyan FFmpeg Windows builds
  7. FFmpeg device documentation
  8. FFmpeg RTSP options
  9. MediaMTX FFmpeg publishing guide
  10. MediaMTX WebRTC features
  11. MediaMTX browser playback
  12. MediaMTX RTSP playback

Next on the reel