code:
import subprocess
import os
import multiprocessing as mp
import threading
import cv2
def push(comman):
print('push: ',os.getpid())
child = subprocess.Popen(
comman,
shell=False, stdin=subprocess.PIPE, encoding="utf-8")
child.wait()
if __name__ == '__main__':
print('main: ',os.getpid())
rtmp = 'rtmp://122.95.32.117/only/audio'
comman =[
'ffmpeg', '-y' ,
'-f', 'dshow' ,
'-i' ,'''audio=Microphone (High Definition Audio Device)''',
'-sample_rate', '44100',
'-sample_size', '16',
'-channels', '1',
'-acodec', 'aac',
'-fflags', 'nobuffer',
'-r', '29.97',
'-f', 'flv',
str(rtmp)
]
push(comman)
Push the stream to the srs video server and control it through python code.