Reputation: 619
I am preparing response to a http request to send video and receiving error: Broken Pipe
if self.path.endswith(".ts"):
f = open("filename.ts", 'r')
self.send_response(200)
self.send_header('Content-Type', "video/mp2t")
self.end_headers()
self.wfile.write(f.read())
return
Same response below works fine.
if self.path.endswith(".mov"):
f = open("filename.mov", 'r')
self.send_response(200)
self.send_header('Content-Type', "video/mpeg")
self.end_headers()
self.wfile.write(f.read())
return
I suspect it is related to mimetype issue. Can any one suggest me how can i use video/mp2t with baseHttpServer ??
Upvotes: 0
Views: 6888
Reputation: 619
In the context of mpeg2ts, client(Quicktime in Browser) requesting specific byte ranges in multiple GET requests. preparing the response as per the requested byte ranges fixed the issue.
Upvotes: 0
Reputation: 70158
Alright, I'll give it a try. "Broken pipe" on the server side usually means that the client closes the connection while the server is still sending data. From your previous question, I assume your client is a browser (using the <video>
tag). That most probably means that the browser does not support playback of MPEG transport streams. Actually I haven't heard of any browser that supports it.
Maybe you should try to stream an Ogg Theora video (MIME type "video/theora") for testing - Firefox 3.1+ supports this out of the box. If that works, your server implementation is correct.
Upvotes: 1