Get video information from video, mimiced from ffmpeg-python. https://github.com/kkroening/ffmpeg-python. Args: vid_file ([str]): video file path. Raises: FileNotFoundError: check the input path. Returns: None.
(self, input_path)
| 492 | class vid_info_reader(object): |
| 493 | |
| 494 | def __init__(self, input_path) -> None: |
| 495 | """Get video information from video, mimiced from ffmpeg-python. |
| 496 | https://github.com/kkroening/ffmpeg-python. |
| 497 | |
| 498 | Args: |
| 499 | vid_file ([str]): video file path. |
| 500 | |
| 501 | Raises: |
| 502 | FileNotFoundError: check the input path. |
| 503 | |
| 504 | Returns: |
| 505 | None. |
| 506 | """ |
| 507 | check_input_path( |
| 508 | input_path, |
| 509 | allowed_suffix=['.mp4', '.gif', '.png', '.jpg', '.jpeg'], |
| 510 | tag='input file', |
| 511 | path_type='file') |
| 512 | cmd = [ |
| 513 | 'ffprobe', '-show_format', '-show_streams', '-of', 'json', |
| 514 | input_path |
| 515 | ] |
| 516 | process = subprocess.Popen( |
| 517 | cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) |
| 518 | out, _ = process.communicate() |
| 519 | probe = json.loads(out.decode('utf-8')) |
| 520 | video_stream = next((stream for stream in probe['streams'] |
| 521 | if stream['codec_type'] == 'video'), None) |
| 522 | if video_stream is None: |
| 523 | print('No video stream found', file=sys.stderr) |
| 524 | sys.exit(1) |
| 525 | self.video_stream = video_stream |
| 526 | |
| 527 | def __getitem__( |
| 528 | self, |
nothing calls this directly
no test coverage detected