Spaces:
Runtime error
Runtime error
app.py
CHANGED
|
@@ -9,6 +9,7 @@ from moviepy.editor import *
|
|
| 9 |
import numpy as np
|
| 10 |
import mutagen
|
| 11 |
from mutagen.mp3 import MP3
|
|
|
|
| 12 |
|
| 13 |
#path = "/content/gdrive/My Drive/AI/sample_imgs/"
|
| 14 |
#dirs = os.listdir( path )
|
|
@@ -34,7 +35,11 @@ def resize(img_list):
|
|
| 34 |
|
| 35 |
#resize_img_list = resize(img_list)
|
| 36 |
|
|
|
|
| 37 |
|
|
|
|
|
|
|
|
|
|
| 38 |
#image_files = [os.path.join(image_folder,img)
|
| 39 |
# for img in resize_img_list
|
| 40 |
# if img.endswith(".jpg")]
|
|
@@ -90,6 +95,14 @@ def merge_audio_video(entities_num, resize_img_list, text_input):
|
|
| 90 |
# showing video clip
|
| 91 |
#videoclip.ipython_display()
|
| 92 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 93 |
return mergedclip
|
| 94 |
|
| 95 |
|
|
|
|
| 9 |
import numpy as np
|
| 10 |
import mutagen
|
| 11 |
from mutagen.mp3 import MP3
|
| 12 |
+
import cv2
|
| 13 |
|
| 14 |
#path = "/content/gdrive/My Drive/AI/sample_imgs/"
|
| 15 |
#dirs = os.listdir( path )
|
|
|
|
| 35 |
|
| 36 |
#resize_img_list = resize(img_list)
|
| 37 |
|
| 38 |
+
video = cv2.VideoCapture(filename)
|
| 39 |
|
| 40 |
+
duration = video.get(cv2.CAP_PROP_POS_MSEC)
|
| 41 |
+
frame_count = video.get(cv2.CAP_PROP_FRAME_COUNT)
|
| 42 |
+
|
| 43 |
#image_files = [os.path.join(image_folder,img)
|
| 44 |
# for img in resize_img_list
|
| 45 |
# if img.endswith(".jpg")]
|
|
|
|
| 95 |
# showing video clip
|
| 96 |
#videoclip.ipython_display()
|
| 97 |
|
| 98 |
+
#Getting size and frame count of merged video file
|
| 99 |
+
video = cv2.VideoCapture(mergedclip)
|
| 100 |
+
print('Getting size and frame count of merged video file')
|
| 101 |
+
duration = video.get(cv2.CAP_PROP_POS_MSEC)
|
| 102 |
+
frame_count = video.get(cv2.CAP_PROP_FRAME_COUNT)
|
| 103 |
+
print('duration is:',duration)
|
| 104 |
+
print('frame count :', frame_count)
|
| 105 |
+
|
| 106 |
return mergedclip
|
| 107 |
|
| 108 |
|