This python file cuts a video clip based on human-written instructions inside the FinalCut Pro video editor.
See Jupiter notebook text_to_video_edits.ipynb for detailed presentation.
- Text to video edits - FinalCut Pro
In a fast-paced TV/Film production environment Video Editors often receive Editor's notes in a text format. The notes would normally specify which parts of a video clip to leave and which to delete in a free form like:
00:01:02 good shot from here... to here 00:03:35
4:05 include this until 5:56
In the case of Documentary films or long interviews, the length of the footage and hence the notes can be very long.
Instead of manually selecting these clips in Video Editing Software or copy-pasting the timecode one timecode at a time this script automatically edits a single compound clip inside FinalCut Pro based on Editor's notes, therefore, increasing productivity, precision, and eliminating mistakes.
I first created this workflow when I was Directing and Video Editing TV mini-series. Since deadlines were extremely tight I was looking at every opportunity to speed up the delivery times while maintaining high quality. This solution fits my workflow very well and has proven to be very useful.
It was originally built simply by using a stack of regular expressions executed in the TextSoap.app along with some operations in Excel and copy-pasting the code manually. Later most of the steps were combined in a single Python script that is presented here.
Python 3.9.4
pandas 1.2.5
data analysis and manipulation toolre
integrated regular expression operations moduleos
a portable way of using operating system dependent functionality
- Download
text_to_video_edits.py
file from this GitHub repository. - Install
pandas
module for Python. You can try it with Terminal apр through downloading and installing Anaconda. It will containpandas
- (Optional) Download and install the latest version of Python. It will include Python Launcher.app to easily execute python scripts.
In FinalCut Pro create a new project and load clips into the timeline. Here I am duplicating the same clips to make the project over one hour long.
Now Select all
, choose File -> New -> Compound Clip
, and make at least one cut of the newly created compound clip.
Choose File -> Export XML
. Rename it to clip.fcpxml
and save it in the same folder with text_to_video_edits.py
file.
Write instructions on how you want to cut the clip. The text:
- Must contain at least two timecodes in the same line either in
hh:mm:ss
ormm:ss
format. - May contain text which will be discarded.
- Lines with less than two timecodes will be discarded.
- Lines with more than two timecodes will use the first two and discard others.
Here is a sample used in this project:
00:25 Starts speaking here… Ends speaking here 01:02
02:38 Leave this part - Nice action after 3 seconds. Ends here 03:7
the beginning is at 04:17 up to 4:31 including the action
this line without timecode will be discarded
this line with a single time code 05:48 will also be discarded
from 1:4:40 to 01:4:48
As you can see the formatting can be quite loose.
Paste the text into a text editor, then save it as videoedits.txt
, and move the file into the same folder with clip.fcpxml
and text_to_video_edit.py
.
Before proceeding with the next step make sure you have pandas
(Anaconda) installed.
Open Terminal.app. Type python
, add space
, then drag and drop text_to_video_markers.py
and press Return
.
Alternatively, you can install the latest version of Python. Right-click on text_to_video_markers.py
file and choose Open with -> Python Launcher.app
.
Either method will run a python script and create export.fcpxml
file in the same folder.
Select newly created export.fcpxml
file and Open with -> FinalCut Pro
. Upon opening choose the original library, then Keep Both
. This will create the second project with the your_original_name_1
that will include all the edits specified in videoedits.txt
.
That's it! We have just automatically edited a compound clip inside FinalCut Pro based on human-written text instructions.
The project is: complete I am no longer working on it since I am not working for TV any longer. But if you have some ideas or want me to modify something contact me and we should be able to collaborate.
- Tested on Mac OS only.
- The script only runs with
pandas
module (Anaconda) installed. - Input files must be named
clip.fcpxml
andvideoedits.txt
. videoedits.txt
file must contain at least two timecodes in the same line.- The
clip.fcpxml
project must contain one or more compound clips. - The compound clip must have one or more cuts.
- All three files (
text_to_video_edits.py
,clip.fcpxml
,videoedits.txt
) must be located in the same folder.
- Testing and logging the issues.
- Adding support for cutting a single clip (as opposed to a compound clip).
- adding support for cutting multiple distinct compound and regular clips.
- Making an executable file without the need to install
pandas
(Anaconda). - Developing GUI to be able to specify
.txt
and.fcpxml
input files with any name and location. - Building a web app.
- Designing a report listing the lines (with less than two timecodes) that have been discarded.
- Designing error message when end timecode is smaller than start timecode.
This project is open-source and available under the GNU General Public License v3.0
Created by @DmytroNorth - feel free to contact me at dmytronorth@gmail.com!