Skip to content

Instantly share code, notes, and snippets.

@ballerabdude
Last active September 6, 2017 17:46
Show Gist options
  • Save ballerabdude/845c2d6e8485e838a27b22c7f7b15751 to your computer and use it in GitHub Desktop.
Save ballerabdude/845c2d6e8485e838a27b22c7f7b15751 to your computer and use it in GitHub Desktop.
How to install and use Manzanita for caption embedding

Install the Manzanita applications

Create work dir
mkdir ~/Downlaods/manzanita
cd ~/Downlaods/manzanita
MP2TSME
wget --user=<USER> --password=<PASSWORD> www.manzanitasystems.com/manzuser/dwbavr.zip
MP4Mux
wget --user=<USER> --password=<PASSWORD> www.manzanitasystems.com/manzuser/etzqgz.zip
Unzip with credentials
unzip -P <PASSWORD> -o dwbavr.zip
unzip -P <PASSWORD> -o etzqgz.zip
This may fail if the version changes
tar -xvzf mp2tsme-8.1.78.x86_64.tgz
tar -xvzf mp4mux-3.0.9.x86_64.tgz
Create sys link
ln -s manzanita/mp4mux/mp4mux /usr/bin/mp4mux
ln -s manzanita/mp2tsme/mp2tsme /usr/bin/mp2tsme
Configure license
Only needs to happen once

Fully automated way to configure the license

$ (echo 3; echo <manzanitaLicenseServer>; echo y; echo <manzanitaCustomerKey> ) | mp4mux -liccfg
$ (echo 3; echo <manzanitaLicenseServer>; echo y; echo <manzanitaCustomerKey> ) | mp2tsme -liccfg

Running the application

Using Manzanita embedding(608/708) captions is a 4 step process.

  1. Demux the mp4's elementary streams using MP4Mux.
  2. Embed the scc sidecar file into the h.264 video elementary stream using MP2TSME.
  3. Create an MP4Mux config file.
  4. Mux the new video elementary stream that has captions with the audio stream using MP4Mux.

Steps

Create Work Dir
$ mkdir ~/Desktop/manzanita
$ cd ~/Desktop/manzanita
Download required files
$ wget <location of an mp4> -O source.mp4
$ wget <location of an scc caption file> -O caption.scc
Demux the source mp4
$ mp4mux -dd source.mp4 1 source.h264 2 source.aac
Embed the the caption into elementary stream to produce a new file called source_ecc.h264
$ mp2tsme -c source.h264 source_ecc.h264 caption.scc
Create the MP4Mux config file
$ echo 'mp4mux-config 2,0
       output: {/Users/<USER>/Desktop/manzanita/source_ecc.mp4}
       delivery-target: Disabled
       movie-fragments: Disabled
       fragment-time: 2.0
       major-brand: mp42
       free-box: Before-mdat
       tracks [
         video [
           filename: {/Users/<USER>/Desktop/manzanita/source_ecc.h264}
           track-id: 1
         ]
         audio [
           filename: {/Users/<USER>/Desktop/manzanita/source.acc}
           track-id: 2
         ]
       ]
       /mp4mux-config
' > config.cfg
Run MP4Mux to generate the new mp4 with embedded Closed Captions
$ mp4mux config.cfg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment