{"id":19082248,"url":"https://github.com/waikato-datamining/video-frame-processor","last_synced_at":"2026-03-04T03:32:10.734Z","repository":{"id":62587407,"uuid":"326800047","full_name":"waikato-datamining/video-frame-processor","owner":"waikato-datamining","description":"Python 3 library to make video frame processing easier.","archived":false,"fork":false,"pushed_at":"2024-12-20T00:46:59.000Z","size":16,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-11-19T00:27:59.869Z","etag":null,"topics":["opencv-python","python3","video-processing"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/waikato-datamining.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.rst","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-01-04T20:28:11.000Z","updated_at":"2025-04-21T15:30:46.000Z","dependencies_parsed_at":"2024-11-09T02:42:47.844Z","dependency_job_id":"5a973e13-f121-48f5-87f8-fdbd154d7bae","html_url":"https://github.com/waikato-datamining/video-frame-processor","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/waikato-datamining/video-frame-processor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waikato-datamining%2Fvideo-frame-processor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waikato-datamining%2Fvideo-frame-processor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waikato-datamining%2Fvideo-frame-processor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waikato-datamining%2Fvideo-frame-processor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/waikato-datamining","download_url":"https://codeload.github.com/waikato-datamining/video-frame-processor/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waikato-datamining%2Fvideo-frame-processor/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30070762,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-04T03:25:38.285Z","status":"ssl_error","status_checked_at":"2026-03-04T03:25:05.086Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["opencv-python","python3","video-processing"],"created_at":"2024-11-09T02:42:42.958Z","updated_at":"2026-03-04T03:32:10.705Z","avatar_url":"https://github.com/waikato-datamining.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# video-frame-processor\nPython 3 library to make video frame processing easier.\n\nIt allows processing video from webcams or video files, \nwith the user only having to supply a method that processes\nthe actual video frames. Everything else is handled by the\nlibrary.\n\n## Installation\n\nInstall via pip:\n\n```\npip install video_frame_processor\n```\n\n## Usage\n\nThe `vfp.Processor` class is used for processing frames from a webcam or from a video file.\nUnder the hood it uses opencv for obtaining the frames (type: `numpy.ndarray`).\n\nThere are two main methods available from the `Processor` class:\n* `process` - for processing frames from a video\n* `query` - for obtaining information about a video (e.g., width, height, fps, codec)\n\nBoth methods take either the webcam ID (integer, typically 0 if there is a webcam available) \nor the path to the video file to process.\n\nThe actual processing of a frame happens with a user-supplied method, which takes the following\narguments:\n* `processor` - the `Processor` instance that called this method\n* `frame` - the frame image (`numpy.ndarray`)\n* `frame_no` - the frame number (`int`)\n* `pos_msec` - the position in milli-seconds (`float`)\n\nThe following configures the processor to process every 10th frame, a maximum of 2000 frames\nto be read from the video source altogether and to be verbose with the output:\n\n```python\nfrom vfp import Processor\n\np = Processor(nth_frame=10, max_frames=2000, verbose=True)\n```\n\nThe `params` variable of a `Processor` instance allows storing of additional parameters\n(e.g., the `cv2.VideoCapture` instance is available as `video_capture` and the video information\nis available as `info`). \n\nThe following examples shows a processing method that simply stores the images using the timestamp \nas file name in the `/tmp` directory. The output directory is made accessible via the `output_dir` \nvalue of the `params` variable. It uses the first webcam as video source:\n\n```python\nfrom vfp import Processor\nfrom datetime import datetime\nimport cv2\n\ndef save_frames(processor, frame, frame_no, pos_msec):\n    ts = datetime.utcfromtimestamp(pos_msec / 1000.0).time().strftime(\"%H%M%S.%f\")\n    cv2.imwrite(processor.params.output_dir + \"/\" + ts + \".jpg\", frame)\n\np = Processor(nth_frame=10, max_frames=2000, process_frame=save_frames, verbose=True)\np.params.output_dir = \"/tmp\"   # used by the \"save_frames\" method \np.process(webcam_id=0)\n```\n\nFor processing the video `/some/where/video.mp4`, the call would look like:\n\n```python\np.process(video_file=\"/some/where/video.mp4\")\n```\n\nFor custom clean-up operations, once the video has been processed, you can supply\na method with the following signature:\n\n* `processor` - the `Processor` instance that called this method\n* `video_capture_opened` - whether the opening of the video source was successful (`bool`)\n\n\n## Custom logging\n\nBy supplying a method to the `logging` property, you can customize the logging\nthat occurs via the `info`, `debug` and `error` method calls of the Processor. \nThe example below uses the Python logging framework.  \n\n```python\nfrom vfp import Processor, LOGGING_TYPE_DEBUG, LOGGING_TYPE_ERROR\nimport logging\n\n_logger = None\ndef custom_logging(*args):\n    global _logger\n    if _logger is None:\n        logging.basicConfig()\n        _logger = logging.getLogger(\"vfp\")\n        _logger.setLevel(logging.DEBUG)\n    str_args = [str(x) for x in args]\n    if type == LOGGING_TYPE_ERROR:\n        _logger.error(\" \".join(str_args))\n    elif type == LOGGING_TYPE_DEBUG:\n        _logger.debug(\" \".join(str_args))\n    else:\n        _logger.info(\" \".join(str_args))\n\np = Processor()\n# ... setting more options\np.logging = custom_logging\np.output_timestamp = False # the Python logging framework should handle that instead\np.process(webcam_id=0)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwaikato-datamining%2Fvideo-frame-processor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwaikato-datamining%2Fvideo-frame-processor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwaikato-datamining%2Fvideo-frame-processor/lists"}