Spaces:
Runtime error
Runtime error
Ahsen Khaliq
commited on
Commit
·
3117ce4
1
Parent(s):
940ae7f
Update app.py
Browse files
app.py
CHANGED
@@ -11,21 +11,20 @@ convert_video = torch.hub.load("PeterL1n/RobustVideoMatting", "converter")
|
|
11 |
|
12 |
def inference(video):
|
13 |
os.system('rm output.mp4')
|
14 |
-
clip = VideoFileClip(video).subclip(0, 5)
|
15 |
-
clip.write_videofile("output.mp4")
|
16 |
-
|
17 |
-
# os.system('ffmpeg -ss 00:00:00 -i '+ video +' -to 00:00:05 -c copy output.mp4')
|
18 |
convert_video(
|
19 |
model, # The loaded model, can be on any device (cpu or cuda).
|
20 |
input_source='output.mp4', # A video file or an image sequence directory.
|
21 |
-
input_resize=(
|
22 |
downsample_ratio=0.25, # [Optional] If None, make downsampled max size be 512px.
|
23 |
output_type='video', # Choose "video" or "png_sequence"
|
24 |
output_composition='com.mp4', # File path if video; directory path if png sequence.
|
25 |
output_alpha="pha.mp4", # [Optional] Output the raw alpha prediction.
|
26 |
output_foreground="fgr.mp4", # [Optional] Output the raw foreground prediction.
|
27 |
output_video_mbps=4, # Output video mbps. Not needed for png sequence.
|
28 |
-
seq_chunk=
|
29 |
num_workers=1, # Only for image sequence input. Reader threads.
|
30 |
progress=True # Print conversion progress.
|
31 |
)
|
|
|
11 |
|
12 |
def inference(video):
|
13 |
os.system('rm output.mp4')
|
14 |
+
#clip = VideoFileClip(video).subclip(0, 5)
|
15 |
+
#clip.write_videofile("output.mp4")
|
16 |
+
os.system('ffmpeg -ss 00:00:00 -i '+ video +' -to 00:00:05 -c copy output.mp4')
|
|
|
17 |
convert_video(
|
18 |
model, # The loaded model, can be on any device (cpu or cuda).
|
19 |
input_source='output.mp4', # A video file or an image sequence directory.
|
20 |
+
input_resize=(250, 250), # [Optional] Resize the input (also the output).
|
21 |
downsample_ratio=0.25, # [Optional] If None, make downsampled max size be 512px.
|
22 |
output_type='video', # Choose "video" or "png_sequence"
|
23 |
output_composition='com.mp4', # File path if video; directory path if png sequence.
|
24 |
output_alpha="pha.mp4", # [Optional] Output the raw alpha prediction.
|
25 |
output_foreground="fgr.mp4", # [Optional] Output the raw foreground prediction.
|
26 |
output_video_mbps=4, # Output video mbps. Not needed for png sequence.
|
27 |
+
seq_chunk=12, # Process n frames at once for better parallelism.
|
28 |
num_workers=1, # Only for image sequence input. Reader threads.
|
29 |
progress=True # Print conversion progress.
|
30 |
)
|