Skip to content
clipDL downloads youtube videos at a youtubeID specified in a CSV file and clips them to the desired duration.
Python
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
README.md
TEST_dataset.csv
clip_DL.py
gpl-3.md
requirements.txt

README.md

clipDL

This tool was developed for the parsing, downloading, and clipping of the Aberrant Event dataset.

Installation and Execution

To use this tool, you must have youtube-dl and ffmpeg installed on your computer.

1.) Clone this repository via 'git clone https://github.com/alexmussa/clipDL.git'

2.) Install ffmpy (https://pypi.org/project/ffmpy/) and youtube-dl (https://ytdl-org.github.io/youtube-dl/download.html) manually following the links provided.

3.) Run the command:

cd ~/path_to/clone_location/clip-dl
python clip_DL.py [-h] [-f CSV_FILENAME] [-o {1,2,3}] FLOC DEST

FROM HELP:

positional arguments:
  FLOC                  Full path to the location of the CSV file.
  DEST                  Full path to the destination where clips are to be stored.

optional arguments:
  -h, --help            show this help message and exit
  -f CSV_FILENAME, --CSV-filename CSV_FILENAME
                        Filename of the csv, including the extension.
                        Default: 'AE_dataset.csv'
  -o {1,2,3}, --operation-mode {1,2,3}
                        1: Download full videos into a folder, 'temp', and clip into a folder, 'clips' at DEST.
                        2: Does the same as operation mode 1, but DELETES the temp folder. 
                        NOTE: Re-execution without temp folder will require full dataset download or stream (opmode 3).
                        3: Generate clips from a stream of the videos and only saves the clips.

Additional Information

Input CSV

The .csv file provided contains indicators as the what fields would go into each, such as thh youtubeID, the start minute, start second, stop minute, stop second, and the category (for naming purposes). To execute the download with the CSV, replace these prepopulate boxes with their appropriate attribute, save the csv, and use its file location in FLOC.

Filename Output

The file nameing of the output clips is as follows:

'YouTubeID_StartMinute_StartSecond_EndMinute_EndSecond_Category.mp4'

More on operation modes:

Operation Mode 1 - Directly downloads full-length videos from youtube into a foldaer called 'temp'. Once all downloads of every unique YouTube ID in the first column of the CSV file is completed, FFMPEG is called to clip the files to their appropriate clip lengths, specified by the CSV file columns 2-5.

Operation Mode 2 - Same as Operation Mode 1, but clears the temp folder after completetion. If you plan to change the CSV clipping times, this method is not recommended as a full redownload will be neccesary.

Operation Mode 3 - Starts by obtaining direct download link with youtube-dl and streams the video to FFMPEG for clipping.
Does not download the full length videos to a local location. If you plan to change the CSV clipping times, this method is not recommended as restreaming will be neccesary.

Version Notes:

Initial Release: First commit.

1.0: Added argparse for help menu support, fixed bug where yt-id starting with minus sign wouldnt download,
added an error log to record if subprocess.check_call() generates an error, added 3 Operation modes, added option to specify filename.

You can’t perform that action at this time.