Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
58dd163
Add .gitattributes for line-ending handling
smarquard Oct 11, 2017
34e7171
Add backticks for core count
smarquard Oct 11, 2017
34475a7
Normalize all the line endings
smarquard Oct 11, 2017
13555d0
Disable board detection
smarquard Oct 11, 2017
86e14ef
Typo
smarquard Oct 11, 2017
e928c8a
OPENCAST-1538 Add frame padding at start to preserve A/V sync
smarquard Oct 12, 2017
c056360
Skip reading the file for board segmentation
smarquard Oct 12, 2017
b1e11a5
Double precision for FPS and update some output messages
smarquard Oct 13, 2017
1e1b6d4
Add a target frame-rate parameter (and some info output)
smarquard Oct 13, 2017
1981aa9
OPENCAST-1538 Output cropping co-ordinates rather than write out the …
smarquard Oct 16, 2017
01b805d
OPENCAST-1538 Initial commit - use ffmpeg libs to crop output file
smarquard Oct 17, 2017
407822a
Write out co-ords without []s for easier parsing
smarquard Oct 17, 2017
24c5ea9
Merge branch 'master' of https://github.com/cilt-uct/trackhd
smarquard Oct 17, 2017
27ed121
Implement cropping, add dummy frames prior to keyframe
smarquard Oct 17, 2017
53f28a9
Ignore test files
smarquard Oct 17, 2017
c948af2
Set quality as per this param buried deep in the encoder context options
smarquard Oct 17, 2017
19878a1
Adjust the output frame PTS to start from 0
smarquard Oct 17, 2017
d4052e3
Quality tweaks
smarquard Oct 17, 2017
b4c4b59
Simplify logging
smarquard Oct 19, 2017
df33624
Update build script and docs for cropvid
smarquard Oct 19, 2017
c670cfc
Drop reference to FOURCC codec for now because it's not used by track…
smarquard Oct 19, 2017
f8d8d9e
Remove unused code
smarquard Oct 21, 2017
ccf085f
Small log changes
smarquard Oct 21, 2017
8396a75
Add option to set y crop height. Resolves #23
smarquard Oct 22, 2017
4a0e95d
Merge branch 'master' of https://github.com/cilt-uct/trackhd
smarquard Oct 22, 2017
462cf9a
Update cropvid with attribution
smarquard Oct 23, 2017
6a3ce4e
First crop co-ordinates start at y=0 instead of correct position
smarquard Oct 23, 2017
bdcbcdc
Merge remote-tracking branch 'upstream/master'
smarquard Oct 24, 2017
0edd644
Handle cases where PTS timestamps in source video are not monotonic.
smarquard Oct 25, 2017
a6bfddb
Merge remote-tracking branch 'remotes/upstream/master'
smarquard Nov 7, 2017
07c8058
Merge remote-tracking branch 'remotes/upstream/master'
smarquard Nov 11, 2017
6b84558
Merge remote-tracking branch 'upstream/master'
smarquard Nov 12, 2017
03fc7da
Set the output container time_base to be the same as the input contai…
smarquard Nov 13, 2017
99e6cb4
Add sample wrapper script and config file for use in an Opencast work…
smarquard Feb 13, 2018
e30a726
Example configuration for Galicaster
smarquard Jun 13, 2018
4f1ed5a
Sample Opencast workflow operation and execute service config
smarquard Jun 13, 2018
97c4a03
Add the tag and untag operations for Opencast example
smarquard Jun 13, 2018
652ce63
Update of Readme.md
maxtrix Jun 25, 2018
761f13e
Updated with the features from the LectureTracking Repo
mliradelc Jul 5, 2018
a083f8b
Added ssh_track4k.py script and workflows examples to work with this …
mliradelc Jul 10, 2018
ad19c2d
cleaned code
mliradelc Jul 10, 2018
218b5e4
typing mistakes
mliradelc Jul 10, 2018
1530773
Merge branch 'master' of https://github.com/mliradelc/trackhd
mliradelc Jul 10, 2018
e34f4a0
Created some python scripts for testing features
mliradelc Jul 13, 2018
8243715
Update to gitignore file
mliradelc Jul 13, 2018
deb489a
Solved error in trackhd_server.py
mliradelc Jul 16, 2018
44a5949
Re-organized folders, uploaded new approach (Pyro method) to not to u…
mliradelc Jul 19, 2018
012fdd7
- Update to Track4KPyro Utility - Update to Readme.md from root folde…
mliradelc Aug 2, 2018
97acb96
Merge branch 'dev-pyro'
mliradelc Aug 2, 2018
c7e21cb
Correction to readme.md of utils
mliradelc Aug 2, 2018
0d73458
Minor corrrection to utils/readme.md
mliradelc Aug 2, 2018
7cab5e9
Improve of Ansible Playbook
mliradelc Aug 3, 2018
ffac72d
Improve in playbook of trackhd server and documentation
mliradelc Aug 7, 2018
c162ec4
bug corrections
mliradelc Aug 7, 2018
4418c8d
Improve in Track4K scripts and Ansible playbook. Cleaned up the code.
mliradelc Aug 8, 2018
9e3fa82
Minor adjustments for release
mliradelc Aug 8, 2018
b54db2b
Remove of the deprecated solutions in /utils.
mliradelc Aug 23, 2018
5686bb7
Hot_Fix: Log folder address in ansible is set
mliradelc Sep 24, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,13 @@ CMakeCache.txt
Makefile
boardCropCoordinates.txt
Track4K
*.pyc
__pycache__/
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
.retry
135 changes: 90 additions & 45 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,21 @@
Track4K is an open source C++ project that takes a High Definition video of a lecture recording and then produces a smaller cropped output video, which frames the lecturer. This is done using image processing and computer vision algorithms to track the lecturer and uses the lecturer position information to pan the virtual camera.

## Getting Started

> If you want to use right away go to [this link](/utils/Ansible_Playbook) to install Track4K automatically.

These instructions will help get the program and all its dependencies set up on your machine.

> Please take note that this installation guide It was made for use under Ubuntu 16.04, some changes may apply for other distributions or Ubuntu variations.

> All the commands are run as normal user unless if its written as super user "\#"





### Prerequisites
These instructions are written with the assumption that the project will be installed on a Linux-based system (preferably a Debian version). Track4K has been tested on Ubuntu 16.04
These instructions are written with the assumption that the project will be installed on a Linux-based system (preferably a Debian version). **Track4K has been tested on Ubuntu 16.04**

To be able to run this project, you will need to first install the following dependencies:

Expand All @@ -16,85 +27,117 @@ These instructions are written with the assumption that the project will be inst
* CMake (3.8.0 or future releases)
* git (2.10.2 or future releases)

### Installation

#### FFmpeg
The standard repositories of your distribution may include FFmpeg 3.4+. If not, FFmpeg 3.4 can be built from source (more on that topic [here](https://github.com/FFmpeg/FFmpeg/blob/master/INSTALL.md)).

For Ubuntu-based distributions, the PPA `ppa:jonathonf/ffmpeg-3` allows for simpler installation without the needing to build from source. The PPA can be added as follows:
## Installation of the requirements


First go to any folder to work with the files that will be downloaded and installed. Next, install the dependencies in the order are written

### Basic libraries

```
$ sudo add-apt-repository ppa:jonathonf/ffmpeg-3
[Press enter when prompted]
$ sudo apt-get update
sudo apt update
sudo apt install git build-essential libgtk2.0-dev pkg-config
```

#### Downloading and Installing base dependencies
The first on the install list (and most important) is CMake, followed by git, C++ and various multimedia packages.
The following terminal command will get and install the necessary requirements
### CMAKE

```
$ sudo apt-get install cmake git build-essential libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev libavfilter-dev libx264-dev libx265-dev libvpx-dev liblzma-dev libbz2-dev libva-dev libvdpau-dev
wget https://cmake.org/files/v3.11/cmake-3.11.4-Linux-x86_64.sh
sudo mkdir /opt/cmake$ sudo sh cmake-3.11.4-Linux-x86_64.sh --prefix=/opt/cmake --skip-license
sudo update-alternatives --install /usr/bin/cmake cmake /opt/cmake/bin/cmake 1 --force</code></pre>
```

#### Downloading and Installing the OpenCV libraries
The next step is to download and install the OpenCV libraries.
The necessary OpenCV library comes in two components. First download the core OpenCV library. Choose any directory as your download destination directory.
Clone OpenCV from Git as follows:
### C and C++

The C and C++ libraries from Ubuntu's official repositories are older than the libraries required. It's needed to have the C and C++ from version 6.3 or newer.

#### Install the repository with the updated versions of C and C++
```
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt update
```
$ cd `your_chosen_working_directory`
$ git clone https://github.com/opencv/opencv

#### C Libraries installation
```
Next, repeat the process for the Extra modules. Remain in the same working directory and execute the following terminal command:
sudo apt install gcc-7
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 60 --slave /usr/bin/gcc-ar gcc-ar /usr/bin/gcc-ar-7 --slave /usr/bin/gcc-nm gcc-nm /usr/bin/gcc-nm-7 --slave /usr/bin/gcc-ranlib gcc-ranlib /usr/bin/gcc-ranlib-7
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 60 --slave /usr/bin/gcc-ar gcc-ar /usr/bin/gcc-ar-5 --slave /usr/bin/gcc-nm gcc-nm /usr/bin/gcc-nm-5 --slave /usr/bin/gcc-ranlib gcc-ranlib /usr/bin/gcc-ranlib-5
```

#### C++ Libraries installation
```
$ git clone https://github.com/opencv/opencv_contrib
sudo apt install g++-7
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-7 60
```
You should now have two folders in your working directory.
The next step is to build OpenCV.

#### Building the OpenCV library
Your Chosen directory now contains two folders, opencv and opencv_contrib. The opencv folder contains the main OpenCV libraries and opencv_contib contains the extra modules.
### Install FFMPEG 3

#### FMPEG Main appllication
```
$ cd `your_chosen_working_directory`
sudo add-apt-repository ppa:jonathonf/ffmpeg-3
sudo apt update
sudo apt install ffmpeg
```
Inside the main OpenCV folder, change directory into the build folder (create one if it does not exist) and remove all files, since it will require rebuilding. To rebuild OpenCV run the following command from within the build folder:

#### FFMPEG Development libraries
```
$ cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
sudo apt install libavcodec-dev libavformat-dev libavfilter-dev
sudo apt install libx265-dev libx264-dev libvpx-dev libbz2-dev libvdpau-dev libva-dev liblzma-dev
```
This step will generate a MakeFile. Once complete perform the following command to run make faster (the number after the j-flag is the number of processors the job will use). If you are not sure how many processors the machine has use the following instruction to find out:

## Installation of Track4K

#### Clone the repositories:
```
cat/proc/cpuinfo | grep processor | wc -l
git clone https://github.com/opencv/opencv
git clone https://github.com/opencv/opencv_contrib
git clone https://github.com/cilt-uct/trackhd.git
```
Use the result from this in the j-flag

#### Install OpenCV

> **Note: Track 4K works with version 3.4 of OpenCV, prerelease of V4.0 makes compilation errors.**

In the OpenCV directory, Change to the 3.4 branch, next, build the program
```
$ make -j`processor_count`
cd opencv
git checkout --track remotes/origin/3.4
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
```
Remain in the build folder and run the following cmake command to make the extra modules.
The path decribed below is an example. Fill in the directory path on your machine which points to the OpenCV Extra modules folder.

Once complete perform the following command to run make faster (the number after the j-flag is the number of processors the job will use). If you are not sure how many processors the machine has use the following instruction to find out:
```
cmake -DOPENCV_EXTRA_MODULES_PATH=`OpenCV_Extra_Modules_Folder_Path`/modules ../
cat /proc/cpuinfo | grep processor | wc -l
```
Next step is to make these files:

Use the result from this in the j-flag

```
$ make -j8
make -j`processor_count`
```

Finally, install these modules by running the following command:
Remain in the build folder and run the following cmake command to make the extra modules. The path described below is an example. Fill in the directory path on your machine which points to the OpenCV Extra modules folder.

```
$ sudo make install
cmake -DOPENCV_EXTRA_MODULES_PATH=<Repositories folder path>/opencv_contrib/modules ../
```

After that compile and install the files:

```
make -j`processor_count`
sudo make install
```

#### Building Track4K

##### Automatic Method

There is a shell script in the trackhd folder called intall_track4k.sh which can be used to install track4k automatically.
There is a shell script in the trackhd folder called `install_track4k.sh` which can be used to install track4k automatically.
To use this script run the following command:

```
Expand All @@ -107,12 +150,13 @@ This will run all the steps listed in the manual method mentioned below.

This method is for the case where the automatic method does not work. It does everything the shell script does manually.

The trackhd directory should have 2 main folders inside it: source and build. The source folder comntains all the header and source files while the build file contains all object files and executables.
The trackhd directory should have 2 main folders inside it: source and build. The source folder contains all the header and source files while the build file contains all object files and executables.
The first step is to navigate into the build folder. Once inside run delete all files (if any) and then type the following command in terminal:

```
cmake ../source
```

Now it is possible to run the build instruction:

```
Expand All @@ -134,15 +178,15 @@ cp cropvid /usr/local/bin/

#### Running Track4K

Track4K runs in two parts: track4k analyzes a video file and produces a cropping data file in text format. cropvid crops the
Track4K runs in two parts: track4k analyses a video file and produces a cropping data file in text format. cropvid crops the
video file according to the cropping information in the data file, using ffmpeg libraries.

```
$ track4k <inputFileName> <outputFileName> <output-width> <output-height>
$ cropvid <input file> <output file> <cropping file>
track4k <inputFileName> <outputFileName> <output-width> <output-height>
cropvid <input file> <output file> <cropping file>
```

Example:
**Example:**

```
track4k presenter.mkv presenter-crop.txt 1920 1080
Expand All @@ -165,7 +209,8 @@ The program reads a maximum of 29 frames into memory at a time. So a minimum of

## Built With

* [OpenCV](http://www.opencv.org) - The computer vision library of choice
[OpenCV](http://www.opencv.org) - The computer vision library of choice
[FFFMPEG](https://www.ffmpeg.org) - A complete, cross-platform solution to record, convert and stream audio and video.

## License

Expand Down
32 changes: 32 additions & 0 deletions examples/galicaster/conf.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Galicaster configuration for recording 4K video from Axis 1428 IP camera for Track4K
# https://github.com/teltek/Galicaster/issues/459
# Requires Galicaster 2.1.0 or later

[basic]
custom_flavors=presenter4k

[track1]
name = audio
device = pulse
flavor = presenter
location = alsa_input.usb-BurrBrown_from_Texas_Instruments_USB_AUDIO_CODEC-00.analog-stereo
file = audio.flac
vumeter = True
amplification = 1.0
player = True
audioencoder = deinterleave name=d d.src_0 ! audioconvert ! flacenc
active = True
delay = 0.2

[track2]
name = presenter
device = rtp
flavor = presenter4k
location = rtspt://VENUE-cam01.uct.ac.za/axis-media/media.amp
file = presenter.mkv
cameratype = h264
audio = False
muxer = matroskamux
caps-preview = video/x-raw,framerate=1/1
active = True

42 changes: 42 additions & 0 deletions examples/opencast/ingest-track4k.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<!-- Include these operations in the Opencast workflow after ingest -->

<!-- Run track4k on presenter-4k/source to presenter/source -->
<operation
id="execute-many"
fail-on-error="true"
retry-strategy="hold"
exception-handler-workflow="uct-error"
description="Track4K">
<configurations>
<configuration key="exec">/opt/opencast/wfexec/track4k.pl</configuration>
<configuration key="params">#{in} #{out} ${event_location}</configuration>
<configuration key="source-flavor">presenter4k/source</configuration>
<configuration key="source-video">true</configuration>
<configuration key="output-filename">tracked.mkv</configuration>
<configuration key="target-flavor">presenter/source</configuration>
<configuration key="target-tags">archive</configuration>
<configuration key="expected-type">Track</configuration>
<configuration key="load">2.0</configuration>
</configurations>
</operation>

<!-- Tag the sources for archival -->
<operation
id="tag"
description="Tagging source material for archival">
<configurations>
<configuration key="source-flavors">*/*</configuration>
<configuration key="target-tags">+archive</configuration>
</configurations>
</operation>

<!-- Untag track4k -->
<operation
id="tag"
description="Exclude 4K presenter source from archive">
<configurations>
<configuration key="source-flavors">presenter4k/source</configuration>
<configuration key="target-tags">-archive</configuration>
</configurations>
</operation>

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Sample configuration for Opencast Execute Service

# Load factor
job.load.execute = 1.0

# The list of commands, separated by spaces, which may be run by the Execute Service.
# A value of * means any command is allowed.
# Default: empty (no commands allowed)
commands.allowed = /opt/opencast/wfexec/track4k.pl

7 changes: 7 additions & 0 deletions examples/opencast/track4k.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"em4": { "output-size": "1080p" },
"m209": { "output-size": "1620p" },
"hoerilt1": { "output-size": "1080p", "y_top" : 650 },
"hoerilt2": { "output-size": "1080p", "y_top" : 750 },
"nlt": { "output-size": "720p" }
}
Loading