Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

elaborate on examples #151

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,29 @@ recommended this to me. However, my pyinstaller build did not work. :( HELP

## Building with nix
`nix-build` to get a script with all the libraries and ffmpeg, `nix-build -A bundle` to get a single binary.

## Example Setup
using virtualenv
```
cd jumpcutter
virtualenv --python python3 env
source env/bin/activate
pip install -r requirements.txt
```

## Example Usage

### Jumpcut
regular speed for talking and 99,999,999% speedup during silence, original at 60fps
```python jumpcutter.py --input_file slow_meme.mp4 --sounded_speed 1 --silent_speed 999999 --frame_margin 2 --frame_rate 60```

### Lecture Speedup
bit faster talking and 500% speedup during silence, original at 60fps
```python jumpcutter.py --input_file dull_lecture.mp4 --sounded_speed 1.2 --silent_speed 5 --frame_margin 2 --frame_rate 60```


## Expectations
- Temporary files are placed in a new directory called 'TEMP'
- Default output file is `[file_name]_ALTERNED.[file extension]`
- Time to process a 6min video of 1346x904@60fps using H.264, AAC on a MacBookPro took 9min 45sec. Nearly *1:1.5 video to processing time*

6 changes: 3 additions & 3 deletions jumpcutter.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def copyFrame(inputFrame,outputFrame):
if not os.path.isfile(src):
return False
copyfile(src, dst)
if outputFrame%20 == 19:
if outputFrame%100 == 99:
print(str(outputFrame+1)+" time-altered frames saved.")
return True

Expand All @@ -56,10 +56,10 @@ def deletePath(s): # Dangerous! Watch out!
parser.add_argument('--input_file', type=str, help='the video file you want modified')
parser.add_argument('--url', type=str, help='A youtube url to download and process')
parser.add_argument('--output_file', type=str, default="", help="the output file. (optional. if not included, it'll just modify the input file name)")
parser.add_argument('--silent_threshold', type=float, default=0.03, help="the volume amount that frames' audio needs to surpass to be consider \"sounded\". It ranges from 0 (silence) to 1 (max volume)")
parser.add_argument('--silent_threshold', type=float, default=0.05, help="the volume amount that frames' audio needs to surpass to be consider \"sounded\". It ranges from 0 (silence) to 1 (max volume)")
parser.add_argument('--sounded_speed', type=float, default=1.00, help="the speed that sounded (spoken) frames should be played at. Typically 1.")
parser.add_argument('--silent_speed', type=float, default=5.00, help="the speed that silent frames should be played at. 999999 for jumpcutting.")
parser.add_argument('--frame_margin', type=float, default=1, help="some silent frames adjacent to sounded frames are included to provide context. How many frames on either the side of speech should be included? That's this variable.")
parser.add_argument('--frame_margin', type=float, default=12, help="some silent frames adjacent to sounded frames are included to provide context. How many frames on either the side of speech should be included? That's this variable.")
parser.add_argument('--sample_rate', type=float, default=44100, help="sample rate of the input and output videos")
parser.add_argument('--frame_rate', type=float, default=30, help="frame rate of the input and output videos. optional... I try to find it out myself, but it doesn't always work.")
parser.add_argument('--frame_quality', type=int, default=3, help="quality of frames to be extracted from input video. 1 is highest, 31 is lowest, 3 is the default.")
Expand Down