import ffmpeg
import cv2
import numpyas np
out_filename ="C://Users//new//Videos//202204061434-out2.mp4"
width =640
height =480
video_format ="h264"
server_url ="udp://127.0.0.1:1234"
#摄像头推流到udp
#ffmpeg.input("video=xxx",format="dshow").output(filename=server_url,format=video_format,listen=1).run_async()
#命令行测试桌面推流
#ffmpeg.exe -f gdigrab -video_size 640x480 -i desktop -tune zerolatency -vcodec h264 -preset ultrafast -g 13 -max_delay 100 -r 20 -acodec aac -pkt_size 1316 -probesize 32 -flags low_delay -f h264 udp://localhost:12345
#文件推流
#ffmpeg.input("C://Users//new//Videos//1.mp4").output(filename=server_url,format=video_format,listen=1).run_async()