forked from SelimEmre/webrtc-ant-media
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathhls_video_processing.py
More file actions
31 lines (24 loc) · 921 Bytes
/
hls_video_processing.py
File metadata and controls
31 lines (24 loc) · 921 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# ffmpeg -re -f lavfi -i "testsrc=size=2560x1440:rate=30" \
# -c:v libx264 \
# -preset veryfast \
# -tune zerolatency \
# -b:v 18M \
# -maxrate 20M \
# -bufsize 36M \
# -pix_fmt yuv420p \
# -g 60 \
# -f flv rtmp://localhost/LiveApp/test
from hls import start_hls_pipeline
from PIL import Image
import numpy as np
i=0
def on_video_frame(numpy_frame):
global i
img = Image.fromarray(numpy_frame)
img.save("./out/"+streamId+str(i)+".jpeg")
print(numpy_frame.shape)
i+=1
img.close()
streamId = "test"
HLS_URL = "http://localhost:5080/LiveApp/streams/"+ streamId +".m3u8"
start_hls_pipeline(HLS_URL,on_video_frame)