Skip to content
This repository was archived by the owner on May 25, 2022. It is now read-only.

Retrieving Camera Data

Ryan Dailey edited this page Feb 27, 2017 · 30 revisions

![Iteration 1.png](https://github.com/luyunghsiang/NetworkCameras/blob/master/WikiImages/Combining scripts/Iteration 1.png)

##Problem Statement:

Multiple programs are currently used to retrieve data from given camera(s) and store it in certain formats. These singleton programs are namely: archiver.py, archiver_url.py and StreamDownloader.py.

##Aim:

To combine multiple data retrieval programs that gather camera data. Creating a wrapper function to encapsulate these singleton programs would make data retrieval much more easier for the end user.

##Solution:

Our proposed solution is to create a single merging program that handles all required inputs and stores output according to user’s choice. This wrapper function would be able to handle any input given by the user and use a suitable data retrieval program.

We decided to use an CSV file with a well defined name and columns in the file for taking inputs from the user. The CSV file should be in the same directory as the wrapper and if it is not present we provide an option to the user to create this file for him (with the specified columns). The column data of this CSV file would allow the wrapper function to choose the necessary data retrieval program for any given operation, thus providing ease of use. Refer to the description header of each data retrieval program to understand the functionality of each program.

##What the wrapper function does:

It reads the excel file and checks required output type. If it is a video it reads the columns corresponding to StreamDownloader’s requirements and passes them to the function. If this process cannot be completed or camera does not support video, appropriate error messages are displayed.

If the output type is an image it looks for camera id to check whether it is in the CAM2 database. If it is present in the database it retrieves information using archiver.py and uses the CAM2 database. It passes required inputs for the program from the excel file and reports an errors along the way. If the camera is not in the database, it checks the url field of the the excel file and passes the required information to archiver_url.py.

If all the inputs and required information are obtained then the program asks the user for confirmation to proceed and the output file name. It then begins data collection and stores data in the required output folder providing feedback to the user at regular intervals if required.

Required information for each file:

###Program 1:

archiver.py : python archiver.py <camera_id> <is_video>

Sr no: Input Argument Description
1. camera_id is the camera ID in the database.
2. is_video is 1 for a MJPEG stream, 0 for a JPEG stream.
3. duration is the archiving duration in seconds.
4. interval is the interval between two frames in seconds (or 0 for the maximum frame rate possible).

###Program 2:

archiver_url.py: python archiver.py <input_file>

Sr no: Input Argument Description
1. input_file is the path to the two-column space-separated input file. The first column is the integer camera ID, and the second column is the camera URL.
2. duration is the archiving duration in seconds.
3. interval is the interval between two frames in seconds (or 0 for the maximum frame rate possible).

###Program 3:

StreamDownloader.py: python StreamDownloader.py <runtime (secs)>

Sr no: Input Argument Description
1. url A link to a camera stream
2. filename an output filename without extension
3. runtime (secs) a desired runtime
4. fps the desired output frames per second.

##Temporary Planned Layout of CSV file:-

![temporary_CSV_filelayout.JPG](https://github.com/luyunghsiang/NetworkCameras/blob/master/WikiImages/Combining scripts/temporary_CSV_filelayout.JPG)

Clone this wiki locally