Usage
The Process
The Basic Trimmer is split into two portions - Part 1: Getting the Trim Points and Part 2: Trimming the Videos.
In Part One, you will navigate through your video and select the specific points that you would like to trim. You will also be able to type in a label for these clips that will correspond to what the clip will be named after being trimmer. This part will output a metadata file containing all of data that you just collected (trimming start/end points, labels). This file will then be used in part 2.
In Part Two, the metadata will be taken in along with the video and the trimmed clips will be saved.
Part 1: Getting the Trim Points
Step 1. Run “basic_trimmer.py”. When the GUI opens up, it should look like the following:
Step 3. Click “Next Video” to load in the first video you are going to trim.
Your screen should look like the following
Step 4. Click to change these properties.
Change the properties of the video by clicking on each box and typing in the appropriate information
These properties will be used to name the output of this script (the metadata). The “Preview output prefix” shows what the file name will look like. As shown, all but “User Initials” will be used. However, the user initials will be saved in the metadata file so that, if needed, the person who edited the file can be found.
Step 6: Click “Get trim points”
Starting from your current frame, the script will load 2-minute trials separated by 2 minute intervals. This should correspond with the start/end of the trials in your video
Step 7: Adding Trim Points
Click “GOTO” to jump to the appropriate “Trim Start” point
Scroll/use frame buttons until you find the end frame of interest. In this example, it is when the reward is introduced. The trial starts (as seen above) at 10:16. The end frame of interest occurs at 10:54
Once you have navigated to the ending frame of that trial, Click the appropriate “Trim end” white box. Your current frame timestamp will replace the previous one
Click the appropriate “Add trim pts Label” to type in your label
These labels will be used to name the clips once they are saved. For example, if you are clipping a portion of trial 3 from 10:16 - 10:35 and typed in the label “pre_rew”, then the subsequent trimmed clip may be saved as “mouse01_D01_t03_pre_rew”
Click the “+” button to add the trim point to the list at the bottom.
Notice that the current frame moves from the end to the start, and that the end now has the original ending point. This is so that the next trim point can be found after this clip.
To record the start time of the next clip, navigate to the desired starting frame using the scroller/buttons and then click the appropriate “Trim start” white box.
Repeat this process as needed within a trial. If all the time is used (trim start > trim end), then the text will appear red
Put together, here is how to add a trim point
Step 8: Click Save
This will save all of the trim points, trials, and labels that you indicated (as displayed in the “Trim Points” box) The script will print all of the information that was saved in the “Output” box. To confirm, within your “test_folder” there should be a “clips” folder that contains your metadata, an excel file, and NumPy files containing relevant trim point information
You can now exit out of the GUI!
Part 2: Trimming the Video
Step 1. Run the “ffmpeg_trim.py” script
Select the metadata.yml file that was saved in Part 1. This will tell the script what to clip/save videos as.
Step 2. Allow the script to run
As it does, you will see your clips appear in the “clips” folder
When it is done, the terminal should print “Finished all trimming” The trimmed clips should now be found in the “clips” folder. Yay!
Congrats! You have now finished trimming your videos!

