IMF Conversion Utility
- IMF media conversion utility allows to handle flat file creation from a specified CPL within the IMF package.
- Please find Mac OS X installation and usage notes in Getting Started OS X Guide.
Contents
Build
The project can be built very easily by using the included Gradle wrapper. Having downloaded the sources, simply invoke the following commands inside the folder containing the sources:
$ ./gradlew clean
$ ./gradlew build
JDK requirements
- The project can be built using JDK-8 only (not JRE!).
- JAVA_HOME must be set and 'java' must be in the PATH.
Distribution
After the project is built, the distribution is created in the 'build' folder of the root project
./build/imf-conversion-utility-{version}.tar
./build/imf-conversion-utility-{version}.zip
as well as in
./imf-conversion-main/build/distributions
The distribution includes
- All necessary .jar files in the lib folder (lib/imf-conversion-utility-{version}.jar contains the Main Class).
- Start scripts in the bin folder.
- Default tools used by the utility in the tools folder.
- Sample config.xml in samples folder.
- License.
- README
- Sample metadata.xml and audiomap.xml in samples folder.
Usage
- IMF Conversion utilities uses a number of external tools to perform full conversion cycle.
- The external tools are not distributed with the Utility, and must be prepared by the user.
- The user just specifies the executables in config.xml.
- The utility creates tmp files (which will be deleted when the conversion job finishes). So make sure that there is enough free disk space.
Conversion to DPP format
- [Done Once] Prepare external tools used for conversion.
- [Done Once; edit when needed] Prepare config.xml.
- Run Utility with appropriate command line arguments to generate metadata.xml to enter DPP metadata values.
- dpp
- --mode [-m] metadata
- --output [-o] metadata.xml
- Enter required DPP metadata values manually (DPP_MMS_TechMetadata).
- [Optional] Run Utility with appropriate command line arguments to generate audiomap.xml to map input audio tracks and channels to the output ones depending on the AudioTrackLayout parameter set in metadata.xml.
- dpp
- --mode [-m] audiomap
- --output [-o] audiomap.xml
- [Optional] Edit audiomap.xml to map input audio streams and channels.
- Run conversion job:
- dpp
- --mode [-m] convert (may be omitted as it's a default mode)
- --config [-c] config.xml
- --metadata metadata.xml
- --audiomap audiomap.xml (optional)
- --imp path-to-imp-folder (optional: can be set in config.xml)
- --cpl CPL.xml (optional: can be set in config.xml)
- --working-dir [-w] path-to-output-folder (optional: can be set in config.xml)
- -- output [-o] the output .mxf file name (as well as .stl file name) without extension (optional: if not set, 'output' default name will be used).
- An output flat file is created under the specified output directory (-w) and is called output.mxf.
- Logs:
- The current conversion job log file: /logs/imf-utility.log.
- Previous conversion jobs log files: /logs/archive.
- External tools log files: {output-dir}/logs.
- Validation
Note 1:
- DPP format requires special Program Layout as defined in Section 4.5 of BBC.
- Currently the Utility doesn't insert additional elements from 09.59.30.00 till 10.00.00.00 (Bars, clocks, lineup tone) and doesn't freezes the last frame for 5 seconds.
- The Utility just sets the start time to 09.59.30.00.
- So, in order to have a correct program layout, the user must insert required elements on IMF level (that is add segments with required video and audio data):
- Start:
- 20 seconds of 100% Bars on the Video with EBU Lineup tones on the audio;
- 7 seconds of black and silence;
- 5 frames of slate (white text on black background) with silence on audio;
- 2 seconds and 19 frames of black and silence;
- End of program:
- 5 seconds of freeze frame from last program video frame with silence.
Prepare external tools used for conversion
-
Get FFMPEG FFMPEG
-
Get x264 Encoder x264. 10-bit version must be used!
-
Get BMX: bmx2raw and raw2bmx applications from tools directory. tools/bmx directory contains proper BMX tools
snapshots because latest BMX tools include MCA implementation and if we have incorect MXF audio file (without MCA
label id property) mxf2raw exits with exception and does not extract audio data.
-
Get ASDCP tool. Please build it from https://github.com/DSRCorporation/asdcplib-as02 repository.
This is a fork from from http://www.cinecert.com/asdcplib/ which is enhanced to work properly with TTML wrapped in MXF.
There is a Windows distribution there which can be used out of the box on Windows (TBD).
Prepare config.xml
-
A sample config.xml can be found in the /samples folder.
-
Required External Tools
-
Optional External Tools
-
IMF package and CPL
-
Output directory
-
Allows/disallows silent conversion
-
Clear Output directory
-
It can be configured whether to perform IMF validation of the input IMF package (Photon is used by default for validation).
Generate metadata.xml
- Metadata.xml is needed to enter the DPP metadata values needed for conversion and the output container (DPP_MMS_TechMetadata).
- The following command generates a sample metadata.xml
imf-conversion-utility dpp -m metadata -o metadata.xml
- The user can enter the values and they will be applied for the output MXF.
- The metadata.xml is a required parameter for conversion to DPP format.
- Please note that all timestamps are in SMPTE timecode format (hh:mm:ss:ff), where ff is in range [0,24] for 25 fps.
Generate audiomap.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<AudioMap xmlns="http://audiomap.dpp.imfutility.netflix.com">
<EBUTrack>
<Number>1</Number>
<CPLVirtualTrackId>urn:uuid:63b41d86-c5df-4169-b036-3a25024bd711</CPLVirtualTrackId>
<CPLVirtualTrackChannel>2</CPLVirtualTrackChannel>
</EBUTrack>
<EBUTrack>
<Number>2</Number>
<CPLVirtualTrackId>urn:uuid:63b41d86-c5df-4169-b036-3a25024bd711</CPLVirtualTrackId>
<CPLVirtualTrackChannel>1</CPLVirtualTrackChannel>
</EBUTrack>
<EBUTrack>
<Number>3</Number>
<CPLVirtualTrackId>urn:uuid:63b41d86-c5df-4169-b036-3a25024bd712</CPLVirtualTrackId>
<CPLVirtualTrackChannel>1</CPLVirtualTrackChannel>
</EBUTrack>
<EBUTrack>
<Number>4</Number>
<CPLVirtualTrackId>urn:uuid:63b41d86-c5df-4169-b036-3a25024bd712</CPLVirtualTrackId>
<CPLVirtualTrackChannel>2</CPLVirtualTrackChannel>
</EBUTrack>
</AudioMap>
Run Conversion Job
-
If IMP, CPL and working directory are set in config.xml, and no custom audiomap is needed, then run the following command:
imf-conversion-utility dpp -c path-to/config.xml -m convert --metadata path-to/metadata.xml -o outputName
-
If IMP, CPL and working directory are set in config.xml, and a custom audiomap is needed, then run the following command:
imf-conversion-utility dpp -c path-to/config.xml -m convert --metadata path-to/metadata.xml --audiomap path-to/audiomap.xml -o outputName
-
A full command if IMP, CPL, and working directory are specified via command line arguments (the values from command line override values from config.xml):
imf-conversion-utility dpp -c path-to/config.xml -m convert --imp path-to/imp --cpl CPL.xml -w path-to/working-dir --metadata path-to/metadata.xml --audiomap path-to/audiomap.xml -o outputName
Output and Logs
-
An output flat file and captions files are created under the specified output directory (-w) and called {outputName}.mxf and {outputName}.stl, where {outputName} is a value of --output (-o) parameter.
If --output parameter is not set, then output.mxf and output.stl values are used.
{output-directory}/{outputName}.mxf
{output-directory}/{outputName}.stl
or
{output-directory}/output.mxf
{output-directory}/output.stl
-
The current conversion job log file:
/logs/imf-utility.log
-
Previous conversion jobs log files:
/logs/archive/
-
External tools log files
{output-directory}/logs
Conversion to iTunes format
- [Done Once] Prepare external tools used for conversion.
- [Done Once; edit when needed] Prepare config.xml.
- [Optional] Run Utility with appropriate command line arguments to generate metadata.xml to enter iTunes metadata values.
- itunes
- --mode [-m] metadata
- --output [-o] metadata.xml
- Enter required metadata values manually (Tunes Film Package or Tunes TV Package) or specify custom
metadata.xml file. After conversion done metadata.xml of resulting iTunes package can be invalid (missing some required data) and will require manually changes.
- [Optional] Run Utility with appropriate command line arguments to generate audiomap.xml to map input audio tracks and channels to the output ones.
- itunes
- --mode [-m] audiomap
- --output [-o] audiomap.xml
- [Optional] Edit audiomap.xml to map input audio streams and channels. If audiomap will not be set then default
audiomap will be used basis on essence descriptions if exist or by natural order.
- Run conversion job:
- itunes
- --mode [-m] convert (may be omitted as it's a default mode)
- --config [-c] config.xml
- --metadata metadata.xml
- --audiomap audiomap.xml (optional)
- --imp path-to-imp-folder (optional: can be set in config.xml)
- --cpl CPL.xml (optional: can be set in config.xml)
- --working-dir [-w] path-to-output-folder (optional: can be set in config.xml)
- --vendor-id vendor identifier
- --package-type [-p] iTunes package type film (default) or tv (optional)
- --format [-f] video format (optional)
- --trailer trailer asset location (optional, processed only for "film" package type)
- --poster poster asset location (optional)
- --chapters chapters.xml location (optional, processed only for "film" package type)
- --cc a path to external closed captions (optional)
- –-sub a paths to external subtitles (optional, processed only for "film" package type)
- --fallback-locale main locale for iTunes package (optional, will be used if CPL or metadata locale is not set)
- An output iTines package is created under the specified output directory (-w) and is called vindor-id.itmsp.
- Logs:
- The current conversion job log file: /logs/imf-utility.log.
- Previous conversion jobs log files: /logs/archive.
- External tools log files: {output-dir}/logs.
- Validation
- To validate iTunes package against XML schema of metadata.xml official iTunes Transporter tool can be used. Transporter can
validate assets too but need corresponding iTunes Connect account credentials.
Note 1:
- iTunes Package format requires special Audio Layout as defined in iTunes Asset Guide for corresponding package type.
- To print all supported iTunes destination video formats run command with appropriate arguments:
Prepare external tools used for conversion
iTunes version of the utility on OS X used native Apple ProRes encoder that provided by PrEnc utility that can be found at GitHub PrEnc pero. Download PrEnc sources and follow installation instructions from README.md:
- open the Terminal application
-
download sources
$ wget https://github.com/DSRCorporation/prores-encoder-mac/archive/master.zip
-
unzip the archive
$ unzip master.zip
-
change dir to unpacked source directory
$ cd prores-encoder-mac-master
-
run make command
$ make RELEASE=1
-
install
sudo make install
Other tools installation is the same tools as for DPP tools.
Prepare config.xml
The same process as for DPP config preparation.
Generate metadata.xml
- Metadata.xml is needed to enter the iTunes package metadata.
- Metadata can be fixed in any time when iTunes package done according to correct values
- The following command generates a sample metadata.xml
imf-conversion-utility itunes -m metadata -o metadata.xml
Generate audiomap.xml
<?xml version="1.0" encoding="UTF-8"?>
<audiomap xmlns="http://netflix.com/imf/itunes/audiomap">
<mainAudio locale="de-DE" name="main-audio.mov">
<Option6/>
</mainAudio>
<alternativeAudio locale="ja" name="audio_JA.mov">
<Option6>
<Track1>
<L>
<CPLVirtualTrackId>urn:uuid:850bd841-5c4a-4b02-b853-5ce1afbb3629</CPLVirtualTrackId>
<CPLVirtualTrackChannel>1</CPLVirtualTrackChannel>
</L>
<R>
<CPLVirtualTrackId>urn:uuid:850bd841-5c4a-4b02-b853-5ce1afbb3629</CPLVirtualTrackId>
<CPLVirtualTrackChannel>2</CPLVirtualTrackChannel>
</R>
</Track1>
</Option6>
</alternativeAudio>
</audiomap>
Run Conversion Job
The same process as for DPP run conversion except that output is a iTunes store package with
.itmsp name.
#### Output and Logs
The same as for [DPP](output-and-logs).
## Project Structure
* The project is a Java project.
* JDK-8 is required.
* The project is a Gradle multi-project.
* Findbugs and Checktyle are used for code quality.
* It contains the following sub-projects:
* __imf-conversion-main (imf-conversion-utility)__
* The main project.
* Contains the main class.
* Contains conversion.xml which describes external tools to be used for conversion for each format.
* Contains log4j configuration.
* Creates a final distribution.
* Depends on conversion plugins to be included into the distribution.
* __imf-conversion-common__
* Contains logic common for all Java projects.
* __imf-conversion-core__
* Main IMF utility logic base for all formats.
* Contains CPL processing logic.
* Calls IMF validation.
* Contains the logic of parsing conversion.xml and executing external tools.
* A base project for all plugins.
* __imf-essence-descriptors__
* An independent project that contains JAXB classes of IMF Essence schemas.
* __dpp-conversion__
* A plugin to perform conversion to BBC DPP format.
* Depends on imf-conversion-core and dpp-conversion-input-xsd
* __dpp-conversion-input-xsd__
* A plugin containing XSDs for DPP format input XML files (metadata.xml, audiomap.xml).
* It's separated from _dpp_conversion_ as there are other projects that require DPP metadata.xml (for example, ttml-to-stl).
* __itunes-conversion__
* A plugin to perform conversion to iTunes Package format.
* Depends on imf-conversion-core, itunes-conversion-input-xsd, itunes-metadata-film and itunes-metadata-tv
* __itunes-conversion-input-xsd__
* A plugin containing XSDs for iTunes format input XML files (metadata.xml, audiomap.xml).
* __itunes-metadata-film__
* An independent project that contains JAXB classes of iTunes Film Package 5.2 XML schema.
* __itunes-metadata-tv__
* An independent project that contains JAXB classes of iTunes TV Package 5.2 XML schema.
* __ttml2itt__
* An independent project to perform TTML to iTunes iTT subtitle conversion.
* It's used as a default subtitle conversion tool by iTunes plugin.
* The project fat jar (ttml2itt.jar) is copied into the 'tools' folder within delivery.
* Depends on ttml-java
* __ttml-java__
* An independent project that contains JAXB classes of ttml-cr-ttaf1-20100223 TTML schemas.
* __ttml-to-stl__
* An independent project to perform TTML to EBU STL caption conversion.
* It's used as a default caption conversion tool by DPP plugin.
* The project fat jar (ttml-to-stl.jar) is copied into the 'tools' folder within delivery.
* __imf-validation__
* An independent project to IMF package validation.
* Uses Photon under the hood ([Photon](https://github.com/Netflix/photon)).
* It's used as a default IMF validation tool.
* The project fat jar (imf-validation.jar) is copied into the 'tools' folder within delivery.