Create and publish streams from a folder of images, videos and livefeeds.
MIT License
Create and publish streams from a folder of images, videos and livefeeds. Just place your arbitrary images and videos in the ./data/contents/
folder and run the application. By utilizing gStreamer and OpenCV the images will be livestreamed to a channel or locally. JSON files with links to webcam or other live feeds can also be used. The stream can then be sent to various media servers. The current implementation is only a MVP (Minimum Viable Product) and more features will be added further on. Check out the ./data/config.json
file to change settings.
// TODO:
To be fair, I am quite rusty in C++
, which motivates the decision to create a new project in C++
. The focus with the project is to create clean and good practice code towards high performing computing. Video streaming is a computer resource heavy task which fit perfectly. The application is strongly coupled to gStreamer and OpenCV which are great libraries to learn when renewing one's code language skills. This was also a great opportunity for me to try out the MediaMTX
project.
The general usercase is as follows:
./data/contents/
folder. (Optionally remove the examples)./data/config.json
to change general settings such as output location, playlist order, overlays and animations.NOTE: For fast run use ./run.sh
it will trigger docker-compose and then open VLC or gStreamer to visualize the stream if installed.
Firstly install dependencies as in the Dockerfile
.
Then compile, build and run the application by running the following command:
cmake -S . -B build && cmake --build build && ./build/StreamChannelAssembler
NOTE: The main advantage with running locally is that the stream can be viewed locally without an X-server. Using docker though, the project build will be volumed, which means the project can then be run locally but built in docker container.
This repository has been dockerized. Install docker and run command below.
It is recommended to use mediaMTX in docker, which means the video will be streamed to an url, which can be collected using vlc or gStreamer. This can be accomplished by running the commands below or using the ./run.sh
script. The build will also be volumed, which means you can run the application locally too.
# Build and run the container and stream
docker-compose up
# View Stream in vlc (if installed!) by running
vlc rtsp://localhost:554/livestream
The built project is volumed to the local folder ./build
.
The data folder is also volumed so as to share the content with the docker container easily.
Unit Tests are written using Catch2
, they are linked to github actions. Tests will be built with the rest of the project. //TODO: update this
These are some examples of streams that can be added to the content folder except for videos and images. //TODO:
{
"name": "Test Video Example",
"type": "video",
"target": "videotestsrc ! videoconvert ! appsink",
"length": 20, // how many seconds the live stream should play
"start": 0 // where in the stream we should start
}
NOTE: Comments using "//" are not allowed in json syntax, so remove the comments if you are trying this example out.
{
"name": "Local Webcam Example",
"type": "video",
"target": 0,
"length": 20,
}
These JSON objects can be seen as defining the input to the application.
This list show supported datatypes in a table.
FileType | ContentType | Explanation | Status |
---|---|---|---|
.png | Image | Std. Type | |
.jpg | Image | Std. Type | |
.jpeg | Image | Std. Type | |
.json | GStreamer | Define a gStreamer command to appsink. See gstreamer_example.json | |
.json | FFMPEG | Define a FFMPEG command to app. See ffmpeg_example.json | |
.json | Video | Define a file or command as video. See webcam_example.json | |
.json | Audio | Define a file or command as audio. See radio_example.json | |
.json | Image | Define a file or command as image. | |
.mp4 | Video | Std. Type | |
.avi | Video | Std. Type | |
.mov | Video | Std. Type | |
.gif | Video | Gif:s are seen as video. | |
.mkv | Video | Std. Type | |
.mp3 | Audio | Std. Type |
How the formats are handled by the media processors are illustrated in the figure below.
These links are relevant too know when running the docker-compose file.
This is a list of known issues that hopefully will be solved in near future:
This project is under the MIT license, read more here.
Copyright (c) 2023 Grebtsew