Crop and Segment Video

Here I offer you a program that will scan through all of the PRAAT textgrids in a folder, and for each it will search for the named textgrid tier.  Then it will loop through each segment in that tier, find the ones with text in them, and cut clips from a video with the exact same base-name based on those time stamps.  Each video will be cropped to the region given in the cropping variable (currently set for the Logiq E ultrasound).

The program uses R as a wrapper to load PRAAT textgrid files, uses a PERL program textgrid2csv.pl (copyright Theo Veenker <T.J.G.Veenker@uu.nl>) to make a CSV file usable in PRAAT, and work with that data.  

Therefore: 1) You have to extract audio from the video file you want to crop and segment, and transcribe and label that video in a PRAAT textgrid to the detail you want to use for each cropped video file (usually a word or phrase). 2) Go into the code, and change all the variables at the top according to your needs.

Lots of work, but this program will still save you heaps of time.  It is especially useful if you are using AAA for ultrasound analysis but only have video instead of AAA’s proprietary ultrasound file storage format.

Note, I provide sample data in the zip file to test the program – a swallow used for a palate trace.  Get the program to run with the sample before you modify it for your own purposes.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.