Spaces:
Build error
Build error
app.py
CHANGED
|
@@ -166,18 +166,55 @@ def gen_moviepy_gif(start_seconds, end_seconds):
|
|
| 166 |
video_path = "./ShiaLaBeouf.mp4"
|
| 167 |
video = mp.VideoFileClip(video_path) #.resize(0.3)
|
| 168 |
final_clip = video.subclip(start_seconds, end_seconds)
|
| 169 |
-
|
| 170 |
-
#final_clip.to_gif("gifimage.gif")
|
| 171 |
-
final_clip.write_gif("gifimage.gif") #, program='ffmpeg', tempfiles=True, fps=15, fuzz=3)
|
| 172 |
print("I am here now")
|
| 173 |
-
|
| 174 |
-
|
|
|
|
|
|
|
|
|
|
| 175 |
gif_img = mp.VideoFileClip("gifimage.gif")
|
|
|
|
|
|
|
| 176 |
print("At the very end")
|
| 177 |
return gif_img
|
| 178 |
|
| 179 |
|
| 180 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 181 |
sample_video = ['./ShiaLaBeouf.mp4']
|
| 182 |
sample_vid = gr.Video(label='Video file') #for displaying the example
|
| 183 |
examples = gr.components.Dataset(components=[sample_vid], samples=[sample_video], type='values')
|
|
|
|
| 166 |
video_path = "./ShiaLaBeouf.mp4"
|
| 167 |
video = mp.VideoFileClip(video_path) #.resize(0.3)
|
| 168 |
final_clip = video.subclip(start_seconds, end_seconds)
|
| 169 |
+
final_clip.write_videofile("gifimage.mp4")
|
|
|
|
|
|
|
| 170 |
print("I am here now")
|
| 171 |
+
|
| 172 |
+
gifclip = VideoFileClip("gifimage.mp4")
|
| 173 |
+
print("all good so far")
|
| 174 |
+
gifclip.write_gif("gifimage.gif") #, program='ffmpeg', tempfiles=True, fps=15, fuzz=3)
|
| 175 |
+
print("pretty good")
|
| 176 |
gif_img = mp.VideoFileClip("gifimage.gif")
|
| 177 |
+
|
| 178 |
+
#final_clip.close()
|
| 179 |
print("At the very end")
|
| 180 |
return gif_img
|
| 181 |
|
| 182 |
|
| 183 |
|
| 184 |
+
# Import everything needed to edit video clips
|
| 185 |
+
from moviepy.editor import *
|
| 186 |
+
|
| 187 |
+
# loading video gfg
|
| 188 |
+
clip = VideoFileClip("geeks.mp4")
|
| 189 |
+
|
| 190 |
+
# getting subclip
|
| 191 |
+
clip = clip.subclip(0, 7)
|
| 192 |
+
|
| 193 |
+
# saving the clip
|
| 194 |
+
clip.write_videofile("handmade_gfg.mp4")
|
| 195 |
+
|
| 196 |
+
# showing clip
|
| 197 |
+
clip.ipython_display()
|
| 198 |
+
|
| 199 |
+
# Import everything needed to edit video clips
|
| 200 |
+
from moviepy.editor import *
|
| 201 |
+
|
| 202 |
+
# loading video gfg
|
| 203 |
+
clip = VideoFileClip("geeks.mp4")
|
| 204 |
+
|
| 205 |
+
# getting only first 3 seconds
|
| 206 |
+
clip = clip.subclip(0, 3)
|
| 207 |
+
|
| 208 |
+
# saving video clip as gif
|
| 209 |
+
clip.write_gif("intro_gif.gif")
|
| 210 |
+
|
| 211 |
+
# loading gif
|
| 212 |
+
gif = VideoFileClip("intro_gif.gif")
|
| 213 |
+
|
| 214 |
+
# showing gif
|
| 215 |
+
gif.ipython_display()
|
| 216 |
+
|
| 217 |
+
|
| 218 |
sample_video = ['./ShiaLaBeouf.mp4']
|
| 219 |
sample_vid = gr.Video(label='Video file') #for displaying the example
|
| 220 |
examples = gr.components.Dataset(components=[sample_vid], samples=[sample_video], type='values')
|