python ffmpeg 桌面、摄像头推流

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 640×480 -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()

© 版权声明
THE END
如果内容对您有所帮助,就支持一下吧!
点赞0 分享
一个温良的虎妞的头像 - 鹿快
评论 抢沙发

请登录后发表评论

    暂无评论内容