Skip to content

Instantly share code, notes, and snippets.

@17183248569
Created January 12, 2021 13:01
Show Gist options
  • Save 17183248569/49b3a05c6ff2e965e0d83ab2ccd0d3c9 to your computer and use it in GitHub Desktop.
Save 17183248569/49b3a05c6ff2e965e0d83ab2ccd0d3c9 to your computer and use it in GitHub Desktop.
import subprocess
import numpy
x=subprocess.Popen(["ffmpeg","-re","-f","rawvideo","-s","250x250","-pix_fmt","rgb24","-i","-",
"-vcodec", "libx264",
"-acodec", "aac", "-b:a", "192k",
"-f", "flv",
"rtmp://live-push.bilivideo.com/live-bvc/?streamname=************"],stdin=subprocess.PIPE,stderr=subprocess.PIPE)
data=numpy.ndarray([250,250,3],"u1")
data[:][:]=[255,0,0]
data[100:150,0:200]=[0,56,0]
while 1:
x.stdin.write(data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment