Skip to content

Ad Injector

Ad Injector for embedding commercials into stream

Ad Injector is a Flussonic's tool for inserting video ads into a video stream. If Ad Injector is configured to work with a video stream, then at a certain time one of the selected ads will be played instead of the stream, and then the playback of the primary stream resumes.

It also allows you to view the number of playbacks and the number of unique playback sessions of a video ad.

Setting up Ad Injector

Follow the procedure below to configure Ad Injector.

  1. Add the following line anywhere in the configuration file (flussonic.conf):

    plugin ad_injector;

    and restart the Flussonic instance (service flussonic restart). 2. Download videos with ads to the server, into a VOD files directory. For details about VOD, read here.

  2. Open the web interface. On the main page, select the Ad Injector tab. The Ad Injector settings page appears.

  3. Create a schedule. To do this, in the section Ad Schedules, enter the name of your schedule and click Add Schedule. In the Ad Schedules section you will see a list of advertising schedules with the buttons Delete and the text Schedule: <schedule name>.

    You can delete a schedule by clicking the Delete button. 5. Adjust your ad slots. To do this, click Schedule: <schedule name>. Under the schedule, the settings for advertising slots will appear. For each slot, you can adjust a playing time in HH:MM:SS format in UTC, and duration of the slot in seconds.

    A sample configuration may look like this:

    In this example, the schedule is set up for two slots: one will be played at 12 PM (at noon) for 15 seconds, and the second will be played at 12:15 PM for 10 seconds.

    Each slot can be removed by clicking the Delete button. You can add a new slot by clicking the Add slot button. 6. Select videos for your advertising slots. To do this, in the Files section, select a folder where you store video files that was downloaded in step 2, and in the drop-down list tick all videos you want to be played within your advertising schedule. Added files are displayed in the list of ad slots. You can remove a video from a schedule by clicking the cross in front of its name.

    In this example, TEST schedule uses two files: stream.mp4 и uni169c10.mp4. 7. Configure priorities of previously added videos. To do this, type the priority ("weight") the text box in front of the file name. The higher is "weight", the sooner this file will be played. If all weights are the same, all files will be played in original order. After each show, file weight is reduced by 1. As soon as a weight of all files in the schedule reaches 0, all weights are reverted to original values. If duration of a video file is longer than corresponding slot duration, the system selects a next video in accordance with its weight. If remaining length of a slot is too short to display a video file entirely, the slot will be terminated prematurely and a primary video stream will be resumed.

  4. Save your settings by clicking the "Save and apply" button.


    If your server is already set up for Ad Injector, you must click Reload from server button when you start using Ad Injector via the web interface. If you do not, then when you click Save and apply, any existing settings will be overwritten.

    9. Create a stream with this advertising schedule. The source URL of such a stream will be ad_injector://STREAM_NAME/SCHEDULE.

    Example. Let you have a stream named ch1 and advertising schedule advert1. The new advertising stream can have any name, let it be ch1_adv:

stream channel1 {
    url fake://fake;
stream ch1_adv {
    url ad_injector://channel1/advert1;

This stream can be created in admin panel or by editing the config file `/etc/flussonic/flussonic.conf`.

Links to your video stream with advertising will now look like this:
 * RTMP: rtmp://SERVER/static/ch1_adv
 * HLS: http://SERVER/ch1_adv/index.m3u8
 * HDS: http://SERVER/ch1_adv/manifest.f4m

(SERVER &mdash; the domain name of your server).


Ad Injector also gives you an option to view playback statistics and unique views of your advertising. You can find these statistics in the **Adverted streams** section at the Ad Injector settings page. If a schedule is attached to a video stream, and it has at least one recent show, it will be present in this section under its alias. For each ad, views and shows are displayed. The "show" is a single show of an ad that was broadcasted by the server, and the "view" is viewing of at least one part of the video by a single viewer. ![](_img_dc1a08f6-a298-11eb-9cb3-0242ac110003/adinj-5_dc1ecfc6-a298-11eb-9cb3-0242ac110003.png) Statistics are kept for one last day only.