Save mode

From edgertronic high speed video camera
Jump to navigation Jump to search
This feature is supported in Software Version 2.4 and later.


Save modes

The camera supports four save modes: Auto, Review, Background (FIFO) and Background (LIFO). Auto will automatically save after the capture(s) and is a good choice when using the camera manually. Review allows you to trim the captured video(s) so only the portion of interest is saved in the movie file. Background (FIFO) and Background (LIFO) allow you to continuously capture videos while those videos already captured are saved in the background without interrupting your ability to capture additional videos. Background (FIFO), which stands for first in / first out, saves the oldest unsaved captured video first. Background (LIFO), which stands for last in / first out, saves the newest unsaved captured video first.

Save mode Description
Auto User sets the multishot count to the number of videos to be captured and then camera will automatically save the videos once the number of trigger events matches the multishot count.
Review When the user has captured all the events of interest, the user can review the captured frames and adjust some settings and the start and end frame to save, before saving a video.
Background (FIFO) After a video is captured, the camera allows another video to be captured while captured video is being saved. You can continue to capture videos until the camera's memory (either 8GB or 16GB, depending on model) is full of unsaved video frames. The oldest unsaved captured video is saved first.
Background (LIFO) After a video is captured, the camera allows another video to be captured while captured video is being saved. You can continue to capture videos until the camera's memory (either 8GB or 16GB, depending on model) is full of unsaved video frames. The most recent unsaved captured video is saved first.

You select the Save Mode in the Settings modal, as shown in Figure 1.

Figure 1: Setting tab showing Save Mode

Auto mode

Auto is the default camera Save Mode setting. Out of the box, a new edgertronic camera is pre-configured to allow you to trigger the camera and then the camera encodes the captured frames into a video file and saves the file to the SD card. This is a simple use model to understand and works well when learning to take high speed videos.

The simplest camera operation is continuously filling the pretrigger buffer with video frames while waiting for a trigger event. Once triggered, the camera fills the post trigger buffer and automatically saves the captured frames to a file. When Shot Count (When multi-shot is enabled), the camera repeats the pretrigger fill, trigger, post trigger fill process until all buffers are filled, then automatically saves each captured video one by one. In either case, once the camera is configured, the user control is simply to create a trigger event. With multi-shot, an additional user control is to request the captured buffers be saved without having to fill all the multi-shot buffers. This mode of operation is called auto-save. With a Shot Count greater than one, additional user controls are available as described below.

Auto allows you to capture several videos back to back and then save them. This is useful for capturing events where live preview is important, like when the camera focus needs to be adjusted between triggers. When capturing, the Web UI displays the frames being captured. When saving, the Web UI display the frames being saved.

Setting the Shot Count

Frame rate, duration, and resolution settings effect how many videos you would can take in one burst before saving the captured video frames. A 16GB DDR memory camera can hold twice as many unsaved frames as an 8 GB DDR memory camera. The camera defaults to Shot Count set to one. To find out how many videos can be captured before the camera fill all available frame buffer memory, clear the Shot Count field in the Settings tab and press the tab key. The actual column will be updated to display the maximum number of videos that can be captured using the current settings before the camera DDR memory is full.

Capturing videos

Trigger the camera as normal. As long as there is another video capture buffer available, you can immediately trigger the camera again after the camera has filled the post-trigger buffer. Once all available buffers have been filled (as set via Shot Count), the camera will automatically starting saving all the captured video frames. This may take a few minutes so sit back and relax.

Cancelling trigger

If you have triggered the camera and decide you do now want to keep the video, you can cancel the trigger so the capture buffer currently being filled will be available to hold frames from another trigger. Cancel the trigger while the post-trigger buffer is being filled by pressing the red X in the button box in the Web UI.

Discarding all unsaved video data

If one or more trigger events occurs and you do not want to save the captured video data, invoke press the wrench in the button box to bring up a dialog and confirm you want to discard all unsaved videos.

Saving captured videos

When all capture buffers have been filled, the camera will automatically start saving the captured video frames in each buffer. The video from each capture buffer is saved to a different file, as well as the metadata file associated with the video being saved. When saving a captured video, each filename will also contain the trigger number, such as for the third trigger, the filename might be slomo_1413060071_3.mov. If you have triggered one or more video captures and want to save them without having to fill all the rest of the capture buffers, you can press the blue save icon in the button box.

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 by pressing the orange trim icon in the button box. If there is another captured video that hasn't been saved yet, then after the camera finishes trimming the current video, it will automatically start saving the next unsaved video. You can again trim the next video being saved. If you want to also trim the front of the captured video before saving, then set the Save Mode to Review before save.

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 by pressing the red X icon in the button box and confirming you want to discard the rest of the unsaved videos.

Downloading saved videos

You can download the saved video files by browsing to the storage directory and clicking on the video or metadata file you want to view.

For SD card storage, browse to:

For USB storage, browse to:

Get directory listing:

Get the last saved video filename:

replacing 10.11.12.13 with your camera's IP address as necessary.

For default file naming, the video files will all have the same prefix but the end of the video will have a number ranging from 1 to X (the number of videos you took with the multishot function).

Another easy way to download videos to a Linux, Mac or Windows PC is to use WebDAV.

Review mode

You can review a video before saving, allowing you to trim the uninteresting beginning and end of your captured video. There are also some settings you can change after the video has been captured, including ISO and the text that is overlaid on each video frame. You can even save the same video multiple times, selection different regions to save.

Another camera mode of operation is review. The user can capture one or more videos, then review each a video setting the starting and ending frame for selective saving a region of the video. Once the user is done reviewing and saving selected regions of the captured videos, the user can again run the camera to restart the pretrigger fill, trigger, post trigger fill process. In the review mode of operation, the camera allows videos to be reviewed after all multi-shot buffers are filled instead of automatically saving all captured frames for all captured videos. In a similar way, with multi-shot enabled, an additional user control is to allow the captured buffers be reviewed without having to fill all the multi-shot buffers.

Examples of when review then save mode can be useful include:

  • Immediate viewing: In some cases you might not want to save the frames at all. Instead, you may want to view the video frames as soon as possible then take action based on what was observed. Example of this include adjusting camera settings before taking the real high speed video, using high speed videography to improve your golf swing or verify a piece of equipment being manufactured is operational.
  • Selecting a region of capture video to save: When reviewing a captured video, you can pick the starting and ending frames to save so your high speed video files only contain the portion of the capture video that is of interest.
  • Imaging processing: The edgertronic high speed camera can be viewed as a video source (really a source of image frames), allowing the imaging processing software to receive, via the camera's network connection, a series of video frames.

When the camera is set to review then save mode, you can review the captured video, saving just the portion of the video that is of interest.

CAMAPI support for review before save

Figure 2: Camera state machine with REVIEW

Review and selective save are supported by the camera by means of the REVIEW state in the camera's state machine, as shown to the right.

Enabling review mode

When invoking the run() CAMAPI method, include the requested_review key set to true in the requested settings dictionary. The camera will not autosave when review is enabled, instead the camera will go into the REVIEW state when all configured multishot buffers have been filled or when the review_frame() CAMPAI method is invoked.

Controlling frames being reviewed

When the camera is in the REVIEW state, the review_frame() CAMAPI method allows the camera to be configured to read out captured video frames at a specified rate, from the specified start frame to the specified end frame. The review() method also allow you to control if you want the camera to continuously loop, sending the selected region of frames over and over. If you want to lock step control the camera so you get exactly one frame per review() invocation, set the start and end frame to the same value and the frame rate to zero.

Saving reviewed video

When you ready to save a captured video and the camera is in the REVIEW state, use the selective_save() CAMAPI method. When the save is complete, the camera will return to the REVIEW state.

Capturing new video when review is complete

When you no longer need the captured video frames and want to capture new video, invoke the run() CAMAPI method.

Web UI support for review before save mode

The captured video review feature can be enabled or disabled using the camera's Web UI. When disabled, the camera automatically saves captured videos when the configured number of multishot buffers are filled. When review is enabled, the camera does not automatically save videos. Instead, after one or more videos have been captured to multishot buffers, a review bar is shown below the video window. The review bar has two markers, one for setting the starting frame and the other to set the last frame. As long as you have are dragging one of the markers, the frame associated with that marker position is displayed.

You can also select which captured video to review by setting the multishot buffer value.

Once you have set the starting frame and end frame markers, you can save the selected region by pressing the save icon. The filename of the video, and associated metadata file, is modified to include the start and end frame number. This allows you to save different segments of a the same captured video buffer to different files. An example would be a captured video buffer containing two lightning strikes. You might save the first lightning strike to one file and save the second lightning strike to another files.

When you are done reviewing the videos, you can discard all captured video frames and capture more videos by clicking on the run icon.

When Review before saving is enabled, a subset of the camera settings can be modified to adjust the video being saved. Settings which only change the processing of frames, stored in memory, can be modified before saving a video. For obvious reasons, settings that change how frames are captured into memory, can't be changed during review before saving.

Web UI support for Save configuration when review before saving is enabled

CAMAPI support

configure_save() method

When the camera is in the CAMAPI_STATE_REVIEWING state, the CAMAPI configure_save() method can be invoked to change the following settings:

Setting
force_monochrome
gamma_correction
pipeline
notes
overlay_notes
overlay_logo
overlay_settings
overlay_frame_number

Similar to configure_camera(), the CAMAPI configure_save() method accepts a dictionary containing zero or more of the above settings and returns the full allowed dictionary just like configure_camera. The differences between configure_camera and configure_save() is configure_save() can only be invoked when the camera is in the CAMAPI_STATE_REVIEWING state and only a subset of the support camera configuration settings can be modified.

CAMAPI example

    import hcamapi
 
    fn = 'selective_save_with_configuration'

    requested_settings = {
       'requested_iso':100,
       'requested_exposure':1/500.0,
       'requested_frame_rate':30,
       'requested_horizontal':1280,
       'requested_vertical':720,
       'requested_subsample':0,
       'requested_duration':4,
       'requested_pretrigger':10,
       'requested_multishot_count':1,
       'requested_smart_calibrate':1,
       'requested_genlock':1,
       'requested_review':1,
    }

    save_settings = {
        'requested_force_monochrome': 1
        'requested_gamma_correction': 1
        'requested_pipeline': 'H264LOW:pipelines_factory.txt'
        'requested_notes': 'Selective save with overlays'
        'requested_overlay_notes': 1
        'requested_overlay_logo': 0
        'requested_overlay_settings': 1
        'requested_overlay_frame_number': 1
    }
    
    print "Multishot capture with review and selective save"
    print "    Calibrating camera using allowed settings"
    allowed_settings = cam.configure_camera(requested_settings)
    ret = cam.run(allowed_settings)
    if ret == CAMAPI_STATUS_OKAY:
        print "    Run started"
    else:
        print "    Error: run() returned %d" % ret
        sys.exit(1)

    cam.wait_for_transition("Waiting for pre-trigger buffer to fill", CAMAPI_STATE_RUNNING, 10)
    cam.expect_state(CAMAPI_STATE_RUNNING_PRETRIGGER_FULL)

    print "    Triggering camera"
    ret = cam.trigger()
    if ret == CAMAPI_STATUS_OKAY:
        print "    Camera triggered, filling post-trigger buffer"
    else:
        print "    Error: trigger() returned %d" % ret

    time.sleep(1) # takes camera time to process the trigger request
    cam.wait_for_transition("Waiting for post-trigger buffer to fill", CAMAPI_STATE_TRIGGERED, 10)
    cam.expect_state(CAMAPI_STATE_REVIEWING)

    allowed = cam.configure_save(save_settings)
    
    ret = cam.selective_save({'buffer_index':0, 'start_frame':-1, 'end_frame':1, 'filename':fn})
    if ret == CAMAPI_STATUS_OKAY:
        print "    Selective save complete to file %s.mov" % fn
    else:
        print "    Error: selective_save() returned %d" % ret
    cam.wait_for_transition("Waiting for save to complete", CAMAPI_STATE_SELECTIVE_SAVING, 20)
    retrieve_video_file(cam, cam.get_last_saved_filename())

Background mode

High-speed video cameras typically capture videos at a faster rate than they can be processed. The edgertronic family of high-speed cameras include an internal memory (8 or 16GB), used to hold the captured videos until they can be encoded and saved to the storage device.

Background (FIFO) and Background (LIFO) save modes allow you overlap the capture of new videos, while in the background, the camera encodes and saves previously captured videos. As each video encode/save is completed, that portion of the internal memory is freed up for a new video. As long as sufficient internal memory exists, you can continue to trigger and capture new videos. If the internal memory becomes full, triggering will be temporarily disabled until the current video save completes. Background (FIFO) saves the oldest unsaved captured video first. Background (LIFO) saves the most recent unsaved captured video first.

If you are capturing regular events, such as a baseball pitches, you can focus on capturing the events of interest, with the camera encoding and saving the videos in the background. If your camera has sufficient internal memory, and as long as you don't over-run that memory, you will always be able to trigger.

CAMAPI support for save mode

Auto save mode, review before save mode, and background save mode are supported by camera configuration settings, the camera state machine, and camera status information that can be retrieved.

The active save mode is set when invoking the run() CAMAPI method, by including in the requested settings dictionary the requested_save_mode key set to 0 for auto, 1 for review, and 2 for background save mode.

There are several dictionary keys in the camstatus dictionary returned by calls to the get_camstatus() CAMAPI method:

Key Value
data type
Example
value
Description
save_state integer 1 - idle
5 - saving
9 - interrupted
State of the saving state machine. If there is no captured video to be saved, the state will be idle and the save_buffer, save_level, and save_time will be meaningless. Interrupted means more video file storage (SD card, USB storage, or network storage) is needed to finish saving the captured videos.
save_buffer integer 1 The number of the buffer being saved. The first buffer captured after a call to run() is buffer number 1.
save_level integer 0 .. 100 The percentage saved of the save_buffer video.
unsaved_count integer 7 Number of captured buffers that have not been saved.
save_time integer 4 Approximate number of minutes for all of the unsaved videos to saved. Applies to the current video being saved in review before save mode or all the captured, but not yet saved videos in auto save mode or background save mode.

Implementation details

  • The metadata file contains items that refer to the video captured to the buffer. This includes the camera settings, and the capture information capture buffer number, frame count, pre-trigger frames, trigger time, and trigger delay. Be aware that a selective save may mean the file doesn't contain the trigger frame.
  • For selective save, two additional metadata values indicate which region of the captured video buffer was saved in the file. These two fields are first saved frame and last saved frame.
  • To allow different regions of the same captured video buffer to be saved to files, videos saved using selective save will include the first and last saved frame in the filename in the form:

slomo_$EPOC_$BUFFER_frames_$START_to_$END.mov.

  • The start frame number and end frame number are index based on the trigger frame being frame 0. This means the start and end frames will be negative numbers if the frames of interest occurred before the trigger event.
  • Using selective save, the user can save the same captured video multiple times; changing some of the settings as needed, such as once with overlays on and again with overlays off.