Skip to content

Commit ffedbf3

Browse files
author
Natalie Silvanovich
committed
Adding RTPReplay
1 parent b0e9e89 commit ffedbf3

2 files changed

Lines changed: 46 additions & 0 deletions

File tree

RTPReplay/README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# RTP Replay
2+
3+
Have you ever wanted to replay rtpdump files in a browser? Use this script!
4+
5+
1) Create an rtpdump file (see https://wiki.wireshark.org/rtpdump and https://webrtchacks.com/video_replay/)
6+
7+
2) Run rtp-to-webrtc as directed: https://github.com/webrtc-rs/webrtc/tree/master/examples/examples/rtp-to-webrtc
8+
9+
3) Run:
10+
11+
python3 replayer.py <yourfile.rtpdump>
12+
13+
## Disclaimer
14+
15+
This is not an official Google product.

RTPReplay/replayer.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import sys
2+
import socket, time
3+
4+
UDP_IP = "127.0.0.1"
5+
UDP_PORT = 5004
6+
7+
sock = socket.socket(socket.AF_INET,
8+
socket.SOCK_DGRAM)
9+
10+
f = open(sys.argv[1], 'rb')
11+
12+
dump = f.read()
13+
14+
15+
16+
ind = dump.find(b"\n")
17+
header = dump[0:ind]
18+
19+
print(header)
20+
21+
ind = ind + 4*4 + 1
22+
23+
while ind < len(dump):
24+
ind +=2
25+
plen = (dump[ind] << 8) + dump[ind+1]
26+
ind += 6
27+
packet = dump[ind:ind+plen]
28+
print(packet)
29+
sock.sendto(packet, (UDP_IP, UDP_PORT))
30+
ind = ind + plen
31+
time.sleep(.1)

0 commit comments

Comments
 (0)