Does mpv player support RTSP and HTTP streaming?
The mpv media player provides comprehensive, native support for modern network streaming protocols, including RTSP, HTTP, HTTPS, and RTMP. By leveraging its integrated FFmpeg libraries, mpv allows users to stream high-quality audio and video directly from remote servers, security cameras, and live broadcasting platforms without needing to download the media files beforehand. This article explores how mpv handles these protocols, the syntax required to initiate a stream, and key configuration tips for optimizing playback performance.
Core Protocol Support and Capabilities
As a highly versatile command-line media player, mpv treats network
URLs similarly to local files. Because it is built on top of
libavformat (part of the FFmpeg suite), it inherits a vast
array of network protocol implementations.
- HTTP/HTTPS: Used for streaming direct video links,
podcasts, and web-based media files. mpv handles adaptive streaming
formats running over HTTP perfectly, such as HLS (
.m3u8) and MPEG-DASH (.mpd). - RTSP (Real-Time Streaming Protocol): Extensively utilized for IP security cameras, CCTV feeds, and professional internal broadcast systems.
- RTMP/RTMPS: Frequently used for live streaming infrastructure and older flash-based legacy setups.
Additionally, mpv seamlessly integrates with yt-dlp (and
its predecessor youtube-dl). When you pass a standard
website URL (like a YouTube or Twitch link) to mpv, it automatically
uses this backend tool to scrape the underlying HTTP or HTTPS media
stream and play it directly.
How to Stream Network Protocols in mpv
Playing a network stream in mpv is straightforward and typically executed via the command line, though the same URLs can be dragged and dropped into the mpv graphical user interface.
Streaming via HTTP/HTTPS
To play a direct video file hosted on the web, simply pass the URL as an argument:
mpv https://example.com/movies/video.mp4For live HTTP streams like HLS, the command structure remains identical:
mpv https://live.example.com/stream/index.m3u8Streaming via RTSP
IP cameras and local network feeds utilizing RTSP can be accessed by specifying the protocol at the beginning of the address:
mpv rtsp://1192.168.1.50:554/stream1If your RTSP stream requires authentication, you can embed the credentials directly into the URL syntax:
mpv rtsp://username:password@192.168.1.50:554/stream1Performance Optimization and Buffering
Network streams are inherently prone to latency and network jitter. Fortunately, mpv offers several built-in options to tweak how it handles network caches and protocol behavior.
Adjusting the Cache
If you experience stuttering or frequent pausing on high-bitrate HTTP or RTSP streams, you can force mpv to use a larger buffer.
mpv --cache=yes --demuxer-max-bytes=150MiB https://example.com/video.mp4Low-Latency Mode for Live Feeds
For security cameras running over RTSP, real-time playback is often more important than perfect video smoothness. You can minimize playback lag by disabling the cache and forcing immediate frame rendering.
mpv --profile=low-latency --untimed rtsp://192.168.1.50:554/stream1Specifying RTSP Transport
By default, mpv will negotiate the best transport protocol for RTSP, but you can explicitly force TCP if you notice packet loss or broken frames over UDP connections.
mpv --rtsp-transport=tcp rtsp://192.168.1.50:554/stream1