Skip to content

Commit

Permalink
Adding RTPReplay
Browse files Browse the repository at this point in the history
  • Loading branch information
Natalie Silvanovich committed Sep 5, 2023
1 parent b0e9e89 commit ffedbf3
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
15 changes: 15 additions & 0 deletions RTPReplay/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# RTP Replay

Have you ever wanted to replay rtpdump files in a browser? Use this script!

1) Create an rtpdump file (see https://wiki.wireshark.org/rtpdump and https://webrtchacks.com/video_replay/)

2) Run rtp-to-webrtc as directed: https://github.com/webrtc-rs/webrtc/tree/master/examples/examples/rtp-to-webrtc

3) Run:

python3 replayer.py <yourfile.rtpdump>

## Disclaimer

This is not an official Google product.
31 changes: 31 additions & 0 deletions RTPReplay/replayer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import sys
import socket, time

UDP_IP = "127.0.0.1"
UDP_PORT = 5004

sock = socket.socket(socket.AF_INET,
socket.SOCK_DGRAM)

f = open(sys.argv[1], 'rb')

dump = f.read()



ind = dump.find(b"\n")
header = dump[0:ind]

print(header)

ind = ind + 4*4 + 1

while ind < len(dump):
ind +=2
plen = (dump[ind] << 8) + dump[ind+1]
ind += 6
packet = dump[ind:ind+plen]
print(packet)
sock.sendto(packet, (UDP_IP, UDP_PORT))
ind = ind + plen
time.sleep(.1)

0 comments on commit ffedbf3

Please sign in to comment.