video-transcoder / README.md
Jeffgold's picture
Update README.md
650ee8c
|
raw
history blame
1.67 kB
---
title: Video Transcoder
emoji: 🐨
colorFrom: gray
colorTo: indigo
sdk: gradio
sdk_version: 3.29.0
app_file: app.py
pinned: false
---
Video Transcoder
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.
Requirements
ffmpeg
gradio
Usage
To use the video transcoder, first install the requirements:
pip install -r requirements.txt
Code snippet
Then, run the following command to launch the gradio space:
Use code with caution. Learn more
gradio.Interface(transcode_video).launch()
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.
Example
The following example shows how to use the video transcoder to transcode a video file to m3u8:
import gradio as gr
import ffmpeg
@gr.experimental()
def transcode_video(video_file):
"""Transcodes a video file to m3u8 using ffmpeg.
Args:
video_file: The path to the video file to transcode.
Returns:
The path to the transcoded m3u8 file.
"""
Create an output file.
output_file = "output.m3u8"
Transcode the video file.
ffmpeg.input(video_file).output(output_file).run()
Return the path to the transcoded file.
return output_file
gr.Interface(transcode_video).launch()
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.
License
This project is licensed under the MIT License.
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference