{"id":13825298,"url":"https://github.com/ExponentialML/Video-BLIP2-Preprocessor","last_synced_at":"2025-07-08T21:31:53.864Z","repository":{"id":151549476,"uuid":"617693292","full_name":"ExponentialML/Video-BLIP2-Preprocessor","owner":"ExponentialML","description":"A simple script that reads a directory of videos, grabs a random frame,  and automatically discovers a prompt for it","archived":false,"fork":false,"pushed_at":"2024-01-22T08:57:13.000Z","size":14,"stargazers_count":131,"open_issues_count":4,"forks_count":17,"subscribers_count":5,"default_branch":"main","last_synced_at":"2024-11-20T03:32:11.556Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/ExponentialML.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2023-03-22T23:03:09.000Z","updated_at":"2024-09-27T08:11:05.000Z","dependencies_parsed_at":null,"dependency_job_id":"0efb4fac-1c9b-4265-9464-645d4eb2bc75","html_url":"https://github.com/ExponentialML/Video-BLIP2-Preprocessor","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ExponentialML/Video-BLIP2-Preprocessor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ExponentialML%2FVideo-BLIP2-Preprocessor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ExponentialML%2FVideo-BLIP2-Preprocessor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ExponentialML%2FVideo-BLIP2-Preprocessor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ExponentialML%2FVideo-BLIP2-Preprocessor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ExponentialML","download_url":"https://codeload.github.com/ExponentialML/Video-BLIP2-Preprocessor/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ExponentialML%2FVideo-BLIP2-Preprocessor/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264352767,"owners_count":23594966,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-08-04T09:01:18.087Z","updated_at":"2025-07-08T21:31:53.578Z","avatar_url":"https://github.com/ExponentialML.png","language":"Python","readme":"# Video-BLIP2-Preprocessor\nA simple script that reads a directory of videos, grabs a random frame, and automatically discovers a prompt for it.\nThis makes unconditional/conditional video training easier to manage without manually prompting the differences in scenes.\n\n## Installation\n\n```bash\ngit clone https://github.com/ExponentialML/Video-BLIP2-Preprocessor.git\ncd Video-BLIP2-Preprocessor\npip install -r requirements.txt\n```\n\n## Running\n\n```bash\npython preprocess.py --video_directory \u003cyour path of videos (vid1.mp4, vd2.mp4, etc.)\u003e --config_name \"My Videos\" --config_save_name \"my_videos\"\n```\n\n#### If you wish to save the videos as individual clips, you can pass the `--clip_frame_data` argument like so:\n\n```bash\npython preprocess.py --clip_frame_data --video_directory 'videos' --config_name \"My Videos\" --config_save_name \"my_videos\"\n```\n\n## Results\nAfter running, you should get a JSON like this. You can then parse it any script that supports reading JSON files.\nHere is psuedo code of what your config may look like.\n\n```js\n{\n    \"name\": \"My Videos\",\n    \"data\": [\n        {\n            \"video_path\": \"./videos/video.mp4\",\n            \"num_frames\": 1000,\n            \"data\": [\n                {\n                    \"frame_index\": 134,\n                    \"prompt\": \"a person is riding a bike on a busy street.\",\n                    \n                    // When the argument --clip_frame_data is passed.\n                    // This is applied to all items in 'data', but shown once here as an example.\n                    \"clip_path\": \"./my_videos/a person is riding a bike on a busy street_134.mp4\" \n                },\n                {\n                    \"frame_index\": 745,\n                    \"prompt\": \"a person is wearing a blue shirt and riding a bike on grass.\"\n                },\n                ...\n            ]\n        },\n        ...\n    ]\n}\n```\n\n## Default Arguments\n```py\n--config_name, help=\"The name of the configuration.\", default='My Config'\n\n--config_save_name, help=\"The name of the config file that's saved.\", default='my_config'\n\n--video_directory, help=\"The directory where your videos are located.\", default='./videos'\n\n--clip_frame_data, help=\"Save the frames as video clips to HDD/SDD. Videos clips are saved in the same folder as your json directory.\", default=False\n\n--max_frames, help=\"Maximum frames for clips when --clip_frame_data is enabled.\", default=60\n\n--random_start_frame, \nhelp=\"Use random start frame when processing videos. Good for long videos where frames have different scenes and meanings.\", \naction='store_true', \ndefault=True\n\n--beam_amount, help=\"Amount for BLIP beam search.\", default=7\n\n--prompt_amount, help=\"The amount of prompts per video that is processed.\", default=25\n\n--min_prompt_length, help=\"Minimum words required in prompt.\", default=15\n\n--max_prompt_length, help=\"Maximum words required in prompt.\", default=30\n\n--save_dir, help=\"The directory to save the config to.\", default=f\"{os.getcwd()}/train_data\"\n\n```\n","funding_links":[],"categories":["Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FExponentialML%2FVideo-BLIP2-Preprocessor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FExponentialML%2FVideo-BLIP2-Preprocessor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FExponentialML%2FVideo-BLIP2-Preprocessor/lists"}