You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

寻求基于FFmpeg的极简SRT流媒体收发实现方案

Minimal SRT Streaming with FFmpeg (UDP-like Simplicity)

Absolutely—you don’t need overcomplicated configurations to get SRT up and running with FFmpeg, just like your go-to UDP example! SRT does have a tiny bit more context than UDP (since it’s a connection-oriented protocol), but the basic commands are nearly identical in simplicity.

Prerequisite

First, confirm your FFmpeg build includes SRT support. Run this command and look for srt in the output:

ffmpeg -protocols

If it’s missing, you’ll need a version compiled with --enable-libsrt (most official prebuilt FFmpeg binaries include this by default now).

Sender Command (Caller Mode)

This sends your video stream directly to the receiver’s IP and port, mirroring your UDP workflow:

ffmpeg -i myfile.mp4 -vcodec libx264 -crf 12 -f mpegts srt://192.168.1.5:1234?mode=caller

Receiver Command (Listener Mode)

Start this first to listen for the incoming SRT stream:

ffplay srt://0.0.0.0:1234?mode=listener

Even Simpler Auto-Mode Alternative

If you don’t want to specify mode=caller/listener, FFmpeg can auto-negotiate the roles for you. Just start the receiver first:

ffplay srt://0.0.0.0:1234

Then run the sender command without the mode flag:

ffmpeg -i myfile.mp4 -vcodec libx264 -crf 12 -f mpegts srt://192.168.1.5:1234

FFmpeg will automatically set the receiver as the listener and the sender as the caller.

Quick Tips

  • Why the mode? SRT uses a client-server model, so one side listens for connections (listener) and the other initiates the connection (caller). Auto mode handles this automatically if you start the receiver first.
  • This setup uses SRT’s default low-latency, reliable settings—great for most simple streaming use cases.
  • To save the stream to a file instead of playing it, replace the ffplay command with:
    ffmpeg -i srt://0.0.0.0:1234?mode=listener -c copy output.mp4
    

That’s all there is to it—no config files, no extra hoops, just straightforward commands like your UDP example!

内容的提问来源于stack exchange,提问作者user1767754

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.08 15:17:37