*Hello Everyone, I'm using the Live Streaming Video through WebCam. It's storing in .avi format. When i'm playing the Video. I'm not getting the audio of that video. I hope that opencv does not provide the audio features. Kindly let me know if you have any idea. Thanks,*
*Please find the below code:---------------* import os.path import numpy as np import cv2, time import random def change_res(cap, width, height): cap.set(3, width) cap.set(4, height) #Standard Video Dimensions Sizes STD_DIMENSIONS = { '480p': (640, 480), '720p': (1280, 720), '1080p': (1920, 1080), '4k': (3840, 2160), } VIDEO_TYPE = { 'avi':cv2.VideoWriter_fourcc(*'XVID'), 'mp4':cv2.VideoWriter_fourcc(*'XVID'), } def get_video_type(filename): ext = os.path.splitext(filename), if ext in VIDEO_TYPE: return VIDEO_TYPE[ext] return VIDEO_TYPE['avi'] def get_dims(cap, res='480p'): width, height = STD_DIMENSIONS['480p'] if res in STD_DIMENSIONS: width, height = STD_DIMENSIONS[res] change_res(cap, width, height) return width, height #--------------START LIVE VIDEO----------# random_id = random.randint(10000,99999) livevideo_name = str('livevideo_'+str(random_id)+'.avi') frames_per_second = 20.0 #..Frame Per Second my_res = '480p' #..Frame Size # Capture video from camera livevideos = '/livevideos/'+livevideo_name cap = cv2.VideoCapture(-1) dims = get_dims(cap, res=my_res) video_type_cv2 = get_video_type(livevideos) # Define the codec and create VideoWriter object fourcc = cv2.VideoWriter_fourcc(*'XVID') # Be sure to use the lower case out = cv2.VideoWriter(livevideos, video_type_cv2, frames_per_second, dims) while(True): ret, frame = cap.read() if ret==True: frame = cv2.flip(frame,1) # Write the frame into the file out.write(frame) cv2.imshow('frame',frame) if cv2.waitKey(1) & 0xFF == ord('q'): break else: break # When everything done, release the video capture and video write objects cap.release() out.release() # Closes all the frames cv2.destroyAllWindows() -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAEr6%3DdzZyO44sDLkd-HPoqh-LCuuvvnRiXDfEeXWZduCxBuw4g%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.