Video Compression

Generally speaking most devices that shoot videos (e.g. phones, security cameras etc.) are optimized for capturing accurate video streams in real time rather than seeking opportunities to make the files smaller - they simply aren’t optimized for this task and in a lot of cases lack sufficient processing power, time and/or battery (in the case of mobile devices).

Compressing video efficiently takes considerable processing power and time. NXPowerLite is able to leverage the combination of time and processing power to go back through existing video files, decoding and re-encoding them more efficiently. The result is often substantially smaller files with no discernible reduction in playback quality.

How does NXPowerLite make videos smaller?

NXPowerLite uses the industry-leading Codec SDK from MainConcept to decode and then re-encode videos using more processor-intensive settings.

There are a number of settings that can be passed to the encoder that allow it to use more resources when writing the video file, one example is, setting a higher number of frames that it can search for similarities before writing a chunk of video data. The more similarities it finds, the smaller it can be compressed. Also, in some cases it is more efficient to reorder video frames so that they are decoded in a different order than they are displayed.

In addition to the above and where supported, the software uses any of the lossless compression features like CABAC to ensure that no opportunities are missed to decrease the file size.

If you’re interested to read more about the many settings - this is a fantastically detailed article on the subject: http://www.lighterra.com/papers/videoencodingh264/

How do we avoid compromising the output video?

Skew encoding in favour of Quality

There are two main groups of settings that affect quality when encoding video - one group affects the tradeoff between speed and quality, and the other group balances file size and quality. In the former group, NXPowerLite favours quality over speed; this means that the video encoder disables “shortcut” algorithms that can degrade quality. In the latter group (size vs. quality), NXPowerLite uses fixed high-quality settings. In combination, these encoder settings aim to achieve the smallest possible file size without noticeably affecting the quality of the video.

Preserve the Source Profile and Level to ensure device compatibility

We ensure that we only use settings that are compatible with the H.264 profile of the source video. So, for example, if a source video complies with the Baseline profile we won’t use context-adaptive binary arithmetic coding (CABAC) as this isn’t a supported feature and would potentially cause playback issues.

Similarly, NXPowerLite preserves the H.264 level of the source video, which affects the maximum bit rate at which the video is encoded.

As the source profile and level are preserved, any device that conforms to the relevant specifications and is capable of playing the source file will also be capable of playing the optimized file.

Preserve the Source Key Attributes

We read in the attributes of the source video and then seek to re-encode it using more processor-intensive settings, without altering the following key attributes:

  • Resolution

  • Frame rate

  • File format and profile

  • Metadata

Copy Audio Without Re-Encoding

As audio tracks usually make up a very small percentage of the size of a video file, NXPowerLite simply copies audio tracks from the source file to the optimized file without changing anything. Audio quality in optimized files is therefore identical to the original version.

Copy Metadata

Video files may contain many different types of metadata (e.g. text such as the title or the name of the director, or image data such as “poster” or thumbnail images). There are a number of different standard metadata formats, and also a number of proprietary formats.

NXPowerLite is able to preserve metadata in the most common standard formats, which it simply copies from the source file to the optimized file. To ensure that no metadata is lost through the process of optimization, NXPowerLite also performs the following checks:

  • Before optimizing a file, the “ftyp” (file type), which usually appears at the beginning of an MP4/MOV file, is checked. This contains a list of “brands” which (among other things) identify the types of metadata that may appear in the file. NXPowerLite has a “whitelist” of supported brands; any file that contains a brand which is not included in this whitelist is skipped.

  • After optimizing a file, the structure of the source file is compared with the optimized file. If the source file contains any data structures that are not preserved in the optimized file (this can happen e.g. if the source file contains proprietary metadata that is not identified in the “ftyp” record) NXPowerLite will not replace the source file; in this case, the optimized file is discarded.

What videos does NXPowerLite support?

This support article provides full details of the currently supported video file formats