Skip to content

Commit

Permalink
FFMPEGWrapper: check MIME type
Browse files Browse the repository at this point in the history
  • Loading branch information
gmazzamuto committed Mar 3, 2021
1 parent 52e5922 commit 863a39b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions zetastitcher/io/ffmpeg_wrapper.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import json
import mimetypes
import subprocess as sp
from pathlib import Path

Expand Down Expand Up @@ -32,6 +33,10 @@ def open(self, file_path=None):
if file_path is not None:
self.file_path = Path(file_path)

mtype = mimetypes.guess_type(self.file_path)[0]
if mtype is None or not mtype.startswith('video'):
raise ValueError(f'Invalid MIME type:{mtype}')

cmd = [
'ffprobe',
'-v', 'quiet',
Expand Down

0 comments on commit 863a39b

Please sign in to comment.