WS.WebTV Video Configuration
support, ws.webtv, home, configuration, video
Shortcuts: Qualities | Video Encoding | Video Storage | Qualities (Advanced) | YouTube
What are qualities?
It is better to explain this with an example: Video services like YouTube, Vimeo, DailyMotion, etc. have a "Gear" button that allows you to select a higher (or lower) video quality. You WebTV also have a "Gear" button for this purpose. You can setup 4 (or more) qualities.
How many qualities should be specified?
As many as you want. That depends on how many options you want to give to your WebTV users and the time you are willing to spend creating content. Keep in mind that in the case of Auto-Encoding Clips a video file will be generated for each of the qualities.
Normally it is a good practice to offer -at least- two qualities: a "low" Quality thinking of users with slow connections/mobile devices or old PCs and another "high" Quality for those users with high speed connections or new PCs. By default, WS.WebTV has two predefined Qualities: "Normal" (700Kbps) and "HQ" (1250Kbps); however, you are free to modify them.
What about defining more than one Quality?
In the case of Standard Clip, more work for you (because you'll need to compress a video for each of the qualities). In the case of Auto-Encoding Clips, more work for your server (because it will need to compress more files). In any case, it will imply a better experience for your users because they will have more options to enjoy the videos in a way that suits better the capabilities of their devices.
• Quality Label: The name of the quality. It should be as short as possible. The label can not be blank; otherwise it won't be used by the WebTV.
• Target: The device/technology that will playback the video file/stream associated with the corresponding quality.
» "Flash Only": Videos associated to the Quality will only be played back with the Flash video player.
» "Flash + HTML5"*: Videos associated to the Quality will be played back with either Flash or HTML5 video players.
» "HTML5 Only"*: Videos associated to the Quality will only be played back with the HTML5 video player.
*NOTE: Please check the General Considerations for Video Compression document for more info regarding video compression for Flash and HTML5.
• Bit Rate: This is for reference only. This value will be used by the WebTV to determine which quality will be showed to the end user the first time it visits the WebTV (although the User will be able to switch to another available quality if desired).
The previous settings/values can be changed anytime without any "harm". However, we recommend, for consistency of the Badnwidth detection system (Flash player only), that your videos reflect the selected Bit Rate.
Enabling/disabling Qualities
To enable a Quality, simply fill in the blank label and Save: the new Quality will be available on the WebTV. To disable a Quality clear the Label field and Save, the WebTV will stop using that quality.
Deleting a quality
Deleting a quality is different than disabling it; when you delete a Quality , by clicking on the "X" button to its right, the system will not only disable the Quality but will also delete all media (files, etc.) associated with that quality.
Since WS.WebTV 1.9 it is possible to enable/disable the support for specific video technology/file type:
• Enable WebM: Enables support for WebM format in HTML5. When WebM is enabled you will find an additional media slot, for each quality, in the "Media" tab of the Clips.
Important: Keep in mind that in the case of Auto-Encoding Clips, this will double the amount of video files to be encoded (with the derived additional server load) because each of the quality will be compressed in MP4 and WebM format.
• Enable DASH: (Requires StreamClip extenstion) Enables support for MPEG-DASH in HTML5. When DASH is enabled you will find an additional media slot, for each quality, in the "Media" tab of the Clips (StreamClip VOD/Live).
Requirements:
In order to use video encoding your server/hosting must have:
» FFmpeg 1.2 or higher with:
» H.264 Video compression library: libx264.
» AAC audio compression library; any of the following: libfaac, lifaad, libvo_aacenc, libfdk_aac or similar.
• Enable Encoding: To enable/disable video encoding ("Auto-Encoding" Clips).
NOTE: If you disable encoding, or if the WebTV is not able to detect FFmpeg in your server, it will not allow to create "Auto-Encoding" Clips.
• Timeout: (in seconds) Encoding tasks which exceed this processing time will be considered failed.
• FFmpeg Path: The path to the FFmpeg executable (consult with your hosting provider or server administrator).
- Path example on Windows encironment: C:\ffmpeg\bin\ffmpeg.exe (it must end with .exe extension)
- Path example on Linux environment:
/user/local/bin/ffmpeg
VERY IMPORTANT: PHP must be configured to allow a very high execution time.
Advanced configuration options
Depending on your server setup, it might be necessary to modify a couple of WebTV settings which apply to the video encoder.
By default, the WebTV launches the encoding task processing script (/video_encoder.php) asynchronously, in the background, using cURL.
In case the WebTV is not able to start the task processing, then you will need to set a cron job in your server so it can execute the <webtv_url>/video_encoder.php script automatically (the script must be executed using its absolute URL with a lynx, wget or curl cron command). You will also need to disable the recursion for the encoding task processing. In order to do it, edit the config/Config.inc.php file and add the following code before the PHP closing tag:
$ENCODING_RECURSIVE_TASK_PROCESSING = false; // Ops: true (default), false
Cron command example:
curl --silent --user-agent Server-Cron "http://WEBTV_URL/video_encoder.php" >/dev/null 2>&1
Since WS.WebTV 1.7.5, we have added support for low priority execution mode for FFmpeg (to lower CPU load), by using "nice" command on Linux servers and "START" command on Windows servers. You can enable this functionality, and customize the commands (if required), from config/Config.inc.php file by adding the following code before the PHP closing tag:
$FFMPEG_NICE_EXE = true; // Ops: true, false
$FFMPEG_NICE_CMD = "nice -n 19"; // nice command for Linux servers
$FFMPEG_NICE_CMD_WIN = "START /LOW /B /WAIT"; // nice command equivalent for Windows servers
Other Configuration options
Since WS.WebTV 1.7.5, it is possible to configure the WebTV to create the enconding tasks immediately after uploading the source video file. In order to enable this behavior, edit the config/Config.inc.php file and add the following code before the PHP closing tag:
$START_ENCODING_AFTER_UPLOAD = false; // Ops: true, false
Since WS.WebTV 1.8 postfixes v1, there is an alternate command for getting Sprites (in case the defult one fails). In order to select the command, edit the config/Config.inc.php file and add the following code before the PHP closing tag:
$FFMPEG_GET_SPRITE_CMD_INDEX = 0; // 0 = legacy (default), 1 = new command (use 1 when 0 fails, note that this mode does not display progress).
Since WS.WebTV 2.0 it is possible to skip encoding tasks when the output size is bigger that the source video file. In order to allow task skipping, edit the config/Config.inc.php file and add the following code before the PHP closing tag:
// Set the following variable = true if you want to skip encoding tasks when the source video is smaller than the output size
$ENCODING_SKIP_TASKS_IF_SOURCE_IS_SMALLER_THAN_OUTPUT = true;
// The following two variables are useful in order to ensure that at least a quality is always encoded. Set them to match the width and height of the encoding preset assigned to the lowest of your video qualities.
$ENCODING_SKIP_MIN_OUTPUT_WIDTH = 720; // will only skip a task if output size is bigger than the source video size AND the output width is bigger than this number; otherwise, the task won't be skipped
$ENCODING_SKIP_MIN_OUTPUT_HEIGHT = 576; // will only skip a task if output size is bigger than the source video size AND the output height is bigger than this number; otherwise, the task won't be skipped
Compression Profiles:
When encoding is enabled, at the right of each quality you will see a dropdown to select the desired compression profile.
Note, regarding FFmpeg presets:
WS.WebTV includes general purpose compression presets. We will not offer technical support for anything related with the adjustment of the presets.
In case you need to do adjustment to the presets, you will need to do it yourself (see below).
Compression Profile Files:
The compression profiles can be found in following WebTV folder: "framework/lib/ffmpeg_presets".
By default, the system will use the following preset folders:
- For H.264: "/libx264-libvo_aacenc/"
- For WebM (since version 1.9): "/libvpx-libvorbis/", only if WebM is enabled.
The preset file is in JSON format and it is named
WS.WebTV 1.9+: "ffmpeg_presets_cmd.json"
WS.WebTV prior to 1.9: "ffmpeg_presets.json"
Note: Since the JSON format is very strict, we recommend you to validate the file after performing any modification to it. In order to do this you can use an online validation tool like these.
You can tell the system what preset folder to use, from the WebTV configuration file (config/Config.inc.php):
$FFMPEG_PRESETS_FOLDER = "libx264-libvo_aacenc"; // ops: libx264-libvo_aacenc, libx264-libfaac, libx264-libfaad
$FFMPEG_PRESETS_WEBM_FOLDER = "libvpx-libvorbis"; // (since version 1.9)
ffmpeg_presets.json vs ffmpeg_presets_cmd.json
The "ffmpeg_presets.json" file is used in versions prior to 1.9; however, since version 1.9 the new ffmpeg_presets_cmd.json file is used by default. The difference between them is that the new one allows using complete command lines for FFmpeg which is much more flexible.
You can tell the system what file type to use, from the WebTV configuration file (config/Config.inc.php):
$FFMPEG_PRESETS_STYLE = "cmd"; // Ops: "cmd", "legacy"
$FFMPEG_PRESETS_WEBM_STYLE = "cmd";
Select the upload destination for video files: Local (the current WebTV server), FTP or AWS.
When FTP is selected, the WebTV will upload the video files to an external server, though FTP.
• Video server FTP: Enter the FTP address where the video files will be stored. Examples:
ftp://ftp.myvideoserver.com/httpdocs/movies
ftp://ftp.myvideoserver.com/
• FTP Username/Password: Login info of the FTP server.
• FTP Active Mode: Some servers require the "active" FTP mode for file transferring (most don't). If you have problems uploading videos, select "Yes".
• Playback Base URL: Specify the HTTP address where to access the video files. Example:
http://www.myvideoserver.com/movies
NOTE: If you require additional control on how to specify the playback URL, or use streaming URLs, then the StreamClip extension is required.
When AWS is selected, the WebTV will upload the video to an Amazon S3 account.
• AWS Access Key/Secret Key: The credentials to access the S3 account.
• AWS Bucket: Enter the name of the bucket where the files will be stored.
• AWS Path: The folder, inside the bucket, where the files will be stored. Leave this field blank if you want the files sotred in the bucket root.
• AWS End Point: This is the End Point you selected when created the bucket.
• Playback Base URL: Specify the HTTP address where to access the video files. Example:
https://s3.amazonaws.com/bucket-name/
NOTE: If you require additional control on how to specify the playback URL, or use streaming URLs, then the StreamClip extension is required.
NOTE: The "Playback Base URL Formula" fields are available when using an external server, or Amazon S3, for video upload - see bellow -. WS.WebTV Professional and StreamClip extension are required.
This advanced featured is used for integrating the WebTV with a CDN.
Playback Base URL Formula explained
The URL formula allows you to integrate WS.WebTV Professional with CDNs based on one-point file publishing, through FTP or AWS (see "Video Storage", bellow), and URL "formulas" for media access.
When you upload a video to the WebTV, it is uploaded to the destination server, and the only data stored in the database is the file name. The final URL to the video file is generated at playback time, by using the formula. If no formula is entered then the Playback Base URL will be used instead (see bellow). Likewise, if you use the URL formula, it will override any current Playback Base URL.
How to create a formula?.
It is very easy, let's explain it with some formula examples:
http://my.cdn/app/folder/{filename.ext}.smil
rtmp://mymediaserver.com/app/mp4:{filename.ext}
http://mymediaserver.com/vod/{filename.ext}
As you can see, in the previous examples, we used the label {filename.ext}; that label indicates the WebTV where to include/replace the actual video file name, when generating the final URL to the file.