Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

51 lines
1.8KB

  1. import subprocess as sp
  2. from PIL import Image
  3. import time
  4. import cv2
  5. import oss2
  6. import numpy as np
  7. # 推流
  8. if __name__== "__main__":
  9. cap = cv2.VideoCapture(r"https://vod.play.t-aaron.com/customerTrans/14d44756fa6d37db17008d98bdee3558/18ac4fa7-18369b0e703-0004-f90c-f2c-7ec68.mp4")
  10. # Get video information
  11. fps = int(cap.get(cv2.CAP_PROP_FPS))
  12. print(fps)
  13. width = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH))
  14. print(width)
  15. height = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT))
  16. print(height)
  17. # ffmpeg command
  18. # command = ['D:/百度下载/ffmpeg-20200831-4a11a6f-win64-static/bin/ffmpeg.exe',
  19. # '-y', # 不经过确认,输出时直接覆盖同名文件。
  20. # '-f', 'rawvideo',
  21. # '-vcodec','rawvideo',
  22. # '-pix_fmt', 'bgr24',
  23. # '-s', "{}x{}".format(width, height),
  24. # # '-s', "{}x{}".format(1280, 720),
  25. # '-i', '-', # 指定输入文件
  26. # '-c:v', 'libx264', # 指定视频编码器
  27. # '-pix_fmt', 'yuv420p',
  28. # '-r', '15',
  29. # '-g', '15',
  30. # "-an",
  31. # '-b:v', '3000k',
  32. # '-preset', 'ultrafast', # 指定输出的视频质量,会影响文件的生成速度,有以下几个可用的值 ultrafast,
  33. # # superfast, veryfast, faster, fast, medium, slow, slower, veryslow。
  34. # '-f', 'flv',
  35. # "rtmp://live.push.t-aaron.com/live/THSAk"]
  36. # # 管道配置
  37. # p = sp.Popen(command, stdin=sp.PIPE, shell=False)
  38. while(cap.isOpened()):
  39. start =time.time()
  40. # ret, frame = cap.read()
  41. cap.grab()
  42. print(time.time()-start)
  43. # if not ret:
  44. # print("Opening camera is failed")
  45. # break
  46. # p.stdin.write(frame.tostring())