Modular Media Server - User Guide - Basic Modular Media Server implementation
Modular Media Server |
---|
Introduction |
Building and Installation |
User Guide |
Contact Us |
Basic x86 Modular Media Server Implementation
In the case that you don't want to use the command-line interface, you can use the Media Server class. To show the use Media Server class, let's build the next basic media group.
To interact with a Modular Media Server, a Media Server instance must be initialized.
logger = ConsoleLogger() media_server = MediaServer(logger)
Next, we will create the source, encoder, and file container media group description, as follows:
source = [ { "type": "V4L2CaptureEntity", "entity": "/dev/video0", "input_name": "none", "output_name": "0", } ] encoder = [{ "type": "X86EncoderEntity", "entity": "vaapih264enc", "input_name": "0", "output_name": "1", } ] file = [{ "type": "FileRecorderEntity", "entity": "mp4mux", "input_name": "1", "output_name": "video_test.mp4", } ]
Next, we are going to create the three media groups:
media_server.create_media_group("sourcer_media_group", source) media_server.create_media_group("encoder_media_group", encoder) media_server.create_media_group("file_media_group", file)
We start the pipelines and let them run for 25 seconds:
media_server.start("sourcer_media_group") media_server.start("encoder_media_group") media_server.start("file_media_group") time.sleep(25)
Finally, stop the pipeline. A file with the name of "video_test.mp4" will be generated in the project directory.
media_server.stop("sourcer_media_group") media_server.stop("encoder_media_group") media_server.stop("file_media_group")