Precision livestock monitoring promises greater management efficiency for farmers and higher welfare standards for animals. Recent studies on video-based animal activity recognition and tracking have shown promising solutions for understanding animal behavior. To achieve that, surveillance cameras are installed diagonally above the barn in a typical cattle farm setup to monitor animals constantly. Under these circumstances, tracking individuals requires addressing challenges such as occlusion and visual appearance, which are the main reasons for track breakage and increased misidentification of animals. This paper presents a framework for multi-cattle tracking in closed barns with appearance and motion models. To overcome the above challenges, we modify the DeepSORT algorithm to achieve higher tracking accuracy by three contributions. First, we reduce the weight of appearance information. Second, we use an Ensemble Kalman Filter to predict the random motion information of cattle. Third, we propose a supplementary matching algorithm that compares the absolute cattle position in the barn to reassign lost tracks. The main idea of the matching algorithm assumes that the number of cattle is fixed in the barn, so the edge of the barn is where new trajectories are most likely to emerge. Experimental results are performed on our dataset collected on two cattle farms. Our algorithm achieves 70.37%, 77.39%, and 81.74% performance on HOTA, AssA, and IDF1, representing an improvement of 1.53%, 4.17%, and 0.96%, respectively, compared to the original method.