Recording live video stream from IP camera issue
sambez_14 at hotmail.co.uk
Wed Feb 6 13:12:44 CET 2013
I have no vast knowledge of python, but i came across this code to capture video from my IP camera
print "Recording video..."
response = urllib2.urlopen("IP Address")
filename = time.strftime("%Y%m%d%H%M%S",time.localtime())+".avi"
f = open(filename, 'wb')
video_file_size_start = 0
video_file_size_end = 1048576 * 20 # end in 20 mb
block_size = 1024
buffer = response.read(block_size)
if not buffer:
video_file_size_start += len(buffer)
if video_file_size_start > video_file_size_end:
except Exception, e:
This code works, however when i try to playback the .avi file in VLC player (file wont open in any other media player) it just flashes an image instead of a video file, even though the .avi file is around 20mb.
Is there some extra lines of code i need to include or change? Perhaps a timing option instead of a file size?
Any help or insight would be much appreciated!!
More information about the Python-list