demo.py 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. # -*- coding: utf-8 -*-
  2. # @Author: wangkun
  3. # @Time: 2022/11/29
  4. import ffmpeg
  5. import os
  6. import sys
  7. sys.path.append(os.getcwd())
  8. from main.feishu_lib import Feishu
  9. class Demo:
  10. @classmethod
  11. def get_sheet(cls, log_type, crawler, sheetid):
  12. sheet = Feishu.get_values_batch(log_type, crawler, sheetid)
  13. print(sheet)
  14. @classmethod
  15. def ffmpeg_test(cls):
  16. probe = ffmpeg.probe('/root/piaoquan_crawler/crawler_zongjiao/videos/ ▶此视频非常难得,发出去,很多人都还不知道!/video.mp4')
  17. video_stream = next((stream for stream in probe['streams'] if stream['codec_type'] == 'video'), None)
  18. if video_stream is None:
  19. print('No video stream found!')
  20. return
  21. width = int(video_stream['width'])
  22. height = int(video_stream['height'])
  23. duration = float(video_stream['duration'])
  24. print(f'width:{width}')
  25. print(f'height:{height}')
  26. print(f'duration:{duration}')
  27. @classmethod
  28. def ffmpeg_test1(cls):
  29. probe = ffmpeg.probe('./crawler_zongjiao/videos/ ▶此视频非常难得,发出去,很多人都还不知道!/video.mp4')
  30. video_stream = next((stream for stream in probe['streams'] if stream['codec_type'] == 'video'), None)
  31. if video_stream is None:
  32. print('No video stream found!')
  33. return
  34. width = int(video_stream['width'])
  35. height = int(video_stream['height'])
  36. duration = float(video_stream['duration'])
  37. print(f'width:{width}')
  38. print(f'height:{height}')
  39. print(f'duration:{duration}')
  40. if __name__ == '__main__':
  41. # Demo.get_sheet('demo', 'zongjiao', 'TOoMpj')
  42. Demo.ffmpeg_test()
  43. print('\n')
  44. Demo.ffmpeg_test1()
  45. # Demo.get_video_info('g0118uklv86')
  46. pass