Spaces:
Sleeping
Sleeping
lazarusking
commited on
Commit
·
7787f45
1
Parent(s):
a044023
readme update
Browse files- .gitignore +2 -1
- README.md +27 -0
- app.py +8 -39
- images/gradio-app.png +0 -0
- requirements.txt +59 -0
.gitignore
CHANGED
|
@@ -1,3 +1,4 @@
|
|
| 1 |
__pycache__/
|
| 2 |
*.pyc
|
| 3 |
-
flagged/
|
|
|
|
|
|
| 1 |
__pycache__/
|
| 2 |
*.pyc
|
| 3 |
+
flagged/
|
| 4 |
+
.venv
|
README.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: FFmpeg
|
| 3 |
+
emoji: 🔥
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: green
|
| 6 |
+
sdk: gradio
|
| 7 |
+
sdk_version: 3.1.4
|
| 8 |
+
app_file: app.py
|
| 9 |
+
tags : ["ffmpeg","converter","media","processing"]
|
| 10 |
+
pinned: true
|
| 11 |
+
license: mit
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
+
# Overview
|
| 15 |
+
Simple gradio interface for ffmpeg filters and codecs
|
| 16 |
+
|
| 17 |
+

|
| 18 |
+
## Dev
|
| 19 |
+
Built with Gradio and ffmpy
|
| 20 |
+
|
| 21 |
+
inspiration by [ffmpeg-commander](https://www.github.com/alfg/ffmpeg-commander)
|
| 22 |
+
# Install
|
| 23 |
+
Clone the repo and
|
| 24 |
+
`pip install -r requirements.txt`
|
| 25 |
+
- To run locally
|
| 26 |
+
|
| 27 |
+
`gradio app.py`
|
app.py
CHANGED
|
@@ -8,49 +8,19 @@ from tempfile import _TemporaryFileWrapper
|
|
| 8 |
from ffmpy import FFmpeg
|
| 9 |
|
| 10 |
import gradio as gr
|
| 11 |
-
from functions import (Clear, CommandBuilder,
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
logging.basicConfig(level=logging.INFO)
|
| 15 |
|
| 16 |
choices = ["mp3", "ogg", "flac", "wav"]
|
| 17 |
|
| 18 |
|
| 19 |
-
def parse(param: json) -> dict:
|
| 20 |
-
with open(param) as file:
|
| 21 |
-
return json.load(file)
|
| 22 |
-
|
| 23 |
-
# global inputs,inputs_clip
|
| 24 |
-
data = parse("./data.json")
|
| 25 |
-
|
| 26 |
-
containers=[j.get("name") for i in data["containers"] for j in data["containers"][i]]
|
| 27 |
-
video_containers = [i.get("name") for i in data["containers"]["video"]]
|
| 28 |
-
video_codecs = [i.get("name") for i in data["codecs"]["video"]]
|
| 29 |
-
video_aspect_ratio = [i.get("name") for i in data["aspects"]]
|
| 30 |
-
video_scaling = [i.get("name") for i in data["scalings"]]
|
| 31 |
-
""" Audio """
|
| 32 |
-
audio_containers = [i.get("name") for i in data["containers"]["audio"]]
|
| 33 |
-
audio_codecs = [i.get("name") for i in data["codecs"]["audio"]]
|
| 34 |
-
audio_channels = [i.get("name") for i in data["audioChannels"]]
|
| 35 |
-
audio_quality = [i.get("name") for i in data["audioQualities"]]
|
| 36 |
-
audio_sample_rates = [i.get("name") for i in data["sampleRates"]]
|
| 37 |
-
|
| 38 |
-
""" Video & Audio Filters """
|
| 39 |
-
# deband=[i.get("name") for i in data["deband"]]
|
| 40 |
-
# deflicker=[i.get("name") for i in data["deflicker"]]
|
| 41 |
-
# deshake=[i.get("name") for i in data["deshake"]]
|
| 42 |
-
# dejudder=[i.get("name") for i in data["dejudder"]]
|
| 43 |
-
# denoise=[i.get("name") for i in data["denoise"]]
|
| 44 |
-
# deinterlace=[i.get("name") for i in data["deinterlace"]]
|
| 45 |
-
filters = ["deband", "deflicker", "deshake",
|
| 46 |
-
"dejudder", "denoise", "deinterlace"]
|
| 47 |
-
vf = [{vFilter: names} for vFilter in filters for names in [
|
| 48 |
-
[i for i in data[vFilter]]]]
|
| 49 |
-
|
| 50 |
-
presets = [i.get("name") for i in data["presets"]]
|
| 51 |
-
profiles = [i.get("name") for i in data["profiles"]]
|
| 52 |
-
speeds = [i.get("name") for i in data["speeds"]]
|
| 53 |
-
|
| 54 |
logging.info(msg=f"{video_containers}")
|
| 55 |
|
| 56 |
|
|
@@ -92,7 +62,6 @@ def get_component_instance(inputs: gr.Blocks) -> list:
|
|
| 92 |
|
| 93 |
# names=[{x:i} for x in ["audioChannels","audioQualities"] for i in [[i.get("name") for i in data[x]]]]
|
| 94 |
with gr.Blocks(css="./styles.css") as dm:
|
| 95 |
-
gr.Markdown("Something")
|
| 96 |
with gr.Tabs():
|
| 97 |
with gr.TabItem("Format"):
|
| 98 |
# Input Buttons
|
|
@@ -186,7 +155,7 @@ with gr.Blocks(css="./styles.css") as dm:
|
|
| 186 |
ffmpeg_commands.do()
|
| 187 |
pprint(ffmpeg_commands.commands)
|
| 188 |
ffmpeg_commands.update(output_textbox)
|
| 189 |
-
file_input.change(fn=updateOutput,inputs=file_input,outputs=output_textbox)
|
| 190 |
clip.change(fn=change_clipbox, inputs=clip,
|
| 191 |
outputs=[start_time, stop_time])
|
| 192 |
|
|
|
|
| 8 |
from ffmpy import FFmpeg
|
| 9 |
|
| 10 |
import gradio as gr
|
| 11 |
+
from functions import (Clear, CommandBuilder, audio_channels, audio_codecs,
|
| 12 |
+
audio_containers, audio_quality, audio_sample_rates,
|
| 13 |
+
change_clipbox, containers, customBitrate, filters,
|
| 14 |
+
mediaChange, presets, profiles, speeds,
|
| 15 |
+
supported_codecs, supported_presets, updateOutput,
|
| 16 |
+
video_aspect_ratio, video_codecs, video_containers,
|
| 17 |
+
video_scaling, videoChange,vf)
|
| 18 |
|
| 19 |
logging.basicConfig(level=logging.INFO)
|
| 20 |
|
| 21 |
choices = ["mp3", "ogg", "flac", "wav"]
|
| 22 |
|
| 23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
logging.info(msg=f"{video_containers}")
|
| 25 |
|
| 26 |
|
|
|
|
| 62 |
|
| 63 |
# names=[{x:i} for x in ["audioChannels","audioQualities"] for i in [[i.get("name") for i in data[x]]]]
|
| 64 |
with gr.Blocks(css="./styles.css") as dm:
|
|
|
|
| 65 |
with gr.Tabs():
|
| 66 |
with gr.TabItem("Format"):
|
| 67 |
# Input Buttons
|
|
|
|
| 155 |
ffmpeg_commands.do()
|
| 156 |
pprint(ffmpeg_commands.commands)
|
| 157 |
ffmpeg_commands.update(output_textbox)
|
| 158 |
+
# file_input.change(fn=updateOutput,inputs=file_input,outputs=output_textbox)
|
| 159 |
clip.change(fn=change_clipbox, inputs=clip,
|
| 160 |
outputs=[start_time, stop_time])
|
| 161 |
|
images/gradio-app.png
ADDED
|
requirements.txt
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
aiohttp==3.8.1
|
| 2 |
+
aiosignal==1.2.0
|
| 3 |
+
analytics-python==1.4.0
|
| 4 |
+
anyio==3.6.1
|
| 5 |
+
async-timeout==4.0.2
|
| 6 |
+
attrs==22.1.0
|
| 7 |
+
backoff==1.10.0
|
| 8 |
+
bcrypt==4.0.0
|
| 9 |
+
certifi==2022.6.15
|
| 10 |
+
cffi==1.15.1
|
| 11 |
+
charset-normalizer==2.1.1
|
| 12 |
+
click==8.1.3
|
| 13 |
+
cryptography==37.0.4
|
| 14 |
+
cycler==0.11.0
|
| 15 |
+
fastapi==0.81.0
|
| 16 |
+
ffmpy==0.3.0
|
| 17 |
+
fonttools==4.37.1
|
| 18 |
+
frozenlist==1.3.1
|
| 19 |
+
fsspec==2022.7.1
|
| 20 |
+
gradio==3.1.4
|
| 21 |
+
h11==0.12.0
|
| 22 |
+
httpcore==0.15.0
|
| 23 |
+
httpx==0.23.0
|
| 24 |
+
idna==3.3
|
| 25 |
+
Jinja2==3.1.2
|
| 26 |
+
kiwisolver==1.4.4
|
| 27 |
+
linkify-it-py==1.0.3
|
| 28 |
+
markdown-it-py==2.1.0
|
| 29 |
+
MarkupSafe==2.1.1
|
| 30 |
+
matplotlib==3.5.3
|
| 31 |
+
mdit-py-plugins==0.3.0
|
| 32 |
+
mdurl==0.1.2
|
| 33 |
+
monotonic==1.6
|
| 34 |
+
multidict==6.0.2
|
| 35 |
+
numpy==1.23.2
|
| 36 |
+
orjson==3.8.0
|
| 37 |
+
packaging==21.3
|
| 38 |
+
pandas==1.4.3
|
| 39 |
+
paramiko==2.11.0
|
| 40 |
+
Pillow==9.2.0
|
| 41 |
+
pycparser==2.21
|
| 42 |
+
pycryptodome==3.15.0
|
| 43 |
+
pydantic==1.9.2
|
| 44 |
+
pydub==0.25.1
|
| 45 |
+
PyNaCl==1.5.0
|
| 46 |
+
pyparsing==3.0.9
|
| 47 |
+
python-dateutil==2.8.2
|
| 48 |
+
python-multipart==0.0.5
|
| 49 |
+
pytz==2022.2.1
|
| 50 |
+
requests==2.28.1
|
| 51 |
+
rfc3986==1.5.0
|
| 52 |
+
six==1.16.0
|
| 53 |
+
sniffio==1.2.0
|
| 54 |
+
starlette==0.19.1
|
| 55 |
+
typing-extensions==4.3.0
|
| 56 |
+
uc-micro-py==1.0.1
|
| 57 |
+
urllib3==1.26.12
|
| 58 |
+
uvicorn==0.18.3
|
| 59 |
+
yarl==1.8.1
|