FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
ffmpeg-python/examples/get_video_thumbnail.py at master · root-master/ffmpeg-python · GitHub
root-master
ffmpeg-python
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
ffmpeg-python
/
examples
/
get_video_thumbnail.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
35 lines (29 loc) · 1.08 KB
Breadcrumbs
ffmpeg-python
/
examples
/
get_video_thumbnail.py
Copy path
File metadata and controls
executable file
·
35 lines (29 loc) · 1.08 KB
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
32
33
34
35
#!/usr/bin/env python
from
__future__
import
unicode_literals
,
print_function
import
argparse
import
ffmpeg
import
sys
parser
=
argparse
.
ArgumentParser
(
description
=
'Generate video thumbnail'
)
parser
.
add_argument
(
'in_filename'
,
help
=
'Input filename'
)
parser
.
add_argument
(
'out_filename'
,
help
=
'Output filename'
)
parser
.
add_argument
(
'--time'
,
type
=
int
,
default
=
0.1
,
help
=
'Time offset'
)
parser
.
add_argument
(
'--width'
,
type
=
int
,
default
=
120
,
help
=
'Width of output thumbnail (height automatically determined by aspect ratio)'
)
def
generate_thumbnail
(
in_filename
,
out_filename
,
time
,
width
):
try
:
(
ffmpeg
.
input
(
in_filename
,
ss
=
time
)
.
filter
(
'scale'
,
width
,
-
1
)
.
output
(
out_filename
,
vframes
=
1
)
.
overwrite_output
()
.
run
(
capture_stdout
=
True
,
capture_stderr
=
True
)
)
except
ffmpeg
.
Error
as
e
:
print
(
e
.
stderr
.
decode
(),
file
=
sys
.
stderr
)
sys
.
exit
(
1
)
if
__name__
==
'__main__'
:
args
=
parser
.
parse_args
()
generate_thumbnail
(
args
.
in_filename
,
args
.
out_filename
,
args
.
time
,
args
.
width
)
Back
|
FazBrowse Home
|
New Git URL