Multishot support
Replace 10.11.12.13 with the IP address being used by your camera.
How to use the multishot capture feature
Starting in software release 2.1, the camera supports multishot capture. When enabled, you may capture one or more videos into memory before saving captured videos. Multishot capture is useful when you can't wait for the file encoding to complete before capturing another video, for example when recording lightning.
When configuring the camera, if you enable multishot capture, the number of buffers available to capture videos using the allowed settings is shown. As you adjust the duration, frame rate, and resolution, the number of available buffers is updated. For example, if you set the requested duration to 1/3 the maximum allowed duration, then you will have room to hold three captured videos in memory. The shorter the requested duration, the more video multishots can be captured before the memory becomes full.
In terms of the state transition diagram shown in the Edgertronic high speed camera in detail page, multishot capture simply means skipping the saving calibrating states and going back to the running state. Once the memory is full (or you tell the camera to save the multishot captures), then the camera will go to the saving state and save each of the captured videos that are held in memory. Once all multishot videos have been saved, the camera will return to the calibrating state.
See also Multishot support.
Enabling multishot capture
During the request/allowed negotiation using the CAMAPI configure_camera() method, include the dictionary entry requested_multishot_count with the value specifying the maximum number of multishot buffers you desire. If you want to use the maximum available buffers, set the value to None. Here is a coding example:
import hcamapi cam = hcamapi.HCamapi(opts.address) requested_settings = { "requested_iso":None, "requested_exposure":1/500.0, "requested_frame_rate":600, "requested_horizontal":None, "requested_vertical":None, "requested_subsample":1, "requested_duration":5, "requested_pretrigger":75, "requested_multishot_count":None, } allowed_settings = cam.configure_camera(requested_settings)
If you are accessing the CAMAPI via the camera's web server, then you would POST the requested settings to
http://10.11.12.13/configure_camera URL.
Identifying available multishot buffers
Depending on the requested camera settings, you may have enough memory to hold more than one captured video. Each memory region that can hold a captured video is called a multishot buffer. The camera reports the number of multishot buffers that will be used by the camera using the multishot_count entry in the allowed settings dictionary that is returned by the CAMAPI configure_camera() method.
allowed_settings = cam.configure_camera(requested_settings) print "Number of configured multishot buffers: %d" % allowed_settings.get('multishot_count')
If you are accessing the CAMAPI via the camera's web server, then you would POST the allowed settings to
http://10.11.12.13/configure_camera URL.
Filling the active buffer
After you determine the allowed settings are acceptable, you tell the camera to use the allowed settings by invoking the CAMAPI run() method. The run() method causes the camera to capture frames to multishot buffer 1, which is the active buffer. After a trigger and the post-trigger portion of the active buffer is filled, the camera will increment which multishot buffer is being filled, thus changing the active buffer.
You can query the number of the active buffer being filled via the CAMAPI get_camstatus() method. The returned dictionary will contain an active_buffer entry.
camstatus = cam.get_camstatus() print "Currently filling multishot buffer: %d" % camstatus.get('active_buffer')
If you are accessing the CAMAPI via the camera's web server, then you would GET the camera status using the
http://10.11.12.13/get_camstatus URL.
Capturing a multishot video
Once the camera is running, filling any configured pre-trigger portion of the active buffer, a trigger event will cause the camera to start filling the post-trigger portion of the active buffer. Once the post-trigger portion of the active buffer is filled, the camera will increment the active buffer number and again start filling any configured pre-trigger portion of the next multishot buffer.
If the trigger event caused the last multishot buffer to be filled, then the camera will automatically start saving the captured videos. Each multishot video will be saved to a separate file. A metadata file will be created for each multishot video that is saved.
Cancelling trigger
If you have triggered the camera and decide you do now want to keep the video, you can invoke the cancel() method.
ret = cam.cancel() if ret == cam.CAMAPI_STATUS_OKAY: print "Canceled filling post-trigger buffer, active video data discarded"
If the camera processes the cancel request before the post-trigger buffer is filled, then the active buffer is reused, with the camera again filling the pre-trigger portion of the buffer.
Discarding all unsaved video data
If one or more trigger events occurs and you do not want to save the captured video data, invoke the run() method.
Saving captured video
When all multishot buffers have been filled, the camera will automatically start saving the captured video frames in each multishot buffer. The video from each multishot buffer is saved to a different file, as well as the metadata file associated with the video in the multishot buffer. When saving multishot captured video, each filename will also contain the multishot number, such as for multishot 3, the filename might be slomo_1413060071_3.mov.
If you have captured one or more multishots and want to save them without having to fill all the rest of the multishot buffers, you can invoke the CAMAPI save() method.
ret = cam.save()
If you are accessing the CAMAPI via the camera's web server, then you would GET the camera save link using the
http://10.11.12.13/save URL.
You can query the number of the active buffer being saved via thee CAMAPI get_camstatus() method. The returned dictionary will contain the same active_buffer entry which is used to report the active buffer when video is being captured. In addition, the returned dictionary will contain the number of multishot buffers containing captured video using the dictionary entry captured_buffers.
camstatus = cam.get_camstatus() print "Currently saving active buffer: %d/%d" % (camstatus.get('active_buffer'), camstatus.get('captured_buffers))
If you are accessing the CAMAPI via the camera's web server, then you would GET the camera status using the
http://10.11.12.13/get_camstatus URL.
Trimming save in progress
While the camera is saving a captured video, it is possible to stop saving the remaining unsaved portion of the video currently being saved.
ret = cam.save_stop()
If the video is almost done being saved, invoking save_stop() can cause the next video to be discarded if the camera doesn't process the save_stop() request until after the current video is completely saved.
After issuing the save_stop() command, the camera will transition to the running state and start filling the pre-trigger portion of the first buffer.
If you are accessing the CAMAPI via the camera's web server, then you would GET the camera status using the
http://10.11.12.13/save_stop URL
to trim the video that is currently being saved.
Trimming save in progress and discarding all unsaved captured videos
In a similar fashion, you can trim the save in progress and discard the captured videos in the unsaved buffers.
ret = cam.save_stop(discard_unsaved=True)
If you are accessing the CAMAPI via the camera's web server, then you would GET the camera status using the
http://10.11.12.13/save_stop?discard_unsaved=1 URL
to trim the video that is currently being saved and discard the remaining unsaved captured video data.