Spaces:
Runtime error
Runtime error
NeuroSenko
commited on
Commit
•
8a74c53
1
Parent(s):
59c6298
added install/run scripts; fix ffmpeg command; place audio/video to specific out folders
Browse files- .gitignore +3 -0
- app.py +6 -6
- install.bat +3 -0
- out_audio/audio files will be placed here.txt +0 -0
- out_video/video files will be placed here.txt +0 -0
- run.bat +2 -0
.gitignore
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
venv/
|
2 |
+
out_audio/*.mp3
|
3 |
+
out_video/*.mp4
|
app.py
CHANGED
@@ -1,14 +1,14 @@
|
|
1 |
-
import gradio as gr
|
2 |
-
import io
|
3 |
import os
|
4 |
import subprocess
|
5 |
-
import time
|
6 |
from datetime import datetime
|
7 |
|
|
|
|
|
|
|
8 |
def video_to_audio_tab():
|
9 |
def video_to_audio(video):
|
10 |
output_file_name = "{datetime}.mp3".format(datetime=datetime.now().isoformat().replace(':', '-'))
|
11 |
-
output = os.path.join(
|
12 |
|
13 |
command = "ffmpeg -loglevel quiet -i \"{video}\" -map a \"{output}\"".format(video=video, output=output)
|
14 |
subprocess.call(command, shell=True)
|
@@ -26,10 +26,10 @@ def video_to_audio_tab():
|
|
26 |
def audio_to_video_tab():
|
27 |
def audio_to_video(audio, image):
|
28 |
output_file_name = "{datetime}.mp4".format(datetime=datetime.now().isoformat().replace(':', '-'))
|
29 |
-
output = os.path.join(
|
30 |
|
31 |
# command = "ffmpeg -i \"{image}\" -i \"{audio}\" \"{output}\"".format(image=image, audio=audio, output=output)
|
32 |
-
command = "ffmpeg -loglevel quiet -loop 1 -i \"{image}\" -i \"{audio}\" -c:v libx264 -tune stillimage -c:a aac -b:a 192k -pix_fmt yuv420p -shortest \"{output}\"".format(image=image, audio=audio, output=output)
|
33 |
subprocess.call(command, shell=True)
|
34 |
|
35 |
return output
|
|
|
|
|
|
|
1 |
import os
|
2 |
import subprocess
|
|
|
3 |
from datetime import datetime
|
4 |
|
5 |
+
import gradio as gr
|
6 |
+
|
7 |
+
|
8 |
def video_to_audio_tab():
|
9 |
def video_to_audio(video):
|
10 |
output_file_name = "{datetime}.mp3".format(datetime=datetime.now().isoformat().replace(':', '-'))
|
11 |
+
output = os.path.join("out_audio", output_file_name)
|
12 |
|
13 |
command = "ffmpeg -loglevel quiet -i \"{video}\" -map a \"{output}\"".format(video=video, output=output)
|
14 |
subprocess.call(command, shell=True)
|
|
|
26 |
def audio_to_video_tab():
|
27 |
def audio_to_video(audio, image):
|
28 |
output_file_name = "{datetime}.mp4".format(datetime=datetime.now().isoformat().replace(':', '-'))
|
29 |
+
output = os.path.join("out_video", output_file_name)
|
30 |
|
31 |
# command = "ffmpeg -i \"{image}\" -i \"{audio}\" \"{output}\"".format(image=image, audio=audio, output=output)
|
32 |
+
command = "ffmpeg -loglevel quiet -loop 1 -i \"{image}\" -i \"{audio}\" -r 2 -c:v libx264 -tune stillimage -c:a aac -b:a 192k -pix_fmt yuv420p -shortest \"{output}\"".format(image=image, audio=audio, output=output)
|
33 |
subprocess.call(command, shell=True)
|
34 |
|
35 |
return output
|
install.bat
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
python -m venv ./venv
|
2 |
+
call .\venv\Scripts\activate.bat
|
3 |
+
pip install -r requirements.txt
|
out_audio/audio files will be placed here.txt
ADDED
File without changes
|
out_video/video files will be placed here.txt
ADDED
File without changes
|
run.bat
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
call .\venv\Scripts\activate.bat
|
2 |
+
python app.py
|