FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
ffmpeg-python/sample_script.py at devcontainer-setup-573 · squidarth/ffmpeg-python · GitHub
squidarth
/
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
/
sample_script.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
23 lines (17 loc) · 762 Bytes
Breadcrumbs
ffmpeg-python
/
sample_script.py
Copy path
File metadata and controls
23 lines (17 loc) · 762 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
import
requests
import
ffmpeg
import
tempfile
# Download a video file from the internet
video_url
=
'https://download.samplelib.com/mp4/sample-5s.mp4'
response
=
requests
.
get
(
video_url
,
stream
=
True
)
response
.
raise_for_status
()
# Save the video to a temporary file
with
tempfile
.
NamedTemporaryFile
(
delete
=
False
,
suffix
=
'.mp4'
)
as
temp_video_file
:
for
chunk
in
response
.
iter_content
(
chunk_size
=
8192
):
temp_video_file
.
write
(
chunk
)
temp_video_file
.
flush
()
# Process the video using ffmpeg-python
input_video
=
ffmpeg
.
input
(
temp_video_file
.
name
)
output_video
=
input_video
.
filter
(
'scale'
,
320
,
240
).
output
(
'output_video.mp4'
)
output_video
.
run
()
print
(
"Video processing completed. The output video is saved as output_video.mp4."
)
Back
|
FazBrowse Home
|
New Git URL