Protocol 59 of 81Layer 7FrameAssembly v3.1.2
llms-full.txt
rtspReal Time Streaming Protocol IP Camera & Media Control

IP Security Camera & NVR Stream Control (nvr <-> cam rtsp TCP 554)

Default Port / Protocol
TCP 554
Host Endpoint Rule
Dual-Stack IPv4/IPv6
Wireshark Display Filter
rtsp
Standards & Specs
RFC 2326, RFC 7826
Wire Stack:Ethernet II[802.1Q / QinQ / MPLS]IPv4 / IPv6TCP 554RTSP

What It Does on the Wire

Controlling CCTV cameras and media relays on TCP 554 — remember to spell the RTSP Transport: header transporthdr so it never collides with FrameAssembly’s Layer 4 transport keyword!

Real Time Streaming Protocol (rtsp, RFC 2326 / RFC 7826) controls IP security cameras, NVRs, and live video servers over TCP port 554. An NVR typically sends OPTIONS, DESCRIBE, SETUP (negotiating client RTP/RTCP UDP ports inside the Transport: header), PLAY, and TEARDOWN.

FrameAssembly formats RTSP/1.0 requests and status responses (RTSP/1.0 200 OK) with CSeq, Transport (transporthdr), and Session headers while tracking TCP sequence numbers automatically.

Physical Security VLAN & NVR Firewall Policy Testing

Verify that camera VLAN firewalls allow TCP 554 (rtsp) from the VMS/NVR to ONVIF cameras and permit return UDP rtp video streams.

IoT / IP Camera Unauthorized Stream Access IDS Rules

Simulate external or cross-VLAN rtsp describe uri "rtsp://cam01.local/live" probes to test IoT segmentation alerts.

Firewall RTSP ALG Dynamic Port Pinholing Checks

Test whether perimeter firewalls parse transporthdr "RTP/AVP;unicast;client_port=5004-5005" during rtsp setup.

Minimal Quickstart (rtsp_quickstart.frasm)

Hit Preview Packets to compile in-browser and eyeball timestamps + wire byte lengths, or ship it straight to the Playground.

rtsp_quickstart.frasm8 lines
Open in Playground
host nvr_srv { ip 10.50.10.10 }
host ip_cam { ip 10.50.20.45 }
compile {
nvr_srv -> ip_cam rtsp options uri "rtsp://10.50.20.45:554/stream1" cseq 1 wait 2ms
nvr_srv <- ip_cam rtsp status 200 cseq 1 wait 2ms
nvr_srv -> ip_cam rtsp setup uri "rtsp://10.50.20.45:554/stream1/track1" cseq 2 transporthdr "RTP/AVP;unicast;client_port=5004-5005"
}

What the Compiler Calculates So You Don't Have To

  • Defaults to TCP destination port 554 (psh ack) and writes -terminated RTSP/1.0 lines with CSeq.
  • Switches from an RTSP client request to an RTSP/1.0 <status> OK server reply whenever status is set.
  • Writes Transport: (transporthdr) and Session: (session) headers cleanly for Wireshark RTSP/RTP conversation tracking.
Multi-Frame Lab · Ready to Compile

Full IP Camera RTSP Setup, PLAY, RTP Video Frame & TEARDOWN

Walks through TCP 554 connection setup, DESCRIBE, SETUP (client_port=5004-5005), PLAY, an H.264 rtp pt 96 packet from the camera, and TEARDOWN.

rtsp_camera_session.frasm17 lines
Open in Playground
host vms_nvr { ip 192.168.60.10 }
host gate_cam { ip 192.168.60.105 }
compile {
vms_nvr -> gate_cam tcp syn srcport 51554 dstport 554 win 65535 mss 1460 wait 1ms
vms_nvr <- gate_cam tcp syn ack win 65535 mss 1460 wait 1ms
vms_nvr -> gate_cam tcp ack wait 1ms
vms_nvr -> gate_cam rtsp describe uri "rtsp://192.168.60.105/h264" cseq 1 wait 2ms
vms_nvr <- gate_cam rtsp status 200 cseq 1 wait 2ms
vms_nvr -> gate_cam rtsp setup uri "rtsp://192.168.60.105/h264/trackID=1" cseq 2 transporthdr "RTP/AVP;unicast;client_port=5004-5005" wait 2ms
vms_nvr <- gate_cam rtsp status 200 cseq 2 transporthdr "RTP/AVP;unicast;client_port=5004-5005;server_port=8000-8001" session "98112233" wait 2ms
vms_nvr -> gate_cam rtsp play uri "rtsp://192.168.60.105/h264" cseq 3 session "98112233" wait 2ms
vms_nvr <- gate_cam rtsp status 200 cseq 3 session "98112233" wait 5ms
// Camera sends H.264 RTP packet (pt 96) to client port 5004
gate_cam -> vms_nvr rtp srcport 8000 dstport 5004 pt 96 seq 1 timestamp 90000 ssrc 0xcafebabe marker 1 payload "h264-nal-idr" wait 10ms
vms_nvr -> gate_cam rtsp teardown uri "rtsp://192.168.60.105/h264" cseq 4 session "98112233"
}
Terminal Commands (FrameAssembly CLI v3.1.2)
# 1. Eyeball relative timestamps, ports & wire lengths in your terminal
frameassembly show rtsp_camera_session.frasm

# 2. Compile .frasm -> classic .pcap (tcpdump/tcpreplay/Suricata) or nanosecond .pcapng
frameassembly rtsp_camera_session.frasm rtsp_camera_session.pcap
frameassembly rtsp_camera_session.frasm rtsp_camera_session.pcapng

# 3. Round-trip .pcap <-> .frasm whenever you want to scrub or tweak an existing capture
frameassembly reverse rtsp_camera_session.pcap rtsp_camera_session_edited.frasm

All rtsp Keywords & Header Options

Every sub-keyword and header option is lowercase [a-z0-9]+ with zero underscores — mix and match them in any order after rtsp:

src_host -> dst_host rtsp [options | describe | setup | play | teardown | method "<text>"] [uri "<text>"] [status <100..599>] [cseq <number>] [transporthdr "<text>"] [session "<text>"]
Keyword / OptionAccepted ValueDefaultEffect on Packet
options | describe | setup | play | teardown | method "<text>"RTSP request verboptionsSets the RTSP command method on the request line.
uri "<text>"Quoted rtsp://... stream URL"rtsp://camera.local/stream"Sets the target stream URL in the RTSP request line.
status <100..599>RTSP response status code (200, 401, 404, 454)Omitted on requestsSwitches the packet to an RTSP/1.0 <status> OK response.
cseq <number>Command sequence counter1Writes the mandatory CSeq: header matching requests to responses.
transporthdr "<text>"Quoted RTSP Transport: header stringOmitted unless setWrites the Transport: header (named transporthdr so it never collides with Layer 4 transport tcp|udp).
session "<text>"Quoted RTSP Session IDOmitted unless setWrites the Session: header linking SETUP, PLAY, and TEARDOWN.

Cross-Layer Wrappers Valid with rtsp

802.1Q VLAN / QinQ / MPLS tags, IPv4/IPv6 QoS & TTL fields, wait gaps, and transport overrides allowed on this protocol

11 options
OptionRange / FormatDefaultEffect on Packet
wait <number><ns|us|ms|s|m>Time gap (ns, us, ms, s, m)10msAdvances the packet timestamp clock after sending this packet and before the next packet (wait 0ns sends back-to-back).
payload "<text>" | hexpayload "<hex>"Quoted text or hex bytes (choose one)OmittedAppends or overrides raw payload bytes ("deadbeef" or "de:ad:be:ef") and updates packet lengths and checksums.
srcmac <mac> | dstmac <mac>Colon, hyphen, or Cisco dot MACHost MAC / RFC multicast MACOverrides the 14-byte Ethernet II source or destination MAC address for this single packet.
vlan <0..4095> [pcp <0..7>] [dei <0|1>]VLAN ID 0..4095, PCP 0..7, DEI 0..1UntaggedWraps the packet in an IEEE 802.1Q VLAN tag (0x8100) with optional 802.1p QoS priority.
qinq <0..4095> [innervlan <0..4095>]Outer S-VLAN 0..4095, Inner C-VLAN 0..4095Untagged (innervlan 1 when qinq is set)Double-tags the packet with outer IEEE 802.1ad S-Tag (0x88a8) plus inner IEEE 802.1Q C-Tag (0x8100).
mpls <0..1048575> [exp|tc <0..7>] [bos <0|1>] [mplsttl <0..255>]Label 0..1048575, exp/tc 0..7, bos 0..1, ttl 0..255Unlabeled (at most 1 mpls tag per packet)Inserts a 32-bit MPLS label header (0x8847) ahead of the Layer 3 header.
ttl <0..255> [dscp <0..63>] [ecn <0..3>]TTL/Hop Limit 0..255, DSCP 0..63, ECN 0..3ttl 64, dscp 0, ecn 0Sets IPv4 TTL or IPv6 Hop Limit plus DiffServ (DSCP) and ECN QoS markings.
ipid <0..65535> [df] [mf] [fragoffset <0..8191>]IPv4 ID, DF/MF flags, fragment offset 0..8191ipid 1, flags 0, fragoffset 0Sets IPv4 Identification, Do-Not-Fragment (df), More-Fragments (mf), and fragment offset (ignored over IPv6).
flowlabel <0..1048575>20-bit IPv6 Flow Label (0..1048575)0Sets the 20-bit IPv6 Flow Label for ECMP routing tests (ignored when running over IPv4 hosts).
srcport <0..65535> | dstport <0..65535>Port number 0..65535srcport 49152 (remembered), TCP 554Overrides source or destination port and remembers the port pair automatically on <- replies.
seq <number> | acknum <number> | win <0..65535> | syn | ack | psh | fin | rstTCP sequence/ack numbers, window size, flags & RFC 7323 optionspsh ack, win 65535, automatic TCP seq/acknumOverrides automatic TCP sequence tracking, flags, or RFC 7323 options (mss, wscale, sackperm, tsval, tsecr).

Gotchas & Quick Fixes

Always Use transporthdr (Never transport) for the RTSP Transport Header

Avoid
nvr_srv -> ip_cam rtsp setup transport "RTP/AVP;unicast;client_port=5004-5005"
Valid v3.1.2 Syntax
nvr_srv -> ip_cam rtsp setup transporthdr "RTP/AVP;unicast;client_port=5004-5005"

In FrameAssembly, transport is reserved for switching Layer 4 TCP/UDP on dual-transport protocols. RTSP runs over TCP 554 and uses transporthdr for the Transport: header.

Field Guide 03
Poke Stateful Firewalls, Suricata, Zeek & OT Conduits