Spaces:
Paused
Paused
Update README.md
Browse files
README.md
CHANGED
@@ -9,4 +9,56 @@ app_file: app.py
|
|
9 |
pinned: false
|
10 |
---
|
11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
9 |
pinned: false
|
10 |
---
|
11 |
|
12 |
+
Video Transcoder
|
13 |
+
This project provides a hugging face gradio space that takes a video file and transcodes it to m3u8 using ffmpeg. The transcoded m3u8 file can then be exported and downloaded.
|
14 |
+
|
15 |
+
Requirements
|
16 |
+
ffmpeg
|
17 |
+
gradio
|
18 |
+
Usage
|
19 |
+
To use the video transcoder, first install the requirements:
|
20 |
+
|
21 |
+
pip install -r requirements.txt
|
22 |
+
|
23 |
+
Code snippet
|
24 |
+
|
25 |
+
Then, run the following command to launch the gradio space:
|
26 |
+
|
27 |
+
Use code with caution. Learn more
|
28 |
+
gradio.Interface(transcode_video).launch()
|
29 |
+
|
30 |
+
The gradio space will take a video file as input and transcode it to m3u8 using ffmpeg. The transcoded m3u8 file can then be exported and downloaded.
|
31 |
+
|
32 |
+
Example
|
33 |
+
The following example shows how to use the video transcoder to transcode a video file to m3u8:
|
34 |
+
|
35 |
+
import gradio as gr
|
36 |
+
import ffmpeg
|
37 |
+
|
38 |
+
@gr.experimental()
|
39 |
+
def transcode_video(video_file):
|
40 |
+
"""Transcodes a video file to m3u8 using ffmpeg.
|
41 |
+
|
42 |
+
Args:
|
43 |
+
video_file: The path to the video file to transcode.
|
44 |
+
|
45 |
+
Returns:
|
46 |
+
The path to the transcoded m3u8 file.
|
47 |
+
"""
|
48 |
+
|
49 |
+
Create an output file.
|
50 |
+
output_file = "output.m3u8"
|
51 |
+
|
52 |
+
Transcode the video file.
|
53 |
+
ffmpeg.input(video_file).output(output_file).run()
|
54 |
+
|
55 |
+
Return the path to the transcoded file.
|
56 |
+
return output_file
|
57 |
+
|
58 |
+
gr.Interface(transcode_video).launch()
|
59 |
+
|
60 |
+
To transcode a video file, first select the video file from your computer. Then, click the "Transcode" button. The transcoded m3u8 file will be saved to your computer.
|
61 |
+
|
62 |
+
License
|
63 |
+
This project is licensed under the MIT License.
|
64 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|