Skip to main content

Video encoding and decoding measures.

Project description

Me sures d’En codage et codage Vi déo.

[license MIT] [linting: pylint]

Description

This module performs video encoding and decoding measurements. It compares differents codecs in differents scenarios.

Codecs are tested at different bitrates and presets. Energy measurements are catched with RAPL and an external wattmeter on GRID5000. Distortions are measured using the psnr, ssim and vmaf metrics.

Installation

git clone https://gitlab.inria.fr/rrichard/mendevi.git ~/mendevi_git
cd ~/mendevi_git
pyenv activate mendevi  # to be sure to be in a virtual env
pip -v install --editable .

Features

General

  1. Codecs h264:libx264, h265-hevc:libx265, h266-vvc:vvenc, vp9:libvpx and av1:libsvtav1.

  2. Encoding presets fast, medium and slow.

  3. The sd, hd, uhd and hd4k profiles are detailed in profiles.py.

Encode

To generate the encoding database for the my_video.mp4 video, you can use the following command:

mendevi encode -p sd my_video.mp4

For each encoded file name, the information in the json file encode.json is as follows:

{
    "cmd": ["ffmpeg", ...],  # the exact arguments used for encoding
    "compression_ratio": 123.456,  # raw file size divided by encoded file size
    "crf": 28.1,  # the compression effort between 1.0 and 63.0
    "encode_context": {  # machine information and library versions
        "hostname": "paradoxe-1.rennes.grid5000.fr",
        ...,
    },
    "encode_duration": 123.456,  # encoding time in seconds
    "encode_idle_rapl": {  # RAPL cpu measurements of the IDLE based on 'perf' (power/energy-pkg/)
        "dt": [0.05, 0.05, ...],  # the duration of each interval in seconds
        "power": 123.456,  # the total energy divided by the duration, in watt
        "powers": [123.123, ...],  # the average power in watt in each interval
    }
    "encode_idle_usage": {  # CPU and RAM measure of the IDLE
        "cpu":  5.0,  # the average cumulated usage of all logical cpus
        "cpus": [[5.0, 0.0], ...],  # the detailed usage of each cpu in %
        "dt": [0.05, 0.05, ...],  # the duration of each interval in seconds
        "ram": [3952903680, 3952903680, ...],  # the ram usage in bytes
    }
    "encode_idle_wattmeter": {  # external wattmeter on grid5000 servers, measure the IDLE
        "dt": [0.05, 0.05, ...],  # the duration of each interval in seconds
        "power": 123.456,  # the total energy divided by the duration, in watt
        "powers": [123.123, ...],  # the average power in watt in each interval
    }
    "encode_rapl": {  # RAPL cpu measurements based on 'perf' (power/energy-pkg/)
        "dt": [0.05, 0.05, ...],  # the duration of each interval in seconds
        "energy": 123.456,  # total energy in joules used by the cpu during encoding
        "power": 123.456,  # the average power in watt
        "powers": [123.123, ...],  # the average power in watt in each interval
    }
    "encode_start": 1744114180.8672826,  # absolute start timestamp in seconds
    "encode_stop": 1744114198.7116294,  # absolute stop timestyamp in seconds
    "encode_threads": 8,  # the number of threads used durring encoding
    "encode_usage": {  # CPU and RAM usage with psutil
        "cpu":  20.0,  # the average cumulated usage of all logical cpus
        "cpus": [[20.0, 0.0], ...],  # the detailed usage of each cpu in %
        "dt": [0.05, 0.05, ...],  # the duration of each interval in seconds
        "ram": [4952903680, 4952903680, ...],  # the ram usage in bytes
    }
    "encode_wattmeter": {  # external wattmeter on grid5000 servers
        "dt": [0.05, 0.05, ...],  # the duration of each interval in seconds
        "energy": 123.456,  # total energy in joules used by the server during encoding
        "power": 123.456,  # the average power in watt
        "powers": [123.123, ...],  # the average power in watt in each interval
    },
    "encoder": "libx264",  # the name of the encoder
    "file": "bbb",  # the stem name of the source video file
    "frames": [  # the metadata of all frames
        {
            "best_effort_timestamp_time": 0.0,
            ...,
            "color_primaries": "smpte170m",
            ...,
            "pict_type": "I",
        },
        ...,
    ],
    "preset": "medium",  # the equivalent preset used for encoding
    "profile": "sd",  # the general profile used
    "psnr": [40.0, ...],  # the psnr (6, 1, 1) metric for each frame
    "rate": 123.456,  # average video bit rate in bit/second
    "size": 123456,  # final file size in bytes
    "ssim": [0.89, ...],  # the ssim (6, 1, 1) metric for each frame, gaussian window 11x11
    "uvq": [3.5, ...],  # the google uvq metric for each second of video
    "video_duration": 123.456,  # the exact duration of the video in second
    "vmaf": [70.0, ...],  # the netflix metric for each frame.
}

Decode

Not yet implemented

Alternatives

  1. The MVCD database also includes video encoding and decoding energy measurements.

  2. The COCONUT database also includes video decoding measurements.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mendevi-0.2.1.tar.gz (68.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mendevi-0.2.1-py3-none-any.whl (62.6 kB view details)

Uploaded Python 3

File details

Details for the file mendevi-0.2.1.tar.gz.

File metadata

  • Download URL: mendevi-0.2.1.tar.gz
  • Upload date:
  • Size: 68.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for mendevi-0.2.1.tar.gz
Algorithm Hash digest
SHA256 2bc628e18fddea69750e7fe158240606a92123e5c7bead549a3616ef4131ea2a
MD5 b9573c12303a8c4dedae81978df8baa1
BLAKE2b-256 f9b82e27653836cb506c55ccad73e2b3d1414b25bbeab2340191ea86b74f6099

See more details on using hashes here.

File details

Details for the file mendevi-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: mendevi-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 62.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for mendevi-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fa4da38ed3f26340d263fbbd421ecaa127a5281845e69dba954a6c872a0f8343
MD5 e8026aa54f550ce586d34e69f66bfe44
BLAKE2b-256 9e2e4e57882dfdee5654b3385eca40b673c1bb2f8ae592526019c53be603af92

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page