1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- # -*- coding: utf-8 -*-
- # @Author: wangkun
- # @Time: 2022/11/29
- import ffmpeg
- import os
- import sys
- sys.path.append(os.getcwd())
- from main.feishu_lib import Feishu
- class Demo:
- @classmethod
- def get_sheet(cls, log_type, crawler, sheetid):
- sheet = Feishu.get_values_batch(log_type, crawler, sheetid)
- print(sheet)
- @classmethod
- def ffmpeg_test(cls):
- probe = ffmpeg.probe('/root/piaoquan_crawler/crawler_zongjiao/videos/ ▶此视频非常难得,发出去,很多人都还不知道!/video.mp4')
- video_stream = next((stream for stream in probe['streams'] if stream['codec_type'] == 'video'), None)
- if video_stream is None:
- print('No video stream found!')
- return
- width = int(video_stream['width'])
- height = int(video_stream['height'])
- duration = float(video_stream['duration'])
- print(f'width:{width}')
- print(f'height:{height}')
- print(f'duration:{duration}')
- @classmethod
- def ffmpeg_test1(cls):
- probe = ffmpeg.probe('./crawler_zongjiao/videos/ ▶此视频非常难得,发出去,很多人都还不知道!/video.mp4')
- video_stream = next((stream for stream in probe['streams'] if stream['codec_type'] == 'video'), None)
- if video_stream is None:
- print('No video stream found!')
- return
- width = int(video_stream['width'])
- height = int(video_stream['height'])
- duration = float(video_stream['duration'])
- print(f'width:{width}')
- print(f'height:{height}')
- print(f'duration:{duration}')
- if __name__ == '__main__':
- # Demo.get_sheet('demo', 'zongjiao', 'TOoMpj')
- Demo.ffmpeg_test()
- print('\n')
- Demo.ffmpeg_test1()
- # Demo.get_video_info('g0118uklv86')
- pass
|