airnef logo

Precut - Adobe Premiere source edits without transcoding

This is the official homepage for Precut, my open-source utility for extracting only the portions of video you need from your source media files, allowing you to save storage space without any loss of quality from transcoding.

Unlike other video-file splitters such as MPEG Streamclip, Avidemux, and SolveigMM AVI Trimmer+MKV, Precut lets you use Premiere Pro for your culling. You perform your rough edits in Premiere Pro using all the standard editing tools you're already familiar with, then export your project using Premiere's File -> Export -> Final Cut Pro XML feature. Precut then uses the exported XML file to find all the edits you performed in Premiere, creating an individual clip for each edit or, more usefully, a combined video file that contains all the individual edits grouped together by track, sequence, or original source media file. For example, you can start with a 30-minute H.264 file, perform edits in Premiere to cull your video down to only the 5 minutes of footage you need, then have Precut produce a single video file containing only the footage included in your Premiere edits - without any loss of quality from transcoding.

Precut works on any platform that supports the Python interpreter, including Windows, Mac, and Linux. Precut is licensed under GPL v3.

Downloads

Dates
Ver
Change List
Python Source Code
06/03/2017
0.91
0.90 -> 0.91
precut_v0.91.zip
05/28/2017
0.90
N/A
precut_v0.90.zip

Description

Precut allows you take edits you performed inside an Adobe Premiere project and use them to prune your source media into much smaller files, containing only the portions of the video referenced in your edit. And it does does this without requiring any re-encoding or re-compression, which means no quality or generational loss.

The reason I developed Precut was to solve a storage issue in my video workflow. On my projects I typically have a large amount of source footage, from which I use only a small percentage in my final rendered video. When I'm done with a project I generally keep my source video, in case I ever need to go back and perform changes and re-render. But I don't want to keep all the source video - I only want to keep the portions used in my project. The problem though is my footage is contained across many source video files, and I may only use a small portion of each file. This requires me to retain the entire source file since Premiere doesn't provide a way to extract and keep only the portions of the media files I use. Actually Premiere does have a way to do this using their Project Manager. The problem with Premiere's Project Manager is that it requires you to transocde your source media files, which means not only a generational loss in quality due to recompression but also no real savings in storage space because Premiere uses a lightly-compressed codec for the transcoded files, especially compared to the typical H.264 files I use as my original video codec.

What I was looking for was the ability to cull or prune my source media files to save space, but without any loss of quality from recompression. There are some excellent utilities available that let you extract individual clips from your media files without recompression, including MPEG Streamclip and Avidemux. The problem with these utilities is that they have a relatively basic visual interface for performing edits. I wanted the ability to use Premiere's powerful and familiar editing facilities. And so I created Precut.

Precut lets you to take an Adobe Premiere exported project (FCP7 XML export) and generate video files from each of the edits within it. You can choose to create an individual video file for each edit, or, more usefully, create an individual file for each edit and then combine those individual files back into a single file containing all the footage you referenced in your edits and none of the footage you didn't. You then have the flexibility to delete your original source media files and use the files generated by Precut instead.

There are a few caveats. First, when working with inter-frame compression codecs like H.264/H.265, the files generated by Precut are not frame-accurate, at least if you choose to perform a lossless cut rather than a transcode. This is because Precut generates each clip by using the ffmpeg utility, which presently only supports extraction operations on keyframe boundaries. This means each of your edits may include a small amount of additional footage before your in-point and after your end-point, because ffmpeg will locate the nearest keyframe to those locations for its actual extraction points. Keep in mind the generated clip will never have less footage than what you specified, because ffmpeg will round the in-point down and out-point up, to their nearest keyframe boundaries.

Because the files generated by Precut wont be frame-accurate in this scenario, it is meant to be used early in the workflow of a project, where you cull through your source media to find the footage you think you'll use, before performing the actual edits related to your production. It is not meant to be used as a final-stage pruning after you've completed your final edit.

Another caveat is that ffmpeg doesn't appear to support retaining timecode when extracting video without transcoding, at least not for the types of H.264 files I use and tested it with.

One last point. I designed and tested Precut to work with Adobe Premiere because that's my NLE of choice. However, Precut accomplishes its work by ingesting a Final Cut Pro 7 XML file exported from Premiere (using File -> Export -> Final Cut Pro XML), which means Precut may also work with FCP7 project exports and also FCP X exports that have been converted to FCP7 XML via the third-party XtoCC app. Unfortunately I didn't have these apps on hands to verify that Precut will properly decode their FCP7 XML exports.

Precut is two applications - a GUI front-end (precut.pyw) and a command-line app (precutcmp.py). The GUI front-end allows you to visually enter common parameters, and then launches the command-line app to perform the actual work. You can optionally use the command-line app directly.

Installation

Windows

  1. Download and install the latest version of Python (link) - you can use either Python 2.x or 3.x. When you reach the customize page during installation, enable "Add python.exe to Path" (screen shot).
  2. Download the latest version of ffmpeg (link). Open up the zip file and if necessary, double-click one level until you see the list of ffmpeg directories (screen shot). Create a directory on your system drive such as 'c:\ffmpeg', then select all the directories in the zip file and drag them into 'c:\ffmpeg'.
  3. Download the Precut source zip file. Unzip it to a new directory on your system drive, in a directory such as 'c:\precut'. Do not place Precut inside 'Program Files' or 'Program Files(x86)' - precut needs write access to its own program directory due to a limitation in ffmpeg's file logging feature (Windows doesn't allow write access for regular users for executables inside the 'Program Files' directory tree).
  4. To run precut, double-click on the precut.pyw file. You can optionally create a shortcut to this file on your desktop/taskbar for easier access.
  5. Tell precut where to find the installed ffmpeg executable by entering 'c:\ffmpeg\bin' in the 'Directory of ffmpeg executable' field of precut's dialog (screen shot).

Mac/OSX

  1. OSX includes a version of Python already installed that is suitable for running Precut.
  2. Download the latest version of ffmpeg (link) - click 'Download as DMG' on the download page. Open a finder window to your '/usr/local/bin' folder by going to Finder and clicking Go -> Go To Folder on the menu and type '/usr/local/bin'. Open the downloaded DMG and drag the ffmpeg file into the /usr/local/bin folder.
  3. Double-click on ffmpeg inside the /usr/local/bin folder you copied it. You will receive an error from OSX indicating that the app can't be executed (screen shot). Go to System Preferences -> Security and Privacy. At the bottom of the window you'll see a message indicating ffmpeg was blocked from opening because it is not from an identified developer (screen shot). Click 'Open Anyway'. Double-click again on ffmpeg inside the /usr/local/bin folder. You will receive a final warning (screen shot) - click "Open". ffmpeg should execute, showing it's help menu to the terminal. You can close the window after it's done. ffmpeg is now enabled to run without warnings.
  4. Download the Precut source zip file. You can choose to put the contents of the zip in any folder but I suggest placing it under your home user folder. You can reach that folder by opening a Finder window and clicking Go -> Home in the menu. Double-click the precut zip file and drag the precut folder to your Home folder.
  5. Click into the precut folder you copied to your system and add ".command" to the filename of precut.pyw, so that it becomes precut.pyw.command. This will allow OSX to automatically execute precut in the necessary terminal environment whenever you double-click the precut.pyw.command file in the OSX Finder. You can then optionally create an alias to the file and drag it to the desktop to have a launch icon available to you without having to open the precut folder.

Linux

  1. Python comes per-installed for most Linux installations.
  2. Download the Precut source zip file. Unzip the precut folder to a directory of your choice. You may need to mark the Python files as executable, which can be done via "chmod +x precut.pyw" and "chmod +x precutcmd.py"

User's Guide

Performing edits in Premiere Pro and exporting the project

The first step is to perform the rough edits of your source material inside Premiere, and then export the project containing those exports to a Final Cut Pro XML file (File -> Export -> Final Cut Pro XML). You an either export the entire project (all sequences) by making sure no sequences are selected in the Project window prior to to performing the export, or export a specific sequence by selecting that sequence in the Project window prior to performing the export.

Precut processes the exported XML by reading each individual cut/edit, generating a new clip file for each edit. Precut can then optionally combine all the clip files it generates into single files, grouped by track (all edits from each individual track will be combined into a single file for each track), sequence (all tracks from sequence will be linearly combined, meaning all clips generated from the first track will be ordered first, followed by all edits from the second track, etc..), or source media (combines all clips that came from the same source file into a single file). You also have the option to keep the individually-generated clips without any combining.

There are some important things to keep in mind when laying out your rough edit in Premiere. By default Precut will generate its clips using ffmpeg's 'copy' codec, which allows it to extract sections of video without requiring it to re-encode/recompress the file. This allows you to maintain the original quality of your video without quality/generational loss. There are some inherent limitations to ffmpeg's copy codec that are important to note:

Here are some other important notes about Precut's processing of exported Premiere projects

Precut GUI

Click on any field in the graphic below to jump to the documentation for that parameter. You can then use your browser's back button to jump back to the graphic.

The GUI app (precut.pyw) provides a simple graphical front-end that simplifies the process of invoking the command-line utility (precutcmd.py). Each entry field of the GUI corresponds to a command-line option of precutcmd. To make handling multiple options faster and more convenient, the GUI remembers your most recent 50 choices for each option, which you can instantly recall by clicking the down-arrow of each option's list. For example, let's say you have 5-6 different output directories you use most often, and also 3-4 different ffmpeg video parameters - you can quickly recall each of these with a simple click.

Command Line Reference

precutcmd.py <Final Cut Pro 7 XML File> [optional args]

All argument names are case sensitive. You can abbreviate any argument provided you use enough characters to uniquely distinguish it from other argument names. For example, --sc in place of --scratchdir, if there are no other arguments that start with --sc.

When run with no options, Precut's default behavior is to generate clips using ffmpeg's 'copy' operation (no recompression), combining the generated clips into files group by source media (ie, all clips generated from edits of the same media file will be combined), and storing the combined clips into the same directory as the XML file.

<Final Cut Pro 7 XML File>
The XML file containing the project edits to process. This file is generated for an Adobe Premiere Project by going to File -> Export -> Final Cut Pro XML.

You may also try using a FCP7 XML generated from another app, such as FCP7 itself or FCP X project converted to FCP7 XML using the XtoCC app. Note that I didn't have these apps on hand to use so I have not tested precutcmd's ability to properly parse the FCP7 XML files generated by them.

--help
Prints a help display listing all the typical options supported

!filename
Load additional arguments from a text file. In addition to any parameter files you name with this option, Precutcmd will always look for a file named 'precutcmd-defaultopts' in the directory its executed from. The parameters from the default file will be loaded first, allowing you to override them with parameters from your own specified files, along with parameters specified on the command line. All parameter files must be formatted so that each parameter word is on a separate line, which is a requirement of Python's argparse routine. For example:

   --container
   mp4
   --retaintempclips
   yes

--combine [sourcemedia | track | sequence | none]
Precut generates an output clip (video/audio file) for each edit it finds in a project. This option specifies how those individual output clips should be combined. 'sourcemedia' combines all output clips that were generated by the same source media file. For example, if you have 4 edits on a track, all of which are from different sections of the same source media file, 'sourcemedia' will combine the 4 output clips generated from those edits into a single file. 'track' combines all output clips generated from the same track within the project. 'sequence' combines all output clips generated from the same sequence; the clips will be ordered by ascending tracks, such that all the clips from the first track are first, followed by all the clips from the second track, etc... Finally, 'none' specifies that no combining is to be performed, meaning there will be an individual output clip for each edit in the project.

Note that you can optionally combine the output clips while still retaining the individual generated clips by using the --retaintempclips option.

--outputdir <directory>
Directory to store the generated files. The directory must already exist. Put quotes around the path if it contains spaces. Example: --outputdir "c:\My Documents". If --outputdir is not specified then Precut will use various defaults depending on which --combine option is used:

--combine sourcemedia - Precut will store the combined file in the same directory as the source media file
--combine track | sequence - Precut will store the combined file in the same directory as the XML source file
--combine none - Precut will store the generated clip files in the same directory as the source media file

Independent of the --combine value, the individual generated clips (which are temporary files if --combine is any value other than 'none') will be stored in the same directory as the source media file if no --outputdir is specified, otherwise the individual clips will be stored in the directory specified by --outputdir. These clips are deleted after the combined file is generated - you can optionally choose to retain these clips via the --retaintempclips option. Also, use the --scratchdir option to specify a different directory for the individual temporary clips.

--scratchdir <directory>
Directory to store the individual generated clips which are later combined when --combine is any value other than 'none'. When --combine is 'none' then the --outputdir is used instead, since the generated clips represent the final output for that mode of operation. Using the --scratchdir option will increase the performance of Precut's combine operations when it specifies a different storage device than --outputdir since it will prevent I/O congestion and trashing for the I/O writes of the combined file. If --scratchdir is not specified then Precut will use --outputdir as the scratch directory.

--container <file extension>
Video container to use for the generated output files. The default is to use the same container as the source file. The container is specified by its file extension. For example, "--container MOV" uses a Quicktime MOV container. "--container MP4" uses an MP4 container.

--videoargs <ffmpeg video arguments>
The video encoding arguments to be passed to ffmpeg. Enclose the argument list within double quotes. The default arguments are "-c:v copy -copyinkf -avoid_negative_ts 1 -copyts", which performs a copy of the video stream. To direct ffmpeg to use its own internal default video parameters, use --videoargs "" (empty string). To exclude video from the generated clips use --videoargs " -vn"

IMPORTANT NOTE: For --videoargs, --audioargs, and --ffmpegargs, you must insert a space as the first argument within the quoted list, so for example "-vn" becomes " -vn". This is required to prevent Python's argparse library from interpreting the dash that is to be passed to ffmpeg as a dash for the argument parser used by precutcmd itself. The GUI app will insert this leading space automatically, so you're only required to do it when using precutcmd directly.

--audioargs <ffmpeg audio arguments>
The audio encoding arguments to be passed to ffmpeg. Enclose the argument list within double quotes. The current default arguments are "-c:a copy", which performs a copy of the audio stream. To direct ffmpeg to use its own internal default audio parameters, use --audioargs "". To exclude audio from the generated clips use --audioargs " an"

--ffmpegargs <ffmpeg arguments>
Additional arguments to be passed to ffmpeg. Enclose the argument list within double quotes.

--ffmpegdir <directory>
The directory containing the ffmpeg executable. By default Precut assumes ffmpeg is in the system path. Use this operation to specify a specific path. Put quotes around the path if it contains spaces. Example: --ffmpegdir "c:\My Progs\ffmpeg\bin"

--ifexists [uniquename | skip | overwrite | prompt | exit]
Specifies what action to take if an output file exists with the same name as a file Precut is attempting to create. The default 'uniquename' will cause a unique filename to be generated by adding -new-x suffix (for example, clip001.mp4 becomes clip001-new-1.mp4, clip001-new-2.mp4, etc...). 'skip' will cause the file to be skipped and not written. 'overwrite' will overwrite the file. 'prompt' will present a choice of actions to take on the console (uniquename/skip/overwrite/prompt/exit). 'exit' will cause the application to terminate.

--onlysequences [sequencename ...]
By default Precut will process all sequences it finds. Use this option to override that default and only process the sequences on this list. Sequence names are case sensitive.

--excludesequences [sequencename ...]
By default Precut will process all sequences it finds. Use this option to exclude specific sequences (by name). Any sequence contained in this list will be ignored. Sequence names are case sensitive.

--onlytracks [trackname ...]
By default Precut will process all tracks it finds. Use this option to override that default and only process the track names on this list. Note that trackname is not V1, V2, V3, etc... but instead the user-specified name of a track inside Premiere. Tracks do not have default names, so unless you've named the track it will be unnamed. Use --onlytracknumbers to specify a track by its index rather than name. Track names are case sensitive.

--excludetracks [trackname ...]
By default Precut will process all tracks it finds. Use this option to exclude specific tracks(by name). Note that trackname is not V1, V2, V3, etc... but instead the user-specified name of a track inside Premiere. Tracks do not have default names, so unless you've named the track it will be unnamed. Use --excludetracknumbers to specify a track by its index rather than name. Track names are case sensitive.

--onlytracknumbers [tracknumber ...]
By default Precut will process all tracks it finds. Use this option to override that default and only process the track numbers on this list. A track number of 1 corresponds to V1, a track number of 2 corresponds to V2, etc...

--excludetracknumbers [trackname ...]
By default Precut will process all tracks it finds. Use this option to exclude specific tracks by track number. A track number of 1 corresponds to V1, a track number of 2 corresponds to V2, etc...

--handles <seconds>
Use this option to automatically include extra footage in all your edits ("handles" in video parlance), which can be useful to provide extra editing flexibility, esp for transitions. For example, if you have an edit with an in-point of 13 seconds and an out-point of 22 seconds, --handles 5 will generate the clip with an in-point of 8 seconds and an outpoint of 27 seconds.

--outputnamespec <spec>
Controls the naming of the final output files generated by Precut. Place spec in quotes if it contains any literal spaces. 'spec' contains your desired output name including optional specifiers, which offer the ability to insert dynamic text into the filename, such as the sequence name the clip was generated from, the running count of files generated, etc.. Each specifier is prefixed with %

Here is the full list of support specifiers:

Specifier Description Example
%X Root of XML source filename MyProj
%O Precut app launch date, in mmddyy format 052017
%o Precut app launch time, in hhmmss format 165402
%S Name of the current sequence being processed MySequence1
%s Index of current sequence being processed 1
%T Name of current track being processed (if no name exists then track # will be used) MyBRoll
%t Index of current track being processed 3
%C Name of clip current being processed (user-specified name of clip or if not, filename of source media) InterviewQuestion6
%i Number of output clips generated to this point (for all sequences) 36
%j Number of output clips generated for the sequence currently being processed 2
%c Number of output clips generated for the track currently being processed 3

Here are some outputnamespec examples:

--combine sequence --outputnamespec '%X-%S
Generate output files grouped by sequence and name each file with the combination of the XML filename and sequence name

--combine track --outputnamespec '%X-%S-%t
Generate output files grouped by track and name each file with the combination of the XML filename, sequence name, and track index

--combine none --outputnamespec MyClips-%i
Generate output files for each clip/edit in the project and name each clip MyClips-xxx, where 'xxx' increments as each clip is generated

--retaintempclips [no/yes]
When a --combine operation other than 'none' is specified, Precut by default will delete the temporary clip files it created for each edit after combining those clips. Use this option with a value of 'yes' to retain the temporary clips that Precut creates. Note that this option has no effect when --combine is 'none', since the generated clips represent the final output file(s).

--logginglevel [quiet | minimal | normal | warning | verbose | debug]
The verbosity level of logging for a precutcmd session. The default is 'normal'. Precut outputs its messages both to the console (stdout/stderr) and to a pair of logging files, named precutcmd-log-last.txt (log messages from most recent session) and precutcmd-log-lifetime.txt (log messages from all sessions). For 'quiet' no log messages will be generated except if an error occurs. 'minimal' will display only the application banner, current operation in progress, and a final summary showing the count of files processed. 'normal' will additionally show each final file generated (either the combined file or each individual clip if --combine none is specified). 'warning' will show additional information about events/conditions that aren't fatal but noteworthy. 'verbose' will show additional information about the internal processing of Precut. 'debug' will display the full information about internal processing of Precut - it can be used to troubleshoot errors or unexpected results.

Note that in addition to Precut's own messages, Precut will also include the messages generated by ffmpeg. You can control the logging of ffmpeg via --ffmpegconsoleloglevel (controls ffmpeg's logging to console) and --ffmpegreportloglevel (controls ffmpeg's logging to its own file, the contents of which are copied to Precut's own log file).

--ffmpegconsoleloglevel <value>
The logging level of ffmpeg's console (stdout) log. The default is 24 (warning). Refer to the online ffmpeg documentation for the supported log levels. Note that there are two Precut parameters to control ffmpeg's logging; --ffmpegconsoleloglevel for console/stdout logging and --ffmpegreportloglevel for logging to a log file.

--ffmpegreportloglevel [none | ffmpeg numeric value]
The logging level of ffmpeg's file logging. The default is 24 (warning). Refer to the online ffmpeg documentation for the supported log levels. After each ffmpeg operation, Precut copies the contents of the file log created by ffmpeg into its own file log. Note that there are two Precut parameters to control ffmpeg's logging; --ffmpegconsoleloglevel for console/stdout logging and --ffmpegreportloglevel for logging to a log file.

--haltonffmpegerrors [no/yes]
By default Precut exits immediately if ffmpeg fails a clip generation/combine operation. Precut will ignore ffmpeg errors when this value is 'no'.

--insertvideo <videofile>
Inserts the specified video file in between each clip when generating combined video files (--combine is any value other than 'none'). This feature can be used to insert user-identifiable video in between clips, such as a black screen or test pattern. When using the 'copy' operation of ffmpeg, the specified videofile for this option must be of the exact same codec as the clips being combined.

FAQ

Q: When processing H.264 files from a Sony camera, ffmpeg fails with the error "Could not find tag for codec pcm_s16be in stream #1, codec not currently supported in container"
A: Sony cameras store audio as PCM uncompressed, which violates the MP4 container specification because PCM is not a supported audio codec in the container. ffmpeg ahderes to the MP4 container specification and will not allow PCM audio streams to be copied into MP4 files that Precut asks it to create. You can work around this issue by either specifying a different container type that supports PCM audio such as Quicktime (--container MOV), or by havnig Precut/ffmpeg transcode the audio streams of your clips, such as with --audioargs -c:a aac. If you don't need the audio stream you can elminiate it from the clips that Precut/ffmpeg generates via --audioargs " -an" (space between first quote and dash is required).

Q: Can I specify my edits without using an NLE such as Premiere? Like a custom EDL (Edit Decision List)?
A: Sure. I have created a minimal sekelton FCP7 XML file that you can use as a template for generating your own edits/EDL. You can download it here. Use "Save As" on that link, otherwise your browser might remove the leading XML element.

GPL v3 License

    Precut - Cuts video files from edits in Premiere Project -> FCP7 Export
    Copyright (C) 2015, testcams.com

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.

Credits

Support

To report issues or for help, please visit the Precut discussion forum
There's also a thread on the Adobe Premiere support forum here.