Clipstitch Manual

A utility to make home movies by cutting up, manipulating, and then stitching together your digital camera video files. Permits one to add fade-ins/outs, speed up/slow down, reverse direction, muting, rotate, burst and back-and-forth. A script-based or interactive, user-friendly front end for ffmpeg.



Version: Clipstitch 5.6
Homepage:http://www.twentypede.com/leg4/clipstitch5.6.html
Author: Shaheen Tonse
Contact: software@twentypede.com
Source URL:https://sourceforge.net/projects/clipstitch/files/ClipstitchSource_5.6.2.zip/download (mainly for benefit of MS Windows users)
Copyright: This document has been placed in the public domain.

Contents

nb: After clicking on a topic, if you click on that header, it will bring you back here.

Overview: What Clipstitch Does and How It Does It

This section covers the basic ideas of Clipstitch. Applies to all platforms.

What
If you have made several video files with your digital camera (or phone) and want to put them together into a home movie. Clipstitch lets you:
  • Select the parts of each file that you want and discard those you do not.
  • Optionally add fade-ins/fadeouts, speed up or slow down, mute, or time-reverse the video
  • Rearrange the video clips. Multiple copies may be used if desired
  • Concatenate clips to make your final "movie".

If you have taken the videos on your phone they need to be transferred to a computer first.

Apple computer users: While I would be most pleased if you used this, I have heard that Apple's I-Movie which comes free with your computer is very good.

How

Clipstitch is a front-end for FFmpeg, the well-known, widely used, free, open-source audio/video software program. FFmpeg handles almost every conceivable audio/video format and has tons of features. As a result of being so versatile it is hard to use, especially if you do not use it on a regular basis. Clipstitch does nothing that cannot be done with ffmpeg, but focuses on the small subset of ffmpeg features normally required to make a home movie, and simplifies their usage and syntax.

Clipstitch works by parsing its simple directives from a text based script file (which you make), internally putting these together to make fairly complicated-looking ffmpeg commands. It then directs the OS to execute those; that is where the actual video manipulating work happens. It is quite likely that if ffmpeg works on your computer, then Clipstitch too will work just fine. (when you see text this color, hover your mouse over it.) It is command-line based, i.e. it is run from a text-based window. Thus after you have put your Clipstitch commands into a text file you simply type

	      Clipstitch my_directives_file.txt
	    
Any of the commands in the directives file can also be entered interactively in a manual mode, which further simplifies the use of the program.

License

Clipstitch is free software, distributed without warranty, under the Apache License 2.0.

Especially if you are planning to re-distribute it with or without modifications you should read the Apache License.

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

See the License for the specific language governing permissions and limitations under the License.

Requirements

FFmpeg

You must have ffmpeg, the well-known, widely used, free, open-source audio/video software program installed. Get ffmpeg at ffmpeg.org. It is a good sign if you can type ffmpeg -version at the command line successfully, and for the other 2 utilities that you will also end up installing: ffprobe (provides metadata details of a video/audio file) and ffplay (plays video/audio files on screen). (see Troubleshooting if you have a problem with ffplay on Linux)

Attn MS Windows Users: After an ffmpeg upgrade in 2018 I found it necessary to add a new environment variable SDL_AUDIODRIVER and set its value to directsound. You might have to do likewise in Control Panel.

Python
  • Clipstitch is written in Python. However pre-built executables made with Pyinstaller are provided for both MS Windows and Linux.
  • Mac OSX, Linux and Unix users: your computer almost certainly has Python but to verify: Open a command line window, Terminal or iTerm, (called a console or Xterm for Linux/Unix users). Type python --version. Clipstitch 5 is written in Python 3.8 with some deliberate (subprocess module related) backward compatibilies to Py 3.7. An earlier Clipstitch version (3.5.2) is in Python 2.7.

Installing Clipstitch

Linux, Unix, MAC OSX and MS Windows+Python users use similar installation instructions since they use the Python interpreter already on their computer to interpret the source code. MS Windows no-Python instructions are different since pre-compiled Clipstitch executable is provided.

Installing in Linux, Unix or Mac OS X

Download the tar file, which you will find after clicking on the Files tab on that page. Un-tar the downloaded file into its own folder, which you will find to contain several files.

A pre-built Linux executable can be used, especially by Python 2 users who can't or won't upgrade to Python 3.

nb: Experienced users can skip this, if you're a newbie, read on.

This step sets up so that the program will run whenever you type Clipstitch at the command line, with one of the 2 following methods:
Using an alias (easier method)
Put an alias into your .login file as follows:
	  alias Clipstitch "python path_to_Clipstitch_folder/clipstitch.py"
	    
You might have to re-login, or open a new Terminal, or type source .login for the change to take effect. You might prefer to put the alias command into the files .cshrc, .bashrc or .kshrc but I think .login is the best choice.
Using a soft link
  • Make a soft link to clipstitch.py from a folder already in your command path. echo $PATH will show you folders in your command path. Go to one such folder & make a soft link to Clipstitch.py:
    		  ln -s Path_to_Clipstitch_folder/clipstitch.py    Clipstitch
    		
    Many people keep a specific folder, such as $HOME/bin, to hold soft links to point to frequently used programs and utilities. But any folder in the command path will work, even the folder you just extracted your download to provided you put that folder in the command path.
  • Typing rehash (unnecessary for bash) followed by which Clipstitch should give the pathname to the soft link you just made.
  • Ensure that the first line in the file clipstitch.py, which looks something like: #!/usr/local/bin/python accurately reflects where your python interpreter executable is. If in doubt, type which python, and change that first line in clipstitch.py to reflect the location of the Python interpreter, taking care to leave the "#!" characters alone.
  • The execute permission on the file clipstitch.py should already be set correctly. But if you get a Permission denied error message later when trying to run Clipstitch, then type
    chmod u+x Path_to_Clipstitch_folder/clipstitch.py
    and that should set your execute permission correctly and fix the problem.

Installing in MS Windows

  1. Download & Install: Click here to download and Save it where you like. What you downloaded is the actual executable/binary, clipstitch_5.6.x or clipstitch_5.6.x.exe in Windows Explorer. Clipstitch is command-line based, i.e. it is run from a text-based window. Do one of the 2 following to enable the program to run whenever you type clipstitch at the command line.
  2. Place the file in a location in your command path. To view/edit command path, type Environment in Control Panel's Search bar and add the folder name to the environment variable "PATH" for your account. Open a DOS console window using the cmd command, and type clipstitchx.y.z --version; it should return version number. Continue to the Setup section below.
  3. Make a file, call it, say Clipstitch.bat, It should look similar to the following 4 lines:

    	    @echo off
    	    REM Sample BAT file so can run Clipstitch from  
    	    REM the location of the pre-compiled Clipstitch executable:
    	    C:\Users\YourUserName\Path_to_Clipstitch_Folder\clipstitch5.6.x.exe %*
    	  

    Be certain to keep the %*, this ensures that any command line arguments you enter will be passed on to clipstitchx.y.z.exe. Place the file in a location in your command path. To view/edit command path, type Environment in Control Panel's Search bar and add the folder name to the environment variable "PATH" for your account. (I personally keep one specific folder, C:\Users\YourUserName\...\Local_programs in my command path to hold batch files (like Clipstitch.bat) to point to frequently used programs and utilities, that way I do not have to put all those other folders into the command path. Some people simply place the bat file in C:\Windows\System32. I feel that's a bad habit.)

    After you have made Clipstitch.bat and placed it in a folder in the command path, open a DOS console window using the cmd command, and type Clipstitch --version; it should return version number, 5.6.x. Continue to the Setup section below

Setup the installation

Nothing to do here really. All users:

  1. Test by typing Clipstitch --version. (should return version number) or Clipstitch --help.
  2. Ok, you are ready to go.

MS Windows no-Python users who so desire can look at the source code (link provided at top of ths doc). This has extra CR/LFs inserted to make viewing in Windows Notepad easier. Other users get source code anyway in the tar file in the Linux/Unix/Apple section below.

Upgrading Clipstitch

Place holder

Using Clipstitch

The sub-sections on options, while useful, are wordy. If you are in a hurry to get started jump ahead to Sample Session 1

Command line Options

There are very few command line options, (because most options are passed via a script called the directives file). The logging level is most likely to be helpful. Most of the time Clipstitch is invoked with a single argument, the directives file name. That script is where most options and commands reside.

positional arguments:
  infile                The input directives file. Required

optional arguments:
  -h, --help            show this help message and exit
  -v, --version         show program's version number and exit
  --log {DEBUG,INFO,WARNING,ERROR,FATAL}
                        Specify logging verbosity level (INFO is default)
	

Directive File Arguments

The two commands --makeclip and --concatenate do the majority of the work. (The Internal Workings section has more on this). makeclip's output can be tailored to add fadein/out, caption, reverse video, sped up/down etc. makeclip runs ffmpeg as a subrprocess. The options --ffmpegoptions_g/i/o allow one to pass additional options to ffmpeg at this time. After one has made all the clips and reordered them as desired, concatenation puts them together for a final output movie file. Since learning by example is good there are two sample sessions further down below.

The special effect options --backandforth and --burst can be used instead of makeclip to make clips.

A standalone tool: --slidetool puts stills together to make a movie. I use it mostly to put together multiple stills taken close together in time to make funny looking jerky videos that can cycle backward and forward. (For actual slideshows I use MS Powerpoint) It produces a standalone output file that is not part of Sequence. The reason is that it usually has different height, width and frame rate and cannot be concatenated with other clips unless some ffmpeg pre-processing is done on it. The tool uses a large amount of memory for reasons I do not know, works fine on my Windows OS but sits there swapping on my Oracle VirtualBox+Scientific Linux OS.

This is a description of all commands. Is obtained any time by putting --help as the first line of the input directives file and running Clipstitch.

optional arguments:
  -h, --help            show this help message and exit
  -e, --endread         Discontinues reading directive file if encountered, or
                        exits manual mode

Persistent options:
  These generally define current folder and file names. They retain their
  value until option is used again.

  --folder FOLDER       Specify directory path to files used by the other
                        options: --moviefile, --readclips,--writeclips,--
                        readseq, --writeseq... The value is persistent until
                        changed by a subsequent --folder command. Sets the
                        value of CurrentFolder, which specifies a directory
                        path.
  --moviefile MOVIEFILE
                        Specifies the input video file. This value is
                        persistent until changed by a subsequent --moviefile
                        command. Sets the value of variable CurrentMovieFile,
  --ffmpeg_folder FFMPEG_FOLDER
                        Sets the folder name in which the ffmpeg,ffprobe and
                        ffplay binary executables reside. Unnecessary if the
                        ffmpeg binary folder is part of user's $PATH
                        environment variable. Useful if wish to override $PATH
                        and use older ffmpeg version, or simply not bother
                        with $PATH.
  --desc [DESCRIPTION [DESCRIPTION ...]]
                        Useful for identifying clips later when re-ordering or
                        manipulatiing. Advisable use on own line to avoid
                        parsing errors, or use as "--desc='desc1 desc2 ...'".
                        Sets a variable CurrentDescription. This value is
                        persistent until changed by another --desc command.
  --fadedefaults fadein fadeout
                        Specifies default values for video and audio
                        fadein/out
  --ffmpegoptions_g [global options]
                        Additional options for ffmpeg command inserted
                        immediately after "ffmpeg". Enter as '--
                        ffmpegopti..="options"' else parser will choke on
                        minus signs in the options. Enter with no options to
                        set back to inactive
  --ffmpegoptions_i [input options]
                        Additional options for ffmpeg command inserted before
                        "-i". See '--ffmpegoptions_g' help
  --ffmpegoptions_o [output options]
                        Additional options for ffmpeg command inserted
                        immediately before output filename. See '--
                        ffmpegoptions_g' help
  --ffplayoptions_g [global options]
                        Additional options for ffplay command. Useful for
                        setting display size. Enter as '--
                        ffplayoptions_g="options"' else parser will choke on
                        any minus signs that are in the options. Enter with no
                        options to set back to inactive
  --caption ="my caption"
                        Add a caption to a clip. Use as '--caption="CAPTION
                        TEXT"'. Commas etc. in caption might need "escape"ing.
  --captionproperties CAPTIONPROPERTIES
                        Caption properties e.g. ":x=100:y=100:fontsize=24:font
                        color=yellow:box=1:boxcolor=black"

Manual Entry options:
  For manually entering directives and optionally recording them

  --manual              Go to manual mode. Presents user prompt so she can
                        enter manually commands until she enters --endread.
  --manualafter {EVERY,MAKECLIP,OFF}
                        Automatically go to manual entry mode after every
                        (non-comment) line in directive file or after a
                        --makeclip line.
  --record [choice [choice ...]]
                        Record directives from manual entry or script to a
                        file. Choices are (1) "OPEN recfile w|a": open recfile
                        with either write to new file or append to existing
                        file and turn on recording. (2) "ON or OFF": turn on
                        (or off) recording. (3) "CLOSE": turn off recording
                        and close the recording file

Clip generation options:
  Many of these follow the --makeclip (to generate)and --ffplay (to play) a
  clip from an input video file , must appear on the same line and will only
  work for that same line

  --makeclip tstart tstop
                        Specify start and end times in the current video file
                        (specified by --moviefile)to write to a clip file. If
                        tstart=b and/or tstop = e then start/stop is
                        beginning/end of file. When the line containing this
                        command has been read, ffmpeg is run and produces a
                        disk file with name composed of the original video
                        file name with a random 3 character string appended to
                        it. Also a Clip() class instance is produced,
                        containing information about the new clip file on
                        disk. Other options that the user wishes to apply to
                        the clip being generated must appear on this same
                        line.
  --ffplay [tstart [tstop ...]]
                        Similar to --makeclip but plays (file specified by
                        --moviefile) to screen instead of making an output
                        file. Useful for interactively deciding start/end/fade
                        times. Same options (see below) as allowed for
                        --makeclip. Or an existing clip KEY can be given as
                        sole argument
  --fadein FADEIN       Specifies whether a fadein for video and audio is to
                        be applied. Default set to 30 frames.
  --fadeout FADEOUT     Specifies whether a fadeout for video and audio is to
                        be applied. Default set to 0.5 seconds.
  --nofades             Fadeout for this clip and fadein for next clip set to
                        zero to permit abrupt transition when concatenated
                        later
  --mute                volume of produced clip = 0
  --transpose TRANSPOSE
                        Rotate the output video. TRANSPOSE=1 (or 2) for 90
                        degrees clockwise (or anticlockwise).
  --padglobal PADGLOBAL
                        To pad the output with extra pixels and make it
                        square. Necessary if you mixed Portrait and Landscape
                        oriented clips. e.g. to mix 640x480 pixels clips with
                        480x640 clips use "--padglobal 640:640"
  --speed SPEED         Speed up or slow down the output by a factor SPEED
  --reverse             Play the video clip backward. Audio is not reversed
  --concatenate [CONCATENATE [CONCATENATE ...]]
                        Concatenate multiple clips to produce an output movie
                        file. First arg (required) is output file name.
                        Successive args are individual clip keys or a range of
                        keys. If absent then all keys in Sequence are used
  --concatnstreams #v #a
                        To manually set #video and audio streams ffmpeg 
                        concatenate command if desired
Special Effects:
  Used instead of --makeclip to do fancier things when producing a clip from
  an input video file

  --backandforth tstart tstop ntimes
                        Special effect clip: Specify start, end and n times to
                        do clip backward and forward repetitive effect. --mute
                        and --speed can be applied to this.
 --stutter tstart tstop ntimes
                        Special effect clip: Specify start, end and n times to do a
                        repetitive Max Headroom-like stutter effect. --mute works with this.
--burst tstart tstop nframes|interval
                        Special effect clip: Specify start, end and # frames
                        (int) or interval (float) to do jumpy burst effect.
                        --speed works with this.
  --slidetool [time_per_slide ncycles out_file infile1 infile2 ... [time_per_slide ncycles out_file infile1 infile2 ... ...]]
                        Make a slideshow (movie) clip from existing stills.
                        Just forward: ncycles=0.5, Forward,back:ncycles=1,
                        Forward,back,forward:ncycles=1.5,...

Pickle options:
  Arguments to read and write (with Pickle) files containing the Clips() and
  the Sequence(). Useful when you are doing multiple steps and want periodic
  saves while generating many clips.

  --readclips clipfile  Read Clip() instances from file
  --writeclips clipfile
                        Write all Clip() instances to file
  --readseq file        Read Sequence() instance from file
  --writeseq file       Write the Sequence() instance to file
  -p [choice [choice ...]], --print [choice [choice ...]]
                        Output goes to a log file and to screen. Choices (1)
                        "seq or sequence": metadata of the Sequence class. (2)
                        "clips": metadata of all Clip() instances. (3)
                        "clip1:clip2": print range clip1 to clip2 in the
                        Sequence. (4) "clip1 clip2 clip3...": print clips
                        listed.

Sequence manipulation options:
  To add, remove or reorder the sequence of clips.

  --sc [SC], --selectclip [SC]
                        Set value of variable SelectClip, to be used by the
                        following operations that operate on or move Clips
                        within the Sequence. e.g. --selectclip MFX would set
                        SelectClip=MFX. If there were several instances of key
                        MFX in the Sequence and the 2nd one was desired:
                        --selectclip MFX_2 should be used. The clip specified
                        must already exist, either in the Sequence or as a
                        Clip. A range of clips "--sc AAA:AAB" can be
                        specified. With no args prints current value
  --remove              Remove SelectClip from the Sequence
  --iab, --insert_beginning
                        Insert a copy of SelectClip at the beginning of the
                        Sequence
  --iae, --insert_end   Append a copy of SelectClip at the end of the Sequence
  --ib IB, --insert_before IB
                        Insert a copy of SelectClip immediately before clip
                        "IB"
  --ia IA, --insert_after IA
                        Insert a copy of SelectClip immediately after clip
                        "IA"
  --mb MB, --move_before MB
                        Move SelectClip immediately before "MB"
  --ma MA, --move_after MA
                        Move SelectClip immediately after "MA"
  --replicate NCopies   Append NCopies copies of SelectClip to the position
                        immediately following its current position.
  --swap SWAP           Swap positions between SelectClip and the clip "SWAP".
	

Sample Sessions

Sample session #1

In this 3 video files (movie1.mov, movie2.mov, movie3.mov) from a camera are put together to make a single movie. The script file samplescript1.txt is:

#--help

--moviefile movie1.mov
--desc Intro
--makeclip b 10
--desc Panning around
--makeclip 15 20

--moviefile movie2.mov
--desc Jumping into pool
--makeclip b e

--moviefile movie3.mov
--desc Farewell
--makeclip 8 e

--print seq
--concatenate day_at_pool.mov

--endread
	    

Going through line-by-line,

  • the comment character is "#". Blank lines and comment lines are ignored. If --help is uncommented then help on the script file commands and options is given.
  • --moviefile specifies the video file to be operated on.
  • --desc provides a label for the clip to be made. Not necessary here, but lin a later sample session when clips ae re-ordered and moved around, is gets very confusing if you have not used --desc.
  • --makeclip b 10 makes a clip from the beginning till the 10 second mark of movie1.mov.
  • The next 2 lines make a second clip, labelled "Panning around" from the 15 to 20 second mark of tthe same video file.
  • The next 3 lines make a single clip from movie2.mov from beginning to end (b to e)
  • The next 3 lines make a single clip from movie3.mov from 8 sec mark to end of file.
  • A sequence of 4 clips has been made:, 2 clips from the first video file and one each from the second and third. --print seq lists them along with their length in seconds and label. --print clips can also be used if it is desired to look at more detail at what info is in those clips, but usually unnecessary.
  • --concatenate concatenates the clips to a single output file day_at_pool.mov
  • Reading stops when --endread is encountered. There can be lines following this but they will be ignored.
Running clipstitch samplescript1.txt executes the above. As you can see in the output below each clip has a unique 3 letter key (VQP, XEU,...) by which it is referenced. As clips are made they are appended to the clips sequence and finally they are concatenated. This is an idealised session, usually you want to do more, go to the next sample session.

Processing key VQP  (Intro)
Selected Clip() set to SelectClip: ['VQP']
Appended key ['VQP'] to sequence
 
Processing key XEU  (Panning around)
Selected Clip() set to SelectClip: ['XEU']
Appended key ['XEU'] to sequence
 
Processing key RAE  (Jumping into pool)
Selected Clip() set to SelectClip: ['RAE']
Appended key ['RAE'] to sequence
 
Processing key UVD  (Farewell)
Selected Clip() set to SelectClip: ['UVD']
Appended key ['UVD'] to sequence
 
Printing Sequence   (#clips: 4)
-----------------
Key      Start(sec.)  Description
[VQP]       0.0       Intro
[XEU]      10.0       Panning around
[RAE]      15.0       Jumping into pool
[UVD]      28.5       Farewell
 End:      42.5
----
Read of directive file samplescript1.txt completed
Command "Concatenation with ffmpeg": ['ffmpeg', '-i', '.\\movie1_VQP.mov', '-i', '.\\movie1_XEU.mov', '-i',
'.\\movie2_RAE.mov', '-i', '.\\movie3_UVD.mov', '-filter_complex', 'concat=4:v=1:a=1',
'.\\day_at_pool.mov']  (shell = False)
Completed. Exiting
	    
Sample session #2

The same 3 video files are put together but more effects are used, and the clips made are re-ordered before concatenation. It shall be a 2 step process: first the clips are made, and then the re-ordering is done, after which concatenation to a final file is done. Also some other commands are used to show their usage. The script file for Step 1 samplescript2.txt is the text up to the first --endread, for Step 2 it is after that and up to the second --endread:

#STEP 1 STARTS HERE
--moviefile movie1.mov
--desc Intro
--makeclip b 4 --nofades
--makeclip 7 10 --fadeout 2
--desc Fooling around with effects
--makeclip 15 20 --speed 2
--makeclip 15 20 --speed 0.5 --mute
--makeclip 15 20 --reverse
--makeclip 15 20 --fadein 60 --fadeout 2

--moviefile movie2.mov
--desc Jumping into pool
--makeclip b e

--moviefile movie3.mov
--desc Farewell
--makeclip 8 22 --fadeout 2.5

--print sequence
--writeclips clips1.pkl
--writeseq seq1.pkl

--endread

#STEP 2 STARTS HERE. MOVE THIS CODE TO THE TOP TO RUN IT
--readclips clips1.pkl
--readseq seq1.pkl
--print seq


--selectclip INU --repl 3   #make 3 copies of a clip
--selectclip INU_3 --remove  #remove the third one
--sc OZP --iae     #insert a copy of this to end
#Now move a range of clips (RAX to RXV) to just before clip GVO
--sc RAX:RXV --mb GVO      #move all 4 "fooling around..." clips to just before "Farewell"
-p seq   #short form of print sequence

--concatenate day_at_pool2.mov
--endread
	    

The output from Step 1 (I removed some):

Processing key UJL  (Intro)
Selected Clip() set to SelectClip: ['UJL']
Appended key ['UJL'] to sequence

Processing key OZP  (Intro(2))
Selected Clip() set to SelectClip: ['OZP']
Appended key ['OZP'] to sequence

Processing key RAX  (Fooling around with effects)
Selected Clip() set to SelectClip: ['RAX']
Appended key ['RAX'] to sequence
... STUFF REMOVED HERE
...
Processing key GVO  (Farewell)
Selected Clip() set to SelectClip: ['GVO']
Appended key ['GVO'] to sequence

Printing Sequence   (#clips: 8)
-----------------
Key      Start(sec.)  Description
[UJL]       0.0       Intro
[OZP]       4.0       Intro(2)
[RAX]       7.0       Fooling around with effects
[OED]       9.5       Fooling around with effects(2)
[RQI]      19.5       Fooling around with effects(3)
[RXV]      25.5       Fooling around with effects(4)
[INU]      30.5       Jumping into pool
[GVO]      44.0       Farewell
 End:      58.0
----
Wrote pickle output file  .\clips1.pkl
Wrote pickle output file  .\seq1.pkl
Read of directive file samplescript2.txt completed
No output file specified. Assuming concatenation was not required, so will not be done.
Completed. Exiting
	      

The output was similar to that from the previous sample session. Note that

  • if --desc is not specified then the existing value is used for new clips, but appended with (2), (3),....
  • instead of concatenating the clips to make an output file we wrote the clips and the sequence out using --writexxx statements. In the next step these will be read back in.

Now with a text editor move the second section of the samplescript2.txt to the top and execute Clipstitch again. The output now shows that clips have been replicated and re-ordered within the sequence. There are comments in the input script file saying what is being done. Note that

  • we operate on a range of clips using the ":"
  • we make multiple copies of clip INU and then delete the 3rd one, referring to it as INU_3.

Reading clipfile .\clips1.pkl
Read pickle input file .\clips1.pkl. Stored 8 clips. Discarded 0 clips
Read pickle input file .\seq1.pkl for sequence of length 8
Printing Sequence   (#clips: 8)
-----------------
Key      Start(sec.)  Description
[UJL]       0.0       Intro
[OZP]       4.0       Intro(2)
[RAX]       7.0       Fooling around with effects
[OED]       9.5       Fooling around with effects(2)
[RQI]      19.5       Fooling around with effects(3)
[RXV]      25.5       Fooling around with effects(4)
[INU]      30.5       Jumping into pool
[GVO]      44.0       Farewell
 End:      58.0
----
Selected Clip() set to SelectClip: ['INU']     Index in Sequence(): 6
Replicated keys ['INU'] 3 times
Selected Clip() set to SelectClip: ['INU']     Index in Sequence(): 8
Removed keys ['INU'] from sequence
Selected Clip() set to SelectClip: ['OZP']     Index in Sequence(): 1
Appended key ['OZP'] to sequence
Selected Clip() set to SelectClip: ['RAX', 'OED', 'RQI', 'RXV']     Index in Sequence(): 2
Removed keys ['RAX', 'OED', 'RQI', 'RXV'] from sequence
Sequence Moved key ['RAX', 'OED', 'RQI', 'RXV'] before key GVO
Printing Sequence   (#clips: 11)
-----------------
Key      Start(sec.)  Description
[UJL]       0.0       Intro
[OZP]       4.0       Intro(2)
[INU]       7.0       Jumping into pool
[INU]      20.5       Jumping into pool
[INU]      34.0       Jumping into pool
[RAX]      47.5       Fooling around with effects
[OED]      50.0       Fooling around with effects(2)
[RQI]      60.0       Fooling around with effects(3)
[RXV]      66.0       Fooling around with effects(4)
[GVO]      71.0       Farewell
[OZP]      85.0       Intro(2)
 End:      88.0
----
Read of directive file samplescript2.txt completed

Command "Concatenation with ffmpeg": ['ffmpeg', '-i', '.\\movie1_UJL.mov', '-i', '.\\movie1_OZP.mov', '-i', '.\\movie2_INU.mov', '-i', '.\\movie2_INU.mov', '-i', '.\\movie2_INU.mov', '-i', '.\\movie1_RAX.mov', '-i', '.\\movie1_OED.mov', '-i', '.\\movie1_RQI.mov', '-i', '.\\movie1_RXV.mov', '-i', '.\\movie3_GVO.mov', '-i', '.\\movie1_OZP.mov', '-filter_complex', 'concat=11:v=1:a=1', '.\\day_at_pool2.mov']  (shell = False)
Completed. Exiting
	      

Manual (or Interactive) Mode

This mode was previously (v.3) accessed with --lineeditmode. In v5.3 it was improved. Previously the user had to use a separate console to run ffplay and adjust the start/end times and fadein/outs of movie files, then switch to an editor and enter the values into the directives file. --ffplay now can be run from the manual mode and fine tuning of times all can be done in a single console, which simplifies things.

--manual in the directives file sends to manual mode. From there any command allowed in a directives file can be typed at the console. If --endread is typed the program exits manual mode and goes back to the next line in the directives file.

--manualafter EVERY | MAKECLIP | OFF in the directives file sends to manual mode either after every directive line or after a --makeclip line.

The --ffplay command can be run repeatedly (plays the video file already specified by --moviefile) with different start/end times and fadein/outs until the user is satisfied. Then typing --makeclip with the same values generates the desired clip and appends it to the Sequence. Finally the --concatenate command can be run. At any time the --print (or -p) seq command can be used to examine the Sequence and directives to move, copy or remove clips can be input. Also --ffplay KEY will play the existing clip file with that key.

For some video file types like .mp4, ffplay covers the whole screen and it is difficult to see other windows. The directive --ffplayoptions_g -x xsize -y ysize fixes this.

--record. It is useful to record the directives to a text file, both those read from the file and those manually typed. The record file is flushed to disk after every write. After closing the User can then simply edit that, remove unnecessary lines and make a new directives file.

Troubleshooting

Try the following in this order (mainly to reduce chance I have to do any work!):
Look at the log file after elevating the debug reporting level.
On the command line use --log DEBUG. Then look at the log file clipstitch.log. This is updated every session, with logged output timestamped and appended to the file. Open this file and go to the bottom to see the most recent entry. nb: When the file size reaches 100KB, it is renamed clipstitch.log.old and a new clipstitch.log is started. By default it is located in the installation folder, although Python users can change it to the current working directory by editing clipstitchshared.py.
Examine the sequence and metadata of the clip files, such as height, width, frames/sec.
Use --print clips/--print seq.
ffprobe
Run ffprobe outside Clipstitch on the input video file or output clip file to get details, as there could be something wrong with it.
Direct FFmpeg
On occasion you need to alter a video file directly with ffmpeg before giving it to Clipstitch.
Not finding ffmpeg/ffplay/ffprobe?

If the location of the installed ffmpeg distribution has not been specified correctly, correct it by either setting the $PATH variable, or place a --ffmpeg_folder pathname line early in your directives file before the first --makeclip or --ffplay directive so that Clipstitch will use the execs in that folder.

But it is also good to be able to use ffmpeg/ffplay/ffprobe from the command line independently. To fix that, ensure that your $PATH variable points to the correct place, or at least do for the 3 ffmpeg executables what I suggested with clipstitch.bat in the installing for Windows section above.

Finally, on Linux sometimes ffplay is not made if you build it yourself. Here is what fixed it:

18th Apr 2020
Stuff I had to do to build ffmpeg. Problem was that ffplay executable was not getting built.
1) Downloaded ffmpeg-4.2.2 tar from ffmpeg site
2) The SDL library was missing from my computer. So yum install SDL2 and yum install SDL2-devel
3) USE_SDL=/usr/bin/sdl2-config and then export USE_SDL   (not sure if necessary but did these)
4) ./configure --prefix=$HOME --enable-ffplay --pkg-config=pkg-config --disable-x86asm | tee configure4.out
   Not sure if I needed the --pkg-config. An earlier configure attempt told me to do the disable-x86asm
 5)  cd ffbuild/ 
 6) grep -i ffplay config.mak    should see:
FFMPEG_CONFIGURATION=--prefix=/home/tonse --enable-ffplay --pkg-config=pkg-config --disable-x86asm
CFLAGS-ffplay=-D_REENTRANT -I/usr/include/SDL2
EXTRALIBS-ffplay=-lSDL2
CONFIG_FFPLAY=yes
7) cd.. then make | tee make4.out
8) make install      Should put the new execs into your $HOME/bin directory.

Also instead of doing a Build you can get (an older) version from Redhat's rpmfusion repository:
1) If you don;t already have rpmfusion set up as a repo, follow the instructions here
https://www.2daygeek.com/install-enable-rpm-fusion-repository-on-centos-fedora-rhel/
to set up several new repos called something like rpmfusion-blahblah.repo
2) yum list ffmpeg
3) yum install ffmpeg should put the 3 ffpmeg, ffprobe and ffplay executables into /usr/bin
	

Upgrade
Check that the problem has not been fixed in a later version
Ticket
Start a Ticket at Sourceforge/Clipstitch page.
Email me
Address at top of page.

Assorted Topics

User Tips

Save often when running a directives file. If you are working with a lot of input movie files there is nothing more frustrating than having a crash after processing most of them. Use the --writeclips, --writeseq, --record directives.

Some advice on movie-making:

  • Try not mix portrait and landscape, i.e. orient your camera one way or the other. Spielberg doesn't do it. Neither should you.
  • Some digital cameras take a while to focus while panning. Either pan slowly or choose a fixed focus setting instead of autofocus if doing that.
  • Try not to walk and shoot, it comes out bumpy and irritating, plus your voice shakes and makes you sound emotional.
  • Make an introduction clip, preferably pointing at yourself and then panning around, introducing the topic, saying where and when it was taken. And perhaps a similar ending clip too. If you forget you can always fake one later.
  • If you screw up narrating a clip, just keep shooting and repeat (without the screw up) what you said.
  • Say "Action" and "Cut". It helps later when editing. And maybe onlookers think it sounds cool.
  • Make sure you yourself appear in sufficient clips. I've made movies with friends on an outing and they tell me I'm the only one not in it!
  • Comb your hair, shave (males only) and generally look smart. Since any shots of you will probably be selfie-closeups it easily shows up in the final product if you look like a vagabond.

Direct FFmpeg Commands

Sometimes you need to alter a video file directly with ffmpeg before giving it to Clipstitch. Usually because one or more of the video files are incompatible with the others due to different file format/resolution/size/frame rate. Perhaps you got some of the video files from a different device or from a friend, or you changed your cameras settings between video files. In this case use FFmpeg directly on the file. Below are some useful commands. Online FFmpeg documentation is also available, their Wiki's Miscellaneous section is especially good.

ffmpeg -i infile1.mov outfile.mpeg
Change video file format from Quicktime (.mov) to Mpeg
ffmpeg -i infile1.MOV -vf transpose=1 outfile.mov
Rotate. transpose =1/2 goes 90 degrees clockwise/anticlockwise
ffmpeg -i infile.mov -vf scale=scale=w=iw/2:h=ih/2 outfile.mov
To resize a movie use the video filter "scale", here shrinks by x2
ffmpeg -i infile.mov -vf scale=320:200 outfile.mov
To resize to have output height and width of 320x200 pixels
ffmpeg .... -vf scale=320:-1 ...
Preserve aspect ratio while resizing
ffmpeg .... -vf scale=-1:200 ...
Preserve aspect ratio while resizing
ffmpeg -i f1 -i f2 -filter_complex concat=n=2:v=1:a=1 outfile
Manual concatenation of files f1 and f2 to make outfile. n=# of files,v and a are the number of streams for video and audio. Usually one each unless the audio is in stereo.
ffmpeg -i concat:"input1.mpg|input2.mpg" -c copy output.mpg
Another method of concatenating, but seems to work only for Mpeg files
ffmpeg -i sound1.mp3 -i sound2.mp3 -filter_complex "[0:a:0][1:a:0]concat=n=2:v=0:a=1[outa]" -map "[outa]" outfile.mp3
This concatenates two sound-only files
ffmpeg -ss t1 -i input.mov -t t2 output.mov
Select the portion between time t1 and t1+t2 of a file
ffmpeg -i moviefile.mpg -ss 7 -t 0.2 -f image2 test%03d.jpg
To extract stills from a file. Will extract all frames from time 7 to 7.2, roughly 6 frames I found, and put in files test001.jpg, test002.jpg...test006.jpg
ffmpeg -ss 7 -i infile.mpg -frames:v 1 outfile.jpg
To extract a single still from a file at t=7 secs.
ffplay -f lavfi mandelbrot
Fun
ffmpeg -f lavfi -i mandelbrot -t 10 outfile.mov
Fun

File Descriptions

Zip/tar contents:

clipstitch.py
Main program & code to loop through directives file or manual directives.
clipstitchio.py
Code to process input arguments from command line and directives file.
clipstitchshared.py
Module to hold data to be shared between the other Clipstitch modules. (Like an old Fortran Common block.)
clipstitchclasses.py
class definitions and member functions.
randomstring.py
Utility to generate random strings of specified length and with some control over the characters used, and (optional) guarantee of non-collision, i.e. non-repetitive strings
listutil.py
Utility with simple list-manipulating functions.
getfilenameext.py
Utility: given a file, (either with full path, partial path or no path), return file name and type as 2 strings
ffprobe.py
An interface to the ffprobe utility. Obtained from Pypi. Written by Simon Hargreaves.

The pre-built Linux executable is also an option:

clipstitch5.6.2_Linux.exe
Executable binary

The MS Windows distribution consists of the the sole file:

clipstitch5.6.2.exe
Executable binary

Other files (created later, these all reside in the same folder as the distribution files):

clipstitch.log
A log file maintained and updated every session, with logged output timestamped and appended to the file. When the file size reaches 100KB, it is renamed clipstitch.log.old and a new clipstitch.log is started.

Internal Workings

Program Flow: The program reads instructions from a text file containing directives that are then parsed with argparse. With each line read:

  • sometimes a variable is reset (eg. --folder, --moviefile, --desc, ...)
  • sometimes options for the next FFmpeg operation are set (--fadein/out, --mute, ...)
  • sometimes Clipstitch is told that a system call to FFmpeg is to be made once the reading of the line is complete (--makeclip, --concatenate, --backandforth, --burst)
  • flow goes to Manual mode (--manual or --manualafter)
  • or reading terminates (--endread)
  • ...
  • Blank lines and comment (#) lines are ignored

The --makeclip directive uses the subprocess module to call ffmpeg on an input video file and produce an output video file clipped from the input. An instance of class Clip() is made and contains metadata of both files. Use --print clips to see what kind of info is stored. Each clip is identified by a random string of ascii chars (currently 3 capital alphabets). The length of that can be changed in LENRANKEY in clipstitchshared.py. An ffmpeg command is then constructed from the various options used, and a subprocess call is executed to run ffmpeg on the video file, making an output video file with the same name and the 3 letter key appended to the name. The Clip() does not contain output video file itself, which sits on disk. Multiple Clips can be made from a single input video file. A list of Clips is maintained and can be written/read back to output pickle file with --writeclips and --readclips.

The 3-letter name of the clip is also appended to the sole instance of class Sequence. This contains little more data than a list of the 3-letter keys, but Sequence() has many member functions to reorder, copy, replicate and remove the Clips in it. Clips in the Sequence instance are rearranged (as in Sample Session #2) using these member functions.

Reading of the directive file then continues.

During the final concatenation, which occurs with --concatenate, an ffmpeg command containing the files corresponding to the keys in the Sequence is constructed, and executed via subprocess command. The actual command used can be seen in the log file. The --concatenate command produces a final movie file from the clips in Sequence(). It can also be used to concatenate a subset of keys in Sequence.

Release Notes & SHA256SUMS

Dates and Comments of past releases
ReleaseDateComment
3.5.228th Sept 2018#-----#
3.5.318th Oct 2018Log file can be written to current working directory
4.128th Mar 2020Converted code to Python 3.8.x from Python 2.7.x.
5.315th Apr 2020Version_Number 5.1.2 onward: --ffmpeg_folder option to replace --ffmpeg_exe Replace optparse with argparse. Update help. Restructure main() so that --outputfile is not treated so anomalously, add functionality to -outputfile and rename it --concatenate and concatenate range of clips, not just all clips in Seq1. Incorporate the ffprobe code directly into the Clipstitch, credit Simon Hargreaves correctly. If --ffmpeg_folder in specified then ffmpeg/probe/play all 3 use the location to find the .exe files. Option -ffplay a file just as --makeclip would make a clip file. --lineditmode renamed --manual. New option --manualafter sets manual entry mode to be automatic after either every line, --makeclip lines or off. Add option --record to record interactively entered commands. -p --print clip ID to print a particular clip or range of clips --concatenate a list of clips or range of clips (latter must be in Seq1) --record more informative. --record with no args just list out current state of ComRec1 Made the subprocess shell issue robust: A static, ie shared class data called subprocess_shell_value in Commands() is given a value somewhere at an early init stage and if --ffmpeg_exec_folder is used. Test with subprocess shell mode True or False and set subprocess_shell_value to the one that works. Use ffprobe (called via func fileprobe in clipstitchclasses.py) to properly calculate fadeout in cases where final time is the end of the clip specified by "e". --sizeffplayscreen sets the x and y sizes of ffplay's screen. Because for type .mp4 video files it was using the whole screen and could not see the times on the console behind. subprocess calls modified, to not use capture_outout because pre Py 3.7 it was not allowed. In Set_shell_value use ffmpeg -version not ffplay because Linux problem compiling ffplay. Also fixed logic there. Now Set_shell_value only called when first --makeclip/--ffplay encountered, but before they take action. setexecfolder now checks for existence of excutables with and wo ".exe" because in Linux there is no .exe
5.511th June 2020Version_Number 5.4. onward: Additional options to pass along to ffmpeg: 3 types: global, input and output. Set with --ffmpegoptions_g, --ff..._i and --ffm..._o respectively. e.g. in order to have better copying set: --ffmpegoptions_o -c:v libx264 -crf 18 -c:a copy. Note cannot use "copy" codec if using fade filters etc. These will be inserted into the ffmpeg (not for ffplay/ffprobe) command line for makeclip and for concatenate. --ffplayoptions_g is for ffplay. --selectclip,--sc, if no args, prints current value. --ffplay option to accept an existing Key as sole argument. --backandforth to do repetitive reverse then forward of a clip section --burst to do a burst effect of frames. --captions --captionproperties to allow -vf drawtext to be used to draw a caption on a movie clip when --makeclip used. --slidetool to make video from stills.
5.64th January 2021--stutter feature re-introduced again. Set #streams for concatenation on the fly if all files being concatenated agree, although can be overruled by new --concatnstreams option.








The SHA256SUM hashing algorithm is is a guard against malicious tampering of a file by an outsider. To verify that a file you downloaded has the same SHA256SUM as the table below. :

  • On Unix/Linux/Apple type sha256sum filename
  • On MS Windows type certutil -hashfile filename SHA256
The value you get should agree with the value in the table below. if not, inform me

SHA256SUMS of releases
Release 3.5.2
SHA256SUMFilename
87ee632e4933803719399846eb4d33204ba9ab71dc1e9573ec1f068ec5f4968d setup_Clipstitch_3.5.2.exe
Release 5.3.7
SHA256SUMFilename
4e0909b5dd7ffce87ad62dd2897639052cda7784bad2380ca102954dde97387e Clipstitch_5.3.7.tar
33a6815078e2c58c97a8be8683444353c4b216df33281d736dd58706dda28cab ClipstitchSource_5.3.7.zip
b7b5543eae86a7c2d0c6df8d281cd608f855a7c40ae18e149a9df4ec369c5e9f clipstitch5.3.7.exe
fe430722f325ca6d62a1ca2606d8bc4b32872981e4e584e5e79e5fb8483f8498 clipstitch5.3.7_Linux.exe
Release 5.5.8
SHA256SUMFilename
3ed433d5816f2ae21c430d5ff68ed152338251863769ada4fd61168b5d5d2bd7 Clipstitch_5.5.8.tar
a3934e5b52900b36e4f93a0f17754cab2eeca1b5c7d14a12c871c19b0985b8ca ClipstitchSource_5.5.8.zip
d81621146a73a7acfa6e6fc5638810b84bfb66f10ea9d14166902a50c4c58ae7 clipstitch5.5.8.exe
25b5085ee440ee99132de7b70939cefb6648bffd228d5dcc256300db77a1429c clipstitch5.5.8_Linux.exe
Release 5.6.2
SHA256SUMFilename
313061d3f9dcb43f5d89c34449a11eda909d763d955d20f528358193fba75f79 Clipstitch_5.6.2.tar
b52a3b69125c0b5fa72061c3cc1acf947ddb15620527bbe87028d57f406a3a92 ClipstitchSource_5.6.2.zip
d69a714bc143ac3b544e79ae028cdfb88b6e6557d5864318968c230441d6d5b7 clipstitch5.6.2.exe
d7ddf9ec03ac12236b90a763cbc58559c2602a257429d582dcf5d297fc219f26 clipstitch5.6.2_Linux.exe

Outdated Features

  • --lineditmode replaced by --manual
  • --ffmpeg_exec_name replaced by --ffmpeg_folder
  • --outputfile replaced by --concatenate
  • --sizeffplayscreen replaced by --ffplayoptions_g

Acknowledgements

Thank you very much to the following people for:

Tools and libraries
The authors of ffmpeg.
The authors of the Pyinstaller utility
The authors of the Ffprobe module: Simon Hargreaves





Last updated: