Cow Log 2009
Cow Log 2009
net/publication/24274563
CITATIONS READS
208 800
2 authors:
All content following this page was uploaded by Laura Hänninen on 19 May 2014.
HELDA - The Digital Repository of University of Helsinki - Terms and User Rights
By using HELDA - The Digital Repository of University of Helsinki you are bound by the following Terms & Conditions.
Please read them carefully.
All material supplied via HELDA is protected by copyright and other intellectual property rights, and duplication or sale of all
or part of any of the repository collections is not permitted, except that material may be duplicated by you for your research
use or educational purposes in electronic or print form. You must obtain permission for any other use. Electronic or print
copies may not be offered, whether for sale or otherwise to anyone who is not an authorised user.
Behavior Research Methods
2009, 41 (2), 472-476
doi:10.3758/BRM.41.2.472
We have developed CowLog, which is open-source software for recording behaviors from digital video and is
easy to use and modify. CowLog tracks the time code from digital video files. The program is suitable for coding
any digital video, but the authors have used it in animal research. The program has two main windows: a coding
window, which is a graphical user interface used for choosing video files and defining output files that also has but-
tons for scoring behaviors, and a video window, which displays the video used for coding. The windows can be used
in separate displays. The user types the key codes for the predefined behavioral categories, and CowLog transcribes
their timing from the video time code to a data file. CowLog comes with an additional feature, an R package called
Animal, for elementary analyses of the data files. With the analysis package, the user can calculate the frequencies,
bout durations, and total durations of the coded behaviors and produce summary plots from the data.
Most behavior observations rely on video recordings CowLog is the only solution that can be used without
because direct observation has a high risk of disturbing any software costs, because it works on free operating
the observed subject. The observer scores the video data, systems. This makes it especially appealing to students.
usually with the help of behavior coding software. For The use of the GPL license means that the source code
complex video readings, the observer needs to be able is available to all users, and users are free to use, modify,
to move forward and backward in the video, as well as and redistribute the source code. Therefore, future devel-
to use different playback speeds. To read such video data opments of open-source software, unlike developments
successfully and fluently, the coding program needs to be of freeware, are not dependent on a single developer.
able to track the video time code accurately. Digital video recorders use a variety of different video
For behavioral recording from the videos, one can use formats to encode video, and thus it is also important
different sampling methods. When recording behaviors that the coding software has the ability to be used with as
continuously, one records each time the behavior occurs many formats as possible without the need to transcode
(frequency), the length of the behavioral sequence (bout the video.
duration), and the total time the subject exhibits each Several behavioral data collection programs are avail-
of the behaviors during the time period. During instan- able, some of which are also freeware. However, these are
taneous behavioral recording, an observed behavior is not open-source programs and operate only in Microsoft
scored in predefined time intervals. During one–zero Windows—mfor example, Etholog (Ottoni, 2000), which
sampling, the observer records only frequencies—for ex- does not read the video time code, and ODCS (MacLin
ample, whether the behavior occurs (frequency) during & MacLin, 2005), which supports only mpeg and AVI
the observed time periods (Martin & Bateson, 1995). video formats and does not provide any analysis tools.
We have developed the open-source software CowLog More powerful programs, such as The Observer (Nol-
for recording behaviors from digital video. CowLog is dus, Wageningen, The Netherlands), also read the video
easy to use and modify, and tracks the time code from time code and have multiple analysis tools; however, The
video files and records the time with the coded behavior Observer is expensive and its license is restricted to a
to a data file. The program is suitable for coding any predefined number of computers. In many studies, the
digital video, but the authors have used it only in animal user needs only the simpler features of programs, such
research. as coding the video and calculating total duration, bout
The new program is different from existing, similar duration, and frequencies from the data.
software in three significant ways: (1) CowLog is the The aim of this article is to introduce CowLog as a
only software targeting Linux and BSD operating sys- new open-source tool for behavioral research. We pre-
tems, (2) it is open-source software released under the sent information on the basic features, use, and struc-
GNU GPL license, and (3) it supports all popular video ture of the software and also present the basic behavioral
codecs, because it uses MPlayer as a video player. analysis of the data using a package called Animal for
M. Pastell, [email protected]
Use
Before starting the behavioral observations, the user
must assign behavioral codes. The behavioral class is a set
of behaviors, in which each occurrence is exclusive (i.e.,
the subject can either stand or walk, but not both). The
behaviors belonging to parallel classes may occur simul-
taneously (e.g., standing and eating).
At the moment, the program consists of three behav-
ioral classes, each with eight behaviors. The names for the
key codes are always the same (numbers from 1 to 24).
The user decides which key code represents each of the
coded behaviors. No initial setup is needed, since the key
code definitions are always the same; however, the user
needs to keep track of codes elsewhere. The user should
also note that in this program the behavioral states (i.e.,
behaviors for which the user wants to record both the oc-
currence and duration) and events (behaviors for which
only the number of occurrences is recorded) are defined
Figure 1. The coding window of CowLog. The name of the video in the analysis stage. Coding is performed continuously
file being used is shown in the upper file dialog, and the user-
defined name for the data file under it. B1, B2, and B3 are the
behavioral classes available for the scoring, and squares below
show the status of the users’ previous recordings in each of the
behavioral classes. The left column of keys are the operator keys
for the video window.
CowLog
Table 1 point, which makes the removal of the wrong codes pos-
Example Output From the Software sible while using the descriptive analyses function.
Time (sec) Code
1.3 3 Software Description and System Requirements
49.3 4 The recommended operating system for CowLog is
53.7 3 Ubuntu Linux 8.04 (Canonical Ltd.), but it has also been
71.6 4
97.5 3 tested with FreeBSD 7.0 (The FreeBSD Project). The pro-
103.7 4 gram should run on most Linux and BSD distributions,
140.5 3 as well as Mac OS X (Apple Inc.), provided the software
159.3 4 dependencies are met. CowLog supports all video formats
171.0 3
playable with MPlayer (which means most common video
formats). The codecs for the required video formats need
to be installed on the computer.
by logging the time each behavior starts. In the analysis The program consists of a graphical front end made
stage, the type of the behavior is given as an input for the with Kommander 1.3 (Britton, King, Laffoon, & Man-
analysis function, and the start time of the next state is tja, 2008), and it uses the MPlayer media player running
used as the end time of the previous state. Accordingly, in slave mode to show the video files and read the time
the start time of events is used to mark the occurrence code. A set of underlying shell and Gawk (Robbins, 2007)
of a behavior. An example output from the software is scripts are used to pass commands between the graphical
shown in Table 1. user interface and MPlayer.
After the program has been started, the user defines Because of its modular structure, the program needs
the video observation file to be used for coding and the other software packages to run. All of the dependencies
prefix and location of the data files. After the files have are open source and can be easily installed in Ubuntu
been defined, the user simply presses the start button to using the graphical package manager. The following soft-
start coding. The user can enter the scores by pressing the ware packages are needed by CowLog.
buttons in the coding window (Figure 1) or by pressing Kommander 1.3. Kommander is a tool for creating
keyboard shortcuts. Each of the behavioral classes has a graphical applications with a simple user interface. Kom-
representative display from which the user can follow the mander produces noncompiled dialogs and very small
five last-entered codes. If the user wants to code several applications that run fast and can be distributed without
behaviors with the same time code, he or she pauses the binary compatibility issues. It was used to create the cod-
video, enters the codes, and resumes playing. The cod- ing window of the CowLog, and the commands passed on
ing is ended simply by closing the program, and can be to MPlayer are called from Kommander scripts.
directly resumed to the same data files by moving to the MPlayer. MPlayer is a movie player that runs on many
correct position in the video. The program does not auto- systems. It plays almost all existing video formats, such
matically give the user the resuming point; the user needs as MPEG/VOB, AVI, Ogg/OGM, ASF/WMA/WMV, and
to check the time stamp in the last row of the data file. DivX 3/4/5. CowLog runs MPlayer in slave mode to play
The user can run the video at different speeds—up the videos and read the time codes.
to five times the normal speed. To ease the search for a Gawk. Gawk is a GNU implementation of the popular
wanted point in a video, CowLog can automatically jump Awk programming language (Robbins, 2007). The Awk
30 sec forward or backward. utility interprets a special-purpose programming language
CowLog saves the outputs for each behavioral class in that makes it possible to handle simple data-reformatting
separate data files. The output files have the extensions jobs with just a few lines of code. CowLog calls Gawk to
.bh1, .bh2, and .bh3, where the number corresponds to the format the output from MPlayer to a cleaner form before
behavioral class. The files contain the complete data of the writing to the data file.
observed sessions. The program saves the data after each
scoring, so that no data are lost if the computer crashes or Example Output From the Software
is disconnected. CowLog writes the output files in plain text format. The
Coding errors are easy to remove manually from the data output data are organized in columns: The first column shows
files after the recording has finished. Users can also define the time in seconds from the beginning of video recording,
one key code in each of the classes as an error key. Pressing and the second column represents the behavioral key code
this key after the coding error has occurred marks the data (Table 1). Each row represents each of the observations.
Table 2
An Example Output From the Analysis Function
Behavioral Feature Standing Still Locomotion Lying Down Hidden
Frequency 270 269 30 9
Bout length (min) 0.8 0.37 37.33 4.03
Total duration of behaviors (min) 214.81 99.35 1,120.03 36.28
CowLog 475
Order
observations
by time
Show
table of
results
Plot
results
Figure 3. A flowchart showing the operation of the main analysis function in the Animal
R package.
120
80
60
40
20
Behavior
Figure 4. An example output from the analysis function: A boxplot of the bout
duration, in minutes, for different scored behaviors.