Spaces:
Paused
Paused
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import ffmpeg
|
3 |
+
|
4 |
+
@gr.experimental()
|
5 |
+
def transcode_video(video_file):
|
6 |
+
"""Transcodes a video file to m3u8 using ffmpeg.
|
7 |
+
|
8 |
+
Args:
|
9 |
+
video_file: The path to the video file to transcode.
|
10 |
+
|
11 |
+
Returns:
|
12 |
+
The path to the transcoded m3u8 file.
|
13 |
+
"""
|
14 |
+
|
15 |
+
# Create an output file.
|
16 |
+
output_file = "output.m3u8"
|
17 |
+
|
18 |
+
# Transcode the video file.
|
19 |
+
ffmpeg.input(video_file).output(output_file).run()
|
20 |
+
|
21 |
+
# Return the path to the transcoded file.
|
22 |
+
return output_file
|
23 |
+
|
24 |
+
gr.Interface(transcode_video).launch()
|