We are introducing a system for automatically tracking pig locomotor behaviour. Transposing methods for the video-based tracking of rodent behaviour engenders several problems. We have therefore improved existing methods, based on image-subtraction, to offer increased flexibility and accuracy in tracking large-sized animals in situations with a constantly changing background. The improved tracking algorithms introduce a reference frame, which does not include the animal and is automatically updated, and implementation of an automatic threshold detection algorithm. This makes the system more robust to the tracking environment, which could even be of the same colour as the animal, and allows the tracking environment to change during recording. We validated the system by estimating the repeatability, accuracy, and basic noise level, and tested the system in different levels of animal activity evoked by administration of apomorphine (APO) to minipigs in an open field test. Seven pigs each received the vehicle and three doses of APO (0.05, 0.1, and 0.3 mg/kg i.m.), and the locomotor behaviour of each session was recorded for 60-min. The calculated coefficient of repeatability was 0.6%, indicating high repeatability and the basic noise level of the tracking system was estimated to be 2%. Administration of the two lowest doses of APO was accompanied by increased locomotor activity of the pigs. Thus, this digital video-based tracking system for automatically tracking the spontaneous locomotor behaviour of pigs is highly reliable and accurate, and was able to detect well-known effects of APO in pig locomotor activity.