FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
ffmpeg-python/examples/video_info.py at master · biofool/ffmpeg-python · GitHub
biofool
/
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
/
examples
/
video_info.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
31 lines (24 loc) · 921 Bytes
Breadcrumbs
ffmpeg-python
/
examples
/
video_info.py
Copy path
File metadata and controls
executable file
·
31 lines (24 loc) · 921 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
29
30
31
#!/usr/bin/env python
from
__future__
import
unicode_literals
,
print_function
import
argparse
import
ffmpeg
import
sys
parser
=
argparse
.
ArgumentParser
(
description
=
'Get video information'
)
parser
.
add_argument
(
'in_filename'
,
help
=
'Input filename'
)
if
__name__
==
'__main__'
:
args
=
parser
.
parse_args
()
try
:
probe
=
ffmpeg
.
probe
(
args
.
in_filename
)
except
ffmpeg
.
Error
as
e
:
print
(
e
.
stderr
,
file
=
sys
.
stderr
)
sys
.
exit
(
1
)
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'
,
file
=
sys
.
stderr
)
sys
.
exit
(
1
)
width
=
int
(
video_stream
[
'width'
])
height
=
int
(
video_stream
[
'height'
])
num_frames
=
int
(
video_stream
[
'nb_frames'
])
print
(
'width: {}'
.
format
(
width
))
print
(
'height: {}'
.
format
(
height
))
print
(
'num_frames: {}'
.
format
(
num_frames
))
Back
|
FazBrowse Home
|
New Git URL