-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding mongodb based video player #75
Conversation
Uses the mjpeg server and open cv read to play the video. Issues: no sounds Tried to look at pygame for this, but could not find anything obvious. Maybe @marc-hanheide has an idea. This works for now and is used in the walking group entertainment interface.
…ds_ui into video_player Conflicts: strands_ui/package.xml
while self.play and ret and not rospy.is_shutdown(): | ||
img = self.bridge.cv2_to_imgmsg(frame, "bgr8") | ||
self.video_pub.publish(img) | ||
self.rate.sleep() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so, this assumes always be 25Hz videos. Quite a bold assumption. Can the rate be read from the video file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Valid point. I'll have a look but I guess so.
Don't merge yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fps = video.get(cv.CV_CAP_PROP_FPS)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly :)
Reading fps from video and setting appropriate sleep rate. |
for the audio: No, I don't have any idea, other than going full-scale with using ffmpeg library etc, But synchronicity will not be possible with the current approach. The alternative would be to not use the mjpeg canvas, but to really integrate an HTML5 player:
Then we would have to be able to serve the files via HTTP. That actually looks better, I believe... |
OK, that would be good. My only concern is that I have to hard code the path to the video files if I understand that correctly. I can use the media server to retrieve them but the html has to contain the path where I put them. Can I use absolute paths in there? I don't think so... how would I tell it where to look for the video? |
So basically, my problem is the same as with the images. The html files are all installed to Maybe I got something wrong and that is easy to fix, but afaik I cannot tell the html5 player where to look for the video, because it would only be able to find it in a directory where I don't have write permissions. |
If you don't mind @marc-hanheide I merge this because it does build, install, and works for now, so I can continue working on the overall system. This can be fixed at a later point. |
Go, merge it, but I think this calls for a change in strands_webserver as we already discussed in #59. |
The media_server package already serves the video files over HTTP, so no need to have another webserver to serve them or write them to a file in addition to the file already in the mongodb... |
@cburbridge How would I show a video on a webpage then using the media server? |
seems you can simply use
|
Sorry to render your video_server void ;-) |
Even better. Maybe I don't need the image server hack then either. |
Exactly as @marc-hanheide says. At the moment I only provided a Python API to query the list of available 'sets' and get the ID of files in the set (see README), but an http based API to allow javascript based queries is (low) on my todo list. |
Inspired by the music player by @nilsbore. Uses the mjpeg server and opencv to play the video.
Issues: no sounds
Tried to look at pygame for this, but could not find anything obvious. Maybe @marc-hanheide has an idea.
This works for now and is used in the walking group entertainment interface.