1

I am using ffserver and ffmpeg combination to capture web camera video and transmit it through my network.

I want to capture this video using opencv and python from another computer. I can see the video (cam1.asf) in the browser of another computer. But my opencv + python code could not capture any frame.

Code for ffserver

HTTPPort 8090
HTTPBindAddress 0.0.0.0
MaxHTTPConnections 2000
MaxClients 1000
MaxBandWidth 2000

<Feed feed1.ffm>
   File ./tmp/feed1.ffm
   FileMaxSize 1G
   ACL allow 127.0.0.1
</Feed>

<Stream cam1.asf>
  Feed feed1.ffm
  Format asf
  VideoCodec msmpeg4v2
  VideoFrameRate 30
  VideoSize vga
</Stream>

FFmpeg

$ffmpeg -f video4linux2 -i /dev/video0 192.168.1.3 /cam1.ffm

This stream can be seen in the browser

But with opencv code

import sys
import cv2.cv as cv
import numpy

video="http://http://192.168.1.3:8090/cam1.asf"
capture =cv.CaptureFromFile(video)
cv.NamedWindow('Video Stream', 1 )
while True:
  # capture the current frame
  frame = cv.QueryFrame(capture)
  #if frame is None:
   # break
  #else:
    #detect(frame)
  cv.ShowImage('Video Stream', frame)
  if cv.WaitKey(10) == 27:
    print 'ESC pressed. Exiting ...'
    break

I donot get any output in the stream

My aim is to work with the web camera video both at the base station (ie where the web camera is connected) and also at the network location

  • `http://http://` looks broken. also please use the cv2 api instead of the deprecated cv one. – berak Sep 03 '14 at 13:19
  • It remains the same after doing the correction. – Subhendu Sinha Chaudhuri Sep 03 '14 at 17:02
  • cv2 not working for me . import cv2 cam = cv2.VideoCapture(0) s, img = cam.read() winName = "Movement Indicator" cv2.namedWindow(winName, cv2.CV_WINDOW_AUTOSIZE) while s: cv2.imshow( winName,img ) s, img = cam.read() key = cv2.waitKey(10) if key == 27: cv2.destroyWindow(winName) break print "Goodbye" IS not working. – Subhendu Sinha Chaudhuri Sep 06 '14 at 05:36

0 Answers0