linux - 具有双以太网接口(interface)的 ffmpeg 工作错误

标签 linux ffmpeg multicast

具有双接口(interface)的服务器。

  1. One(eht0) 用于 WAN,为互联网用户提供 http/ssh 服务。

  2. 另一个(eth1)用于接收内网的组播数据。

218.108.132.177 is public network gateway.

125.210.198.1 is private network gateway.

233.49.3.*/24 is multicast address.

10.0.11.*/24 is the source of multicast data.

当路由表如下,ffmpeg无法从eth1读取udp数据,ffmpeg挂了:

rrca@rcasnap02:~$ route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
218.108.132.176 *               255.255.255.252 U     0      0        0 eth0
125.210.198.0   *               255.255.255.240 U     0      0        0 eth1
default         218.108.132.177 0.0.0.0         UG    100    0        0 eth0
default         125.210.198.1   0.0.0.0         UG    100    0        0 eth1

rrca@rcasnap02:~$ route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
218.108.132.176 *               255.255.255.252 U     0      0        0 eth0
125.210.198.0   *               255.255.255.240 U     0      0        0 eth1
default         218.108.132.177 0.0.0.0         UG    100    0        0 eth0
10.0.11.0       125.210.198.1   0.0.0.0         UG    100    0        0 eth1

rrca@rcasnap02:~$ route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
218.108.132.176 *               255.255.255.252 U     0      0        0 eth0
125.210.198.0   *               255.255.255.240 U     0      0        0 eth1
default         218.108.132.177 0.0.0.0         UG    100    0        0 eth0
233.49.3.0      125.210.198.1   255.255.255.0   UG    100    0        0 eth1

我想让ffmpeg正常工作,但现在我认为路由表中的两个默认路由互相干扰,我试了一下,当删除公共(public)网关路由时,或者私有(private)网关路由在公共(public)路由的头部默认网关路由,ffmpeg 运行良好,我认为它从 eth1 读取多播。但是路由表不是这样,ffmpeg 无法从 eth1 读取数据,我认为它读取 eth0(不是私有(private)网络接口(interface))上的数据。

ffmpeg如何同时兼容两个接口(interface)?

最佳答案

您需要为多播流量配置正确的路由。内核对所有传入的多播流量进行来源检查:如果它到达的接口(interface)与用于发送此类流量的接口(interface)不同,则会被丢弃。

只需在您的 eth1 接口(interface)上设置多播路由:

# route add -net 224.0.0.0/8 dev eth1

或者,禁用来源检查:

# echo 0 > /proc/sys/net/ipv4/conf/eth1/rp_filter

关于linux - 具有双以太网接口(interface)的 ffmpeg 工作错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10698533/

相关文章:

Python 3 IPv6 组播

sockets - 但是,UDP套接字接收器缓冲区的大小是否会影响延迟?

windows - 无法从 Windows ping 到多播地址

c++ - Redhat Linux - 找不到 SO 文件

c# - 使用 FFMpeg 显示视频转换的进度

java - ClassNotFoundException : in gnu. gcj.runtime.SystemClassLoader

iphone - 使用 ffmpeg 在 iPhone 上显示视频

ffmpeg - 为 ubuntu 构建 ffmpeg 未找到可用的 C 编译器

linux - Unix 邮件实用程序 - 'You must specify direct recipients with -s, -c, or -b'

控制台输出未对齐