Packaging on-demand media

File Packager location

The File Packager is available from the following locations:

The File Packager requires several libraries to run. These libraries are located in the f4fpackager folder. To move the File Packager, move the f4fpackager folder and all its contents.

Input file formats and output file formats

To stream on-demand media over HTTP, process the file with the File Packager. The File Packager parses the content, translates it into segments and fragments, and writes the segments and fragments to the F4F format. You can also choose to have the File Packager encrypt the content for use with Flash Access.

The File Packager supports the following file formats:

  • F4V/MP4 compatible files

  • FLV

Important: The file formats can contain any codec the format supports, except Speex audio. You can package a file that includes Speex audio, the File Packager does not throw an error, but the audio will not play. The packager can package video-only and audio-only streams.

The File Packager outputs the following files:

File type

Description

.f4f

A segment. The tool outputs one or more F4F files. Each file contains a segment of the source file. Each segment contains one or more fragments of content. A player can use a URL to address each fragment.

.f4m

Flash Media Manifest file. Contains information about codec, resolution, and the availability of multi-bitrate files.

.f4x

Index file. Contains the location of specific fragments within a stream.

.bootstrap

Bootstrap file. Contains the bootstrap information for each segment of the file. The tool creates an external .bootstrap file only if you specify the --external-bootstrap option. If you don’t specify that option, the bootstrap information is included in the manifest file.

.drmmeta

DRM Additional Header file. Contains additional header information about an encrypted file. The tool creates this file only if you specify the --external-bootstrap option and encrypt the file. Otherwise, the information is included in the manifest file.

Segments And Fragments

An F4f file contains one segment of a media file. Each segment can contain multiple fragments. Use the --segment-duration and --fragment-duration options to set the length of each segment and fragment, in seconds. A good size fragment is small enough to send over the internet and long enough to prevent multiple calls to Apache HTTP Server.

Run The File Packager

To package a file, pass the File Packager the name of the input file.

There are two ways to specify the name:

  • Enter the --input-file option at the command line.

  • Create a configuration file that specifies the input file and enter the --conf-file option at the command line.

Package content on Windows

  1. Open a Command Window.

  2. Change directories to the directory containing f4fpackager.exe.

  3. Enter the name of the tool and any options:

     f4fpackager --input-file=sample.f4v --output-path=c:\sampleoutput

    The following files are output: sampleSeg1.f4f, sample.f4x, and sample.f4m.

Package content on Linux

  1. Open a terminal window.

  2. On a clean installation of Linux, set the LD_LIBRARY_PATH to the directory containing the File Packager libraries.

  3. At the shell prompt, enter the name of the tool and any options:

     f4fpackager --input-file=sample.f4v --output-path=/sampleoutput

    The following files are output: sampleSeg1.f4f, sample.f4x, and sample.f4m.

Packaging multi-bitrate content

To stream multi-bitrate content, encode a piece of media at multiple bitrates, creating multiple files. Use the File Packager to process each media file individually. The media files share a manifest file that lists information about each media file. The OSMF Player uses this information for playback.

About packaging multi-bitrate files

Each time you run the File Packager, it creates a manifest file with the filename of the input file. When you pass the --manifest-file option, the File Packager adds the information from the manifest file you specify to the manifest file it creates. For example, suppose you run the following:
--input-file=sample1.f4v

The tool creates the files: sample1Seg1.f4f, sample1.f4x, and sample1.f4m.

Suppose you then run the following:

--input-file=sample2.f4v --manifest-file=sample1.f4m

The tool creates the files sample2Seg1.f4f, sample2.f4x, and sample2.f4m. The manifest file sample2.f4m contains information about sample2.f4v and sample1.f4v.

To create a manifest file for multi-bitrate content, pass the --manifest-file option and specify the manifest file of the previously processed file. Package the files from lowest bitrate to highest bitrate. Do not pass the --manifest-file option for the first file you process.

Package multi-bitrate files

Note: This example uses Windows. For Linux commands, see Package content on Linux.
  1. Encode a media file at several bitrates, for example, 150 kbps, 700 kbps, and 1500 kbps.

    This example uses three files: sample1_150kbps.f4v, sample1_700kbps.f4v, and sample1_1500kbps.f4v. On Flash Media Server, these files are installed to rootinstall\applications\vod\media.

  2. Copy the files to the same folder as the File Packager.

    On Flash Media Server 4, the File Packager is located in the rootinstall\tools\f4fpackager folder.

  3. Open a Command Window.

  4. Change directories to the directory containing f4fpackager.exe.

  5. Enter the following:

     f4fpackager --input-file=sample1_150kbps.f4v --bitrate=150

    The following files are output: sample1_150kbpsSeg1.f4f, sample1_150kbps.f4x, and sample1_150kbps.f4m.

  6. Enter the following to process the second file:

     f4fpackager --input-file=sample1_700kbps.f4v --manifest-file=sample1_150kbps.f4m --bitrate=700

    The following files are output: sample1_700kbpsSeg1.f4f, sample1_700kbps.f4x, and sample1_700kbps.f4m. The manifest file sample1_700kbps.f4m includes information from the input file and information from the sample1_150kbps.f4m manifest file.

  7. Enter the following to process the third file:

     f4fpackager --input-file=sample1_1500kbps.f4v --manifest-file=sample1_700kbps.f4m --bitrate=1500

    The following files are output: sample1_1500kbpsSeg1.f4f, sample1_1500kbps.f4x, and sample1_1500kbps.f4m. The manifest file sample1_1500kbps.f4m includes information from the input file and information from the sample1_700kbps.f4m manifest file. The sample1_700kbps.f4m file contains information about the sample1_150kbps.f4v file and the sample1_700kbps.f4v file.

  8. To play the file, pass the URL of the sample1_1500kbps.f4m file to OSMF Player. Because this manifest file was created last, it contains information about all three files.

Packaging and encrypting content

Use the File Packager to both package and encrypt content for use with Flash Access.

Flash Access includes a license server implementation based on the Flash Access SDK called Adobe® Flash® Access™ Server for Protected Streaming. Flash Access Server for Protected Streaming is designed for use with HTTP Dynamic Streaming. For more information about this server, see Chapter 8, “Using Flash Access Server for Protected Streaming” in the document Adobe Flash Access Protecting Content.

Generate a common key

To use the File Packager to encrypt content, you must generate a common key file. The common key file must contain 128 bytes of randomly generated data. The File Packager uses this key with the content ID to generate the content encryption key.

Note: Although the base key is 128 bytes, only the first 128 bits (16 bytes) are used to generate the key.

You can use the open source tool Open SSL to generate random data and output a common key file. Download Open SSL from www.openssl.org.

Generate random data and output a comomon key file:

openssl rand -out commonKey.bin 128

Pass commonKey.bin as the --common-key command line option or in the <common-key> element of a configuration file.

Use a configuration file to package and encrypt content

Many command-line options are required to encrypt a file. It’s easier to use a configuration file to set options than it is to set options at the command line.

  1. Open the file f4fpackager_config.xml in a text editor.

    By default, the tool looks for f4fpackager_config.xml in the same directory as the File Packager. However, you can move it to any directory and give it any name.

  2. Enter values for the following required options (sample values are included here):

    <offline> 
        <input-file>someFile.f4v</input-file> 
        <content-id>contentId</content-id> 
        <common-key>commonKey.bin</common-key> 
        <license-server-url>http://server1.com:9999</license-server-url> 
        <license-server-cert>licenseServer.der</license-server-cert> 
        <transport-cert>transportCert.der</transport-cert> 
        <packager-credential>packagerCredential.pfx</packager-credential> 
        <credential-pwd>mYpwd</credential-pwd> 
        <policy-file>policyFile.pol</policy-file> 
    </offline>

    You can add additional elements to change their default values.

  3. Save the configuration file.

  4. Open a Command Window.

  5. Change directories to the directory containing f4fpackager.exe.

  6. Enter the following:

     f4fpackager --conf-file=f4fpackager_config.xml

Use the command line to package and encrypt content

  1. Open a Command Window.

  2. Change directories to the directory containing the File Packager.

  3. Enter the following:

    f4fpackager --input-file=someFile.f4v --license-server-url=http://server1.com:9999 --transport-cert=transportCert.der --license-sever-cert=licenseServer.der --packager-credential=packagerCredential.pfx --credential-pwd=mYpwd --policy-file=policyFile.pol --common-key=commonKey.bin --content-id=contentId