Skip to content

a tool for dynamically cropping a person in a video based on specified parameters

Notifications You must be signed in to change notification settings

AteltaAI/DynamicCropper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

DynamicCropper

DynamicCropper is a Python library that allows you to dynamically crop a person in a video based on various parameters.

TODOs

This section outlines the tasks and improvements planned for the DynamicCropper project.

  • Improve performance for large video files.
  • Add threading to operations.
  • Create verbose control.
  • Better outputs and error prints.
  • Logger.
  • Better file structure.
  • Add better requirements.txt

How to Use

Step 1: Clone the Repository

Clone the repository to your local machine using the following command:

git clone https://github.com/AteltaAI/DynamicCropper.git

Step 2: Create a Test File

Inside the repository folder, create a new Python test file (e.g., test_cropper.py). You can use the following example code in your test file:

from dynamic_cropper import DynamicCropper

cropper = DynamicCropper(
    frame_interval=10,
    size_aware=True,
    only_object=True
)

# 'input_path' can be a youtube link or local video file path.
result = cropper.crop(
    input_path="https://youtu.be/GcZJMiHds3U",
    output_folder_path="output_folder"
)

Step 3: Run the Test File

Run the test file to see how DynamicCropper works.

python test_cropper.py

Showcase of Results

Original Clip

input-video.2.mp4

Test Video 1:

Code:

from dynamic_cropper import DynamicCropper

cropper = DynamicCropper(
    frame_interval=10,
    size_aware=False,
    only_object=False
)

result = cropper.crop(
    input_path=rf"input-video (2).mp4",
    output_folder_path="output_folder"
)

print(result)

Output:

output_audio_false_false.mp4

Test Video 2:

Code:

from dynamic_cropper import DynamicCropper

cropper = DynamicCropper(
    frame_interval=10,
    size_aware=True,
    only_object=True
)

result = cropper.crop(
    input_path=rf"input-video (2).mp4",
    output_folder_path="output_folder"
)

print(result)

Output:

output_audio_true_true.mp4

Test Video 3:

Code:

from dynamic_cropper import DynamicCropper

cropper = DynamicCropper(
    frame_interval=10,
    size_aware=True,
    only_object=False
)

result = cropper.crop(
    input_path=rf"input-video (2).mp4",
    output_folder_path="output_folder"
)

print(result)

Output:

output_audio_trrue_false.mp4

About

a tool for dynamically cropping a person in a video based on specified parameters

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages