ffmpeg+subprocess+python+srs: subprocess pusht Mikrofon, Audio, Mikrofon auf srs-Server [nur Audio pushen]

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)

Schieben Sie den Stream auf den srs-Videoserver und steuern Sie ihn über Python-Code.

Supongo que te gusta

Origin blog.csdn.net/weixin_46371752/article/details/127868312
Recomendado
Clasificación