trex-ffmpeg使用文档

编译

使用私有代码库

./b configure --with-ffmpeg
./b build --with-ffmpeg

操作

  • trex_cfg.yml配置
- version: 2
  interfaces: ['02:02.0', '02:03.0']
  low_end: true
  stack: linux_based
  port_info:
      - ip: 10.10.10.2
        default_gw: 10.10.10.1
      - ip: 20.20.20.2
        default_gw: 20.20.20.1

  platform:
      master_thread_id: 0
      latency_thread_id: 1
      dual_if:
        - socket: 0
          threads: [2,3]
  • 启动trex并进入service模式
sudo ./trex-console 

Using 'python3' as Python interpeter


Connecting to RPC server on localhost:4501                   [SUCCESS]


Connecting to publisher server on localhost:4500             [SUCCESS]


Acquiring ports [0, 1]:                                      [SUCCESS]


Server Info:

Server version:   v2.96 @ STL
Server mode:      Stateless
Server CPU:       1 x 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz
Ports count:      2 x 1Gbps @ 82545EM Gigabit Ethernet Controller (Copper)

-=TRex Console v3.0=-

Type 'help' or '?' for supported actions

trex>service

Enabling service mode on port(s): [0, 1]                     [SUCCESS]

5.26 [ms]

trex(service)>plugins load ffmpeg

Loading plugin: ffmpeg                                       [SUCCESS]

trex(service)>plugins ffmpeg -h
usage: plugins ffmpeg [-h] {add_ffmpeg_ns,add_node,show_nodes,start_ffmpeg,stop_ffmpeg} ...

optional arguments:
  -h, --help            show this help message and exit

commands:
  {add_ffmpeg_ns,add_node,show_nodes,start_ffmpeg,stop_ffmpeg}
    add_ffmpeg_ns       Add shared namespace for ffmpeg
    add_node            Simple adding ffmpeg node with arguments.
    show_nodes          Show all ffmpeg nodes on port
    start_ffmpeg        Start iptv service
    stop_ffmpeg         Stop iptv service

trex(service)>
  • 添加node节点
trex(service)>portattr 
Port Status

     port       |          0           |          1           
----------------+----------------------+---------------------
driver          |     net_e1000_em     |     net_e1000_em     
description     |  82545EM Gigabit Et  |  82545EM Gigabit Et  
link status     |          UP          |          UP          
link speed      |        1 Gb/s        |        1 Gb/s        
port status     |         IDLE         |         IDLE         
promiscuous     |         off          |         off          
multicast       |          on          |          on          
flow ctrl       |         none         |         none         
vxlan fs        |          -           |          -           
--              |                      |                      
layer mode      |         IPv4         |         IPv4         
src IPv4        |      10.10.10.2      |      20.20.20.2      
IPv6            |         off          |         off          
src MAC         |  00:0c:29:69:39:6c   |  00:0c:29:69:39:76   
---             |                      |                      
Destination     |      10.10.10.1      |      20.20.20.1      
ARP Resolution  |  00:50:56:c0:00:01   |  00:50:56:c0:00:02   
----            |                      |                      
VLAN            |          -           |          -           
-----           |                      |                      
PCI Address     |     0000:02:02.0     |     0000:02:03.0     
NUMA Node       |          0           |          0           
RX Filter Mode  |      fetch all       |      fetch all       
RX Queueing     |         off          |         off          
Grat ARP        |         off          |         off          
------          |                      |                      

trex(service)>plugins ffmpeg add_node -h
usage: ffmpeg add_node [-h] -p PORT -m MAC [-ns FFMPEG_NS] [--ipv4 IPV4] [--ipv4-subnet IPV4_SUBNET] [--dgv4 DGV4] [--ipv6-enable] [--ipv6 IPV6] [--ipv6-subnet IPV6_SUBNET] [--vlans [VLANS [VLANS ...]]] [--tpids [TPIDS [TPIDS ...]]] [--mtu MTU]

Simple adding ffmpeg node with arguments.

optional arguments:
  -h, --help            show this help message and exit
  -p PORT, --port PORT  port to use
  -m MAC, --mac MAC     mac address to use
  -ns FFMPEG_NS, --namespace FFMPEG_NS
                        shared namespace for ffmpeg
  --ipv4 IPV4           src ip to use
  --ipv4-subnet IPV4_SUBNET
                        ipv4 subnet to use
  --dgv4 DGV4           default gateway for ipv4
  --ipv6-enable         ipv6 enable, default False
  --ipv6 IPV6           ipv6 enable, default False
  --ipv6-subnet IPV6_SUBNET
                        ipv6 subnet ip to use
  --vlans [VLANS [VLANS ...]]
                        vlans for ffmpeg node
  --tpids [TPIDS [TPIDS ...]]
                        tpids for ffmpeg node
  --mtu MTU             mtu of the ffmpeg node

trex(service)>plugins ffmpeg add_node -p 0 -m 00:0c:29:69:39:60 --ipv4 10.10.10.8 --ipv4-subnet 24 --dgv4 10.10.10.1 --mtu 1500

Applying attributes on port(s) [0, 1]:                       [SUCCESS]


Setting port 0 in with namespace configuration               [SUCCESS]


wait_for_async_results                                       [SUCCESS]

trex-shared-ns-0-0

Setting port 0 in with namespace configuration               [SUCCESS]


wait_for_async_results                                       [SUCCESS]


Applying attributes on port(s) [0, 1]:                       [SUCCESS]


Setting port 0 in with namespace configuration               [SUCCESS]


wait_for_async_results                                       [SUCCESS]

trex(service)>
  • 启动ffmpeg iptv服务
trex(service)>plugins ffmpeg start_ffmpeg -p 0 -ns trex-shared-ns-0-0

Applying attributes on port(s) [0, 1]:                       [SUCCESS]


Setting port 0 in with namespace configuration               [SUCCESS]


wait_for_async_results                                       [SUCCESS]

trex(service)>
  • vlc单播验证

打开vlc客户端,输入:

rtsp://10.10.10.18:8554/mystream

  • vlc组播验证

打开vlc客户端,输入:

rtsp://10.10.10.8:8554/mystream?vlcmulticast

  • 停止ffmpeg iptv服务
trex(service)>plugins ffmpeg stop_ffmpeg -p 0 -ns trex-shared-ns-0-0
posted @ 2022-03-31 15:19  staylight  阅读(157)  评论(0编辑  收藏  举报