# Patent

## Title
System and method for preserving video clips from a handheld device

## Abstract

A system and method for recording video that combines video capture, touch-screen and voice-control technologies into an integrated system that produces cleanly edited, short-duration, compliant video files that exactly capture a moment after it has actually occurred The present invention maintains the device in a ready state that is always ready to capture video up to N seconds or minutes in the past (where N depends on available system memory). This enables the user to run the system indefinitely without having to worry about running out of storage. Touch gestures and voice commands actually initiate captures without having to actually monitor the system itself thereby allowing for complete focus on the live action itself. When the user sees something happen, he or she can use an appropriate voice or touch command to cause the system to create a video media file based on time points derived from the user's commands.

## Background
BACKGROUND
Field of the Invention
The present invention relates generally to video and more particularly to a system and method where a user can create a video clip of reasonable size from a handheld device using gestures, voice commands or virtual buttons.
Description of the Problem
The proliferation of mobile devices outfitted with on-board video cameras has caused many people to become a part-time videographers trying to capture on video the next viral video that will provide somebody their fifteen minutes of fame.
The difficulty with using current mobile video technology is that it requires a combination of good luck (right place, right time), patience (actively recording for large periods of time hoping something will happen) and skill (actually completing the capture and then editing it down to a manageably-sized video file that can consumed by an audience) to capture the “moments” everybody is interested in. More often than not, the best moments get missed—either because the user cannot initiate a capture in time, or because finding and extracting the relevant content out of a very large recording is too cumbersome and difficult.
SUMMARY OF THE INVENTION
Rather than relying on a planned (i.e. staged) or predictive (i.e. anticipating when something will happening and initiating a recording session) approach to video capture, the present invention relates to a reactive method for recording video that combines video capture, touch-screen and voice-control technologies into an integrated system that produces cleanly edited, short-duration, compliant video files that exactly capture a moment after it has actually occurred The present invention maintains the device in a ready state that is always ready to capture video up to N minutes in the past (where N depends on available system memory). This enables the user to run the system indefinitely without having to worry about running out of storage. Touch gestures and voice commands actually initiate captures without having to actually monitor the system itself thereby allowing for complete focus on the live action itself. When the user sees something happen, he or she can use an appropriate voice or touch command to cause the system to create a video media file based on time points derived from the user's commands:



DESCRIPTION OF THE FIGURES
The following drawings illustrate features of the present invention:
FIG. 1 shows a schematic diagram of an embodiment of the invention.
FIG. 2 shows a block diagram of the embodiment of FIG. 1.
FIGS. 3A-3D show buffer data structures used to perform captures.



Several drawings and illustrations have been presented to aid in understanding the present invention. The scope of the present invention is not limited to what is shown in the figures.
DESCRIPTION OF THE PREFERRED EMBODIMENTS
The present invention relates to a system and method for capturing video moments on a smartphone or other handheld device. It is not limited to handheld devices and will work with any electronic device or computer having a camera. The invention works by allowing the video camera to run while buffering the incoming video stream in a system of buffers. A user indicates by touch gesture or voice command when to start a clip. The length of the clip is typically preset to a certain number of seconds or minutes, and the clip typically starts N seconds or minutes before the user command is given. The invention can then receive metadata concerning the clip and create one of various types of standard video output files. In an alternate embodiment, the clip can start N seconds or minutes before a first user command and stop only upon receiving a second user command or after a predetermined maximum clip length is reached.
The present invention, rather than relying on a planned or predictive approach to video capture uses a reactive method for recording video that combines video capture, touch-screen, voice-control technologies into an integrated system that produces cleanly edited, short-duration, compliant video files that exactly captures a moment after it has actually happened.
The present invention places the device in a state that is always ready to capture video up to N seconds or minutes in the past (where N is a positive integer that depends on available system memory and can be set by the user). This enables the user to run the system indefinitely without having to worry about running out of storage.
The user relies on touch gestures and voice commands to actually initiate captures without having to actually monitor the system itself, thereby allowing for complete focus on the live action itself. When the user sees something happen, he or she can use the appropriate voice or touch command to cause the system create a video media file based on time points derived from the user's commands.
For example:
Tap Gesture: Actuates a user command to create a video file starting back N seconds (user configurable).
Press and Hold Gesture: Actuates a user command to create a video file starting back N seconds and ending when the user releases the hold gesture.
Voice Command: Can start a clip starting back N seconds or minutes, or attach a meta-data tag to video clip for automated classification.
The resulting video is automatically trimmed and tagged with metadata (time, location and user-defined tags) and immediately available for consumption (e.g. playback, social sharing).
Operation
The present invention uses a rolling frame buffer including a main buffer and a pre-roll buffer to provide unlimited operation against a finite amount of memory. On startup, both the main and pre-roll buffers are allocated in storage, typically disk storage or its equivalent, and left in a write-ready state. The system interacts with the video camera to store the video stream into the main buffer first. As the main buffer approaches capacity, the system switches to the pre-roll buffer without dropping video frames. The pre-roll buffer is designed to hold only a few seconds of video, just enough time for the main buffer to be closed and re-opened for writing (i.e. purged). If there are any pieces of the main buffer that need to be preserved based on a requested clipping action, those pieces are excised and preserved before the purge operation. When the main buffer is empty and ready, the system redirects the video stream back to the main buffer again without losing a frame thereby allowing the pre-roll to be flushed and be made ready again.
Because the rolling buffer is not flushed until the next time the main buffer reaches capacity, if a user triggers a capture at the start of the main buffer and it has to reach back into the rolling buffer, it can. The captures are generally small enough that they can be stitched back together very quickly before adding the resulting video clip to the library. It is important that pieces of buffers are kept until it is certain they are not needed as part of a capture before they are flushed and lost forever. This is done with reference counting that which is taking place at all times to ensure that any piece of buffered video that might be needed for a future capture is saved off prior to flushing.
The present invention uses a physically-backed buffer approach because the uncompressed video streams usually require too much memory to cover any significant amount of time, especially on a mobile device where battery life, cost and memory are at a premium.
Both the touch-screen and microphone are listening in parallel for input that will establish the start and end points needed to reconstruct a separate clip from the main buffer and possibly pre-roll buffer.
Turning to FIG. 1, a schematic diagram of an embodiment of the present invention can be seen. A user holds his smartphone or other handheld device 1 and the application (App) allows video to stream. The scene 3 is continually streamed into storage in the device 1. The scene 3 can also be seen on the touch screen 2. When the user realizes that an event has occurred that he or she desires to capture, either the virtual button 4 is touched, or a voice command is given through the microphone 5. A clip of N seconds (or minutes) is then extracted from the stored video and converted to a file for further use. The number N can be preset using a supplied setup menu.
FIG. 2 shows a block diagram of the embodiment. A processor 20 which typically resides in the handheld device 1 can be any type of processor capable of executing stored instructions. Examples include CPUs, MPUs and other processors typically found in smartphones. The processor 20 is electrically connected to storage 22 which can be any type of memory device including internal RAM, disk, flash or plug-in storage, or any other type of storage. Part of the storage 20 contains the executable instructions for downloading and running the App. The processor 20 is also electrically connected to various input/output ports 25 that allow a file 30 to be transferred. These include plug-in Universal Serial Bus ports 33 and other ports, WiFi access 31 and 3G-5G or greater cellular telephone access 32. The processor 20 is also electrically connected to a microphone 26 and a touch screen 23. A video camera 28 supplies electrical signals representing streamed video to the processor 20. The processor 20 executes stored instructions that read the touch screen 23 for touch commands 27 and interpret voice commands 26 from the microphone 24.
The user, upon seeing that a capture is desired, either touches a virtual button on the touch screen 23 executing a touch command 27, or issues a voice command 26 through the microphone 24. This causes the App's executing instructions to save a portion of the video that is N seconds (or minutes) previous to the command. The App. creates one of many different types of video files known in the art including wave files, flash video files, MPEG files and other standard files.
FIGS. 3A-3D show an embodiment of a buffering and counting arrangement that can be used with the present invention. A main buffer 30 typically receives incoming streaming video from the camera 21. A pre-roll buffer 31 remains empty until the main buffer has reached capacity. Video input than switches to the rolling buffer while the main buffer is purged.
FIG. 3A shows the situation where a user has placed a capture or clip mark 32 at a certain point in time in the main buffer. In this case, the main buffer contains the entire N seconds of the clip. The video in the clip region is removed from the main buffer and separately processed into an output file.
FIG. 3B shows the case where the main buffer is purging, and the entire clip region resides in the rolling buffer. This case is rare since typically, the rolling buffer is much smaller than the main buffer. In this case, the clip is removed from the rolling buffer for processing before the rolling buffer is over-written.
FIG. 3C shows the case where the end of the clip (the clip mark) is in the main buffer; however, the beginning of the clip is in the pre-roll buffer. Here the two parts of the clip must be stitched together to form an entire clip. This is done before the pre-roll buffer over-writes and before the main buffer is again purged.
FIG. 3D shows the opposite case where the clip mark representing the end of the clip is in the pre-roll buffer and the beginning of the clip is in the main buffer. Here, again both parts of the clip must be removed from the buffers and stitched together. This must be done quickly before the pre-roll buffer over-writes. Also, there must be enough time to purge the main buffer. The main buffer is typically purged by closing it and re-opening it using operating system commands under an Application Programming Interface (API).
The present invention can be used with any computing device, fixed or handheld. The preferred device is a smartphone with a camera and touch screen. The operating system can be any that supports streaming video such as IOS by Apple, Android which is open-source, Windows CE and Windows Phone 8, or any other operating system.
Several descriptions and illustrations have been presented to aid in understanding the present invention. One with skill in the art will realize that numerous changes and variations may be made without departing from the spirit of the invention. Each of these changes and variations is within the scope of the present invention.

## Claims

1. A video capture system including stored computer instructions configured to interact with a video camera, a touch screen, and a microphone on a handheld device, the stored computer instructions being stored in a memory device and executable by a processor causing incoming streaming video from the video camera to be stored sequentially frame by frame in at least one frame buffer, the instructions adapted to receive a user command from the touch screen or the microphone to save frames from N seconds of previous video streaming and convert these frames to a video output file, where N is a positive integer, wherein each of the frames saved from N seconds of previous video streaming are frames that were created before the user command;
and, wherein the frame buffer includes a main buffer that is purgable and a shorter pre-roll buffer of fixed length that overwrites when full, wherein the main buffer stores frames until a predetermined capacity is reached whereupon frames are stored in the pre-roll buffer only while the main buffer is purged;
and wherein, if there is are any frames in the main buffer to be preserved based on the user command, those frames are excised from the main buffer and separately stored before the main buffer is purged;
wherein, if a first saved frame is in the pre-roll buffer and a last saved frame is in the main buffer, all saved frames between the first saved frame and the last saved frame are stitched together to form a saved clip, the stitching being performed before the pre-roll buffer over-writes and before the main buffer is purged.

2. The video capture system of claim 1 wherein the user command is actuated by touching the touch screen.

3. The video capture system of claim 2 wherein the user command is a touch to a virtual button on the touch screen.

4. The video capture system of claim 2 wherein the user command is a tap gesture on the touch screen.

5. The video capture system of claim 2 wherein the user command is a hold and release touch to the touch screen, wherein the system begins to save frames from N seconds before when the user holds a portion of the touch screen and stops saving frames when the user releases the portion of the touch screen.

6. The video capture system of claim 1 wherein the user command is actuated by a voice command through the microphone.

7. An N second video capture system comprising:
a handheld device that includes:
a camera;
a touchscreen;
a microphone;

the handheld device also having a processor executing stored instructions that stores streaming video frames from the camera in a frame buffer, the instructions adapted to that recognize a user command from the touchscreen or the microphone, and upon receiving the user command save streaming video frames from the camera into a video output file starting N seconds before the user command, where N is a positive integer, wherein, each video frame saved was created before the user command;
and, wherein the frame buffer includes a main buffer that is purgable and a shorter pre-roll buffer of fixed length that overwrites when full, wherein the main buffer stores frames until a predetermined capacity is reached whereupon frames are stored in the pre-roll buffer only while the main buffer is purged;
and wherein, if there is are any frames in the main buffer to be preserved based on the user command, those frames are excised from the main buffer and separately stored before the main buffer is purged;
wherein, if a first saved frame is in the pre-roll buffer and a last saved frame is in the main buffer, all saved frames between the first saved frame and the last saved frame are stitched together to form a saved clip, the stitching being performed before the pre-roll buffer over-writes and before the main buffer is purged.

8. The video capture system of claim 7 wherein the user command is actuated by touching the touch screen.

9. The video capture system of claim 8 wherein the user command is a touch to a virtual button on the touch screen.

10. The video capture system of claim 1 wherein the user command is a tap gesture on the touch screen.

11. The video capture system of claim 8 wherein the user command is a hold and release touch to the touch screen, wherein the system begins to save frames from N seconds before when the user holds a portion of the touch screen and stops saving frames when the user releases the portion of the touch screen.

12. A video capture system for a smartphone having a processor, memory, a video camera, a touchscreen and a microphone, the system comprising instructions stored in the memory that execute on the processor causing the video camera to stream video frame by frame into a frame buffer in the a frame buffer in the memory; the instructions also recognizing a first user command from the touchscreen or microphone that causes sequential frames to be written from the frame buffer into an output file starting at a frame that was stored in the frame buffer N seconds, where N is a positive integer, before the user command continuing until either frames representing a predetermined number of seconds have been written to said output file or until a second user command causes said writing to stop, and wherein each frame written to the output file was created before the first user command;
and, wherein the frame buffer includes a main buffer that is purgable and a shorter pre-roll buffer of fixed length that overwrites when full, wherein the main buffer stores frames until a predetermined capacity is reached whereupon frames are stored in the pre-roll buffer only while the main buffer is purged;
and wherein, if there is are any frames in the main buffer to be preserved based on the user command, those frames are excised from the main buffer and separately stored before the main buffer is purged;
wherein, if a first saved frame is in the pre-roll buffer and a last saved frame is in the main buffer, all saved frames between the first saved frame and the last saved frame are stitched together to form a saved clip, the stitching being performed before the pre-roll buffer over-writes and before the main buffer is purged.

13. The video capture system of claim 12 wherein the first user command is a touch to a virtual button on the touch screen.

14. The video capture system of claim 12 wherein the first user command is a tap gesture on the touch screen.