This repo holds code and associated elements for automatically generating annotated WAVE mezzanine content from raw source material. The annotations in the resulting multimedia files are used by the WAVE test suite to programmatically identify content parameters and to verify various elements of performance. The WAVE Project is an industry interoperability effort for streaming internet video supported by over 60 companies and hosted by the Consumer Technology Association. For more information on the WAVE Project, the WAVE test suite, please see CTA.tech/WAVE or email standards@CTA.tech.”
The steps to create annotated WAVE mezzanine content have been combined into a single Python script mezzanine.py
.
The mezzanine.py
script does the following to the source content:
Adds a low density bit pattern for each frame that signals:
Note: The QR code is intended for black-box testing of devices using a camera to capture the video output, without requiring manufacturer involvement. The bit pattern is intended for white-box testing, where the video is processed directly within a device.
assets/boundaries.png
).0x006400
) color frame to indicate the start of the video,
and a dark red (0x8B0000
) frame to indicate the end of the video.Video output configured to minimise lossy nature of transcoding and preserve properties of source content. The codec used depends on source content color space:
Note: These codecs are used to ensure the properties of the content are signalled correctly. A more appropriate mezzanine video codec or raw YUV data may be used in future.
Requirements:
Using the provided requirements.txt
, execute the following to install the Python dependencies:
pip install -r requirements.txt
Associated assets:
boundaries.png
, boundaries.xcf
, red_triangle.xcf
frame boundary markers overlay created in GIMPCousine-Regular.ttf
monospaced font from the Cousine font familyTools:
Mezzanine sources:
For example, you can execute the following command to produce an annotated mezzanine file:
py mezzanine.py --duration 60 --framerate 30 --label J1 --qr-positions 4 --resolution 1280x720 --seek 00:01:25 --start-end-indicators enabled --font assets/Cousine-Regular.ttf --window-len 6 --tonemap disabled --version 2 --spec-version 1 --metadata-only disabled source/tearsofsteel_4k.mov _mezzanine/tos_J1_1280x720@30_60.mp4
The full details of the available commands for the script can be found by executing py mezzanine.py -h
The metamezz.py
Python script enables generation of multiple annotated mezzanine streams with a single command,
using mezzanine.py
to generate each annotated mezzanine file.
The requirements for metamezz.py
are the same as for mezzanine.py
.
At least one source file and an output file prefix pair must be specified, for example:
py metamezz.py source1.mov source1_output_prefix
Additional parameters determine the specific annotated mezzanine files to generate (see further).
WAVE annotated mezzanine filenames use the following template:
<prefix>_<label>_<WxH>@<fps>_<duration>.mp4
Where:
prefix
is a short string based on the source content used, e.g. "tos" for Tears of Steel.label
is a short string used to identify a particular piece of test content, e.g. "A1", "L1", "L2".W
and H
are the horizontal and vertical resolutions in pixels.fps
is the frame rate.duration
is the duration of the annotated mezzanine content, in seconds.For example: croatia_O2_3840x2160@50_60.mp4
or tos_L1_1920x1080@60_60.mp4
To generate a complete set of WAVE mezzanine content you can execute the following 2 commands:
py metamezz.py "source\tearsofsteel_4k.mov" _mezzanine\tos "source\tearsofsteel_4k.mov" _mezzanine\tos "source\DVB_PQ10_VandV.mov" _mezzanine\croatia -rjf rjf\resolutions_15_30_60_fractional.json rjf\resolutions_15_30_60_non-fractional.json rjf\resolutions_12.5_25_50.json --tonemap disabled disabled enabled --spec-version 1 --version 2
py metamezz.py "source\tearsofsteel_4k.mov" _mezzanine\splice_main_tos "source\tearsofsteel_4k.mov" _mezzanine\splice_main_tos "source\DVB_PQ10_VandV.mov" _mezzanine\splice_main_croatia "source\Big Buck Bunny trailer_1080p30.mp4" _mezzanine\splice_ad_bbb "source\Big Buck Bunny trailer_1080p30.mp4" _mezzanine\splice_ad_bbb "source\Big Buck Bunny trailer_1080p.mov" _mezzanine\splice_ad_bbb -rjf rjf\splice_main_resolutions_30_fractional.json rjf\splice_main_resolutions_30_non-fractional.json rjf\splice_main_resolutions_25.json rjf\splice_ad_resolutions_30_fractional.json rjf\splice_ad_resolutions_30_non-fractional.json rjf\splice_ad_resolutions_25.json --tonemap disabled disabled enabled disabled disabled disabled --spec-version 1 --version 2
This assumes the source files are located in the source
folder, and the JSON files in the rjf
folder.
The annotated mezzanine files generated are saved to the _mezzanine
folder,
with the prefixes tos
and croatia
for the main mezzanine content,
and with the prefixes splice_main_tos
, splice_main_croatia
and splice_ad_bbb
for the splicing mezzanine content.
Tone-mapping is enabled for the croatia content, as the source is HDR,
but the desired output for the mezzanine content is SDR.
The mezzanine release version is set to 2,
and the corresponding WAVE Test Content Format Specification version is set to 1.
The following set of JSON files is used to generate all WAVE annotated mezzanine content.
These JSON files are passed to metamezz.py
using the -rjf
parameter.
The JSON structure used is:
{ "WIDTHxHEIGHT" : [ [framerate (str), duration in seconds (float), starting position in source (str, HH:MM:SS), label (str), number of variants (int), add second audio track (bool)], [...] ]}
Multiple combinations of frame rate, duration, start position, label and variants (with/without second audio track) can be defined for each resolution.
Details of the available commands for the script can be obtained by executing py metamezz.py -h
Here is a brief description of the parameters:
-m enabled || disabled
disables mezzanine generation and only (re)generates JSON metadata using existing mezzanine
files. The source and output mezzanine files must both be present at the paths provided.-r <string_containing_JSON>
or -rjf <path_to_JSON_file>
that provide JSON defining the following properties
of the generated mezzanine content:
--tonemap [enabled || disabled, ...]
enables or disables rudimentary tone-mapping to BT.709 SDR for each input file,
to create SDR mezzanine streams using an HDR source.
Provide one value, and it will apply to all input source files.
Alternatively, provide one value per input source file, separated by a space.--test 1 || True
is a flag indicating a test run, which will parse the parameters and list the streams to generate,
but won't actually generate the streams.The metamezz.py
script uses the following parameter defaults that can only be modified in the script,
as they are not expected to be changed often, for consistency reasons:
mezzanine.py
in the same folder.boundaries.png
is expected to be in the assets
folder.Cousine-Regular.ttf
and is expected to be in the assets
folder.The add_second_audio_track.py
Python script uses the pyttsx3
library
to create an audio file with the spoken audio "English". This is mixed with the original audio of a mezzanine file,
repeating the spoken audio every 15 seconds.
The script makes a copy of a mezzanine file, incorporating the new audio track as a second audio track. The first audio track remains the same as in the original mezzanine file.
The output file naming convention is as follows:
<mezzanine_stream_name>_2ndAudio[English].<mezzanine_stream_file_extension>
Usage example:
add_second_audio_track.py tos_A1_480x270@30_60.mp4
creates tos_A1_480x270@30_60_2ndAudio[English].mp4
Additional requirements: