FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
ffmpeg-python/ffmpeg/_probe.py at extra-examples2 · flywind2/ffmpeg-python · GitHub
flywind2
/
ffmpeg-python
Public
forked from
kkroening/ffmpeg-python
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
ffmpeg-python
/
ffmpeg
/
_probe.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
28 lines (21 loc) · 902 Bytes
Breadcrumbs
ffmpeg-python
/
ffmpeg
/
_probe.py
Copy path
File metadata and controls
executable file
·
28 lines (21 loc) · 902 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import
json
import
subprocess
class
ProbeException
(
Exception
):
def
__init__
(
self
,
stderr_output
):
super
(
ProbeException
,
self
).
__init__
(
'ffprobe error'
)
self
.
stderr_output
=
stderr_output
def
probe
(
filename
):
"""Run ffprobe on the specified file and return a JSON representation of the output.
Raises:
ProbeException: if ffprobe returns a non-zero exit code, a ``ProbeException`` is returned with a generic error
message. The stderr output can be retrieved by accessing the ``stderr_output`` property of the exception.
"""
args
=
[
'ffprobe'
,
'-show_format'
,
'-show_streams'
,
'-of'
,
'json'
,
filename
]
p
=
subprocess
.
Popen
(
args
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
out
,
err
=
p
.
communicate
()
if
p
.
returncode
!=
0
:
raise
ExecException
(
err
)
return
json
.
loads
(
out
.
decode
(
'utf-8'
))
__all__
=
[
'probe'
,
]
Back
|
FazBrowse Home
|
New Git URL