View Source MPEG-4 container plugin for Membrane Framework

Hex.pm API Docs CircleCI

This plugin provides utilities for MP4 container parsing and serialization along with elements for muxing the stream to MP4 or CMAF.

installation

Installation

The package can be installed by adding membrane_mp4_plugin to your list of dependencies in mix.exs:

defp deps do
[
	{:membrane_mp4_plugin, "~> 0.15.0"}
]
end

usage

Usage

membrane-mp4-muxer-isom

Membrane.MP4.Muxer.ISOM

ISOM muxer requires a sink that can handle Membrane.File.SeekEvent, e.g. Membrane.File.Sink. For an example of muxing streams to a regular MP4 file, refer to examples/muxer_isom.exs.

To run the example, you can use the following command:

elixir examples/muxer_isom.exs

You can use MP4_OUTPUT_FILE environment variable to set location of the output file (defaults to example.mp4).

### Membrane.MP4.Muxer.CMAF For an example of muxing streams into CMAF format, refer to examples/muxer_cmaf.exs. CMAF requires a special sink, regular Membrane.File.Sink will not work correctly. Currently, Membrane Framework has only one sink capable of saving a CMAF stream - Membrane.HTTPAdaptiveStream.Sink.

To run the example, use the following command:

elixir examples/muxer_isom.exs

You can expect hls_output folder to appear and be filled with CMAF header and segments, as well as a HLS Playlist. To play the stream, you need to serve the contents of the output folder with some sort of HTTP Server. If you are looking for something quick and simple, you can use Python's SimpleHTTPServer:

cd hls_output && python -m SimpleHTTPServer 8000

HLS Stream can then be played with

ffplay http://localhost:8000/index.m3u8

## Updating tests

In case out_* reference files in test/fixtures/cmaf change, out_playlist.m3u8 and its dependent playlists should be updated and checked if they are still playable. The current files have been checked with ffplay (FFmpeg) and Safari.

## Copyright and License

Copyright 2019, Software Mansion

Software Mansion

Licensed under the Apache License, Version 2.0