pylibde265


Namepylibde265 JSON
Version 0.0.1a0 PyPI version JSON
download
home_pageNone
Summarypython binding implementation of libde265, based on cython
upload_time2024-07-06 16:55:24
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseNone
keywords libde265 h265 vedio decode mp4
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <div align="center">
  <p>
    <a href="https://github.com/Puiching-Memory/pylibde265" target="_blank">
      <img width="100%" src="./multimedia/image/title.png" alt="pylibde265 head image"></a>
  </p>

<div>
    <a href=""><img src="https://img.shields.io/badge/Windows-0078D6?style=for-the-badge&logo=windows&logoColor=white" alt="windows:support"></a>
    <br>
    <a href=""><img src="https://img.shields.io/github/downloads/Puiching-Memory/pylibde265/total" alt="downloads:all"></a>
    <a href=""><img src="https://img.shields.io/github/downloads/Puiching-Memory/pylibde265/latest/total" alt="downloads:latest_verson"></a>
    <a href=""><img src="https://img.shields.io/pypi/:period/:packageName" alt="downloads:pypi"></a>
    <a href=""><img src="https://img.shields.io/github/directory-file-count/Puiching-Memory/pylibde265" alt="count:file/dir"></a>
    <a href=""><img src="https://img.shields.io/github/repo-size/Puiching-Memory/pylibde265" alt="count:size"></a>
  </div>

  [中文](https://github.com/Puiching-Memory/pylibde265/blob/main/README_zh.md) | [English](https://github.com/Puiching-Memory/pylibde265/blob/main/README.md)

</div>

# pylibde265

python binding implementation of libde265, based on cython

libde265的Python绑定实现,基于cython

### Warning! This repository is still in early release, the code is subject to frequent disruptive changes, and we cannot guarantee compatibility with the current version

### 警告!此存储库仍处于早期版本,代码会经常有破坏性更改,我们无法保证目前版本的兼容性

# 概念

<div>
  <a href=""><img src="./multimedia/image/vedio_steam.jpg" alt="image:vedio_steam"></a>
</div>

常见的视频文件,如.mp4是一类容器,其包含了视频流(HEVC编码)和音频流(ACC编码)数据。

libde265负责将HEVC编码的视频流解码至原始比特流,此类文件通常以.265或.hevc作为后缀名。

*目前版本中,不支持直接解码.mp4文件,你需要手动分离视频文件的视频部分,可以使用如ffmpeg的多媒体工具。

# 快速开始

running_example.py

```python
import pylibde265.pyde265
import PIL.Image
import cupy as cp 

print(pylibde265.pyde265.get_version())

vedio_path = r"D:\GitHub\pylibde265\multimedia\video\Kinkaku-ji.h265"
dec = pylibde265.pyde265.decode_decoder(10)

with open(vedio_path,'rb') as data:
    re = dec.load(data)
    frame = 0
    for re in dec.decode():
        frame += 1
        #print(re['pts'])
        #print(re['ttd'],re['ttd_max'])
        image_data = re['image']
        image_data = cp.asnumpy(image_data)
        image = PIL.Image.fromarray(image_data,mode='YCbCr')
        #image.save(f'./cache/{str(frame).zfill(9)}.jpg')
        image.show()
```


# 性能

目前,cython层的部分矩阵处理导致了延迟,4k视频下无法保持24帧正常播放。

| 分辨率 | FPS(libde265) | FPS(pylibde265) |
| ------ | ------------- | --------------- |
| 720p   | 284           |                 |
| 1080p  | 150           |                 |
| 4k     | 36            |                 |

线程性能分析:

| 线程 | 视频1-FPS | 视频2-FPS |
| ---- | --------- | --------- |
| 1    |           |           |
| 2    |           |           |

测试环境:

| CPU             | GPU       | 系统                  | 电源性能设置 | libde265 | pylibde265 |
| --------------- | --------- | --------------------- | ------------ | -------- | ---------- |
| intel@i5-12500H | RTX4060Ti | windows11(22631.3810) | 平衡         | 1.0.15   | 0.0.1a     |

# 从源代码构建

1. 下载存储库 `git clone https://github.com/Puiching-Memory/pylibde265.git`
2. 运行 `python tools_build.py`

环境需求

```python
cython
setuptools>=69.0
loguru
cupy-cuda12x
scipy
numpy
```

# 常见问题

Q:支持什么系统

A:目前只支持windows系统

# 贡献

# 版权

### 作者

@梦归云帆

### 鸣谢

* libde265 C/C++仓库 : 作者[@strukturag](https://github.com/strukturag/libde265)

### 标签来源

https://dev.to/envoy_/150-badges-for-github-pnk

https://shields.io/badges

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pylibde265",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "libde265, h265, vedio, decode, mp4",
    "author": null,
    "author_email": "\u68a6\u5f52\u4e91\u5e06 <1138663075@qq.com>",
    "download_url": "https://files.pythonhosted.org/packages/18/c5/ee2b41b881a631bf495c16d69f2bda2bcc0a8d74cd4ceb2e55ad04a72501/pylibde265-0.0.1a0.tar.gz",
    "platform": null,
    "description": "<div align=\"center\">\r\n  <p>\r\n    <a href=\"https://github.com/Puiching-Memory/pylibde265\" target=\"_blank\">\r\n      <img width=\"100%\" src=\"./multimedia/image/title.png\" alt=\"pylibde265 head image\"></a>\r\n  </p>\r\n\r\n<div>\r\n    <a href=\"\"><img src=\"https://img.shields.io/badge/Windows-0078D6?style=for-the-badge&logo=windows&logoColor=white\" alt=\"windows:support\"></a>\r\n    <br>\r\n    <a href=\"\"><img src=\"https://img.shields.io/github/downloads/Puiching-Memory/pylibde265/total\" alt=\"downloads:all\"></a>\r\n    <a href=\"\"><img src=\"https://img.shields.io/github/downloads/Puiching-Memory/pylibde265/latest/total\" alt=\"downloads:latest_verson\"></a>\r\n    <a href=\"\"><img src=\"https://img.shields.io/pypi/:period/:packageName\" alt=\"downloads:pypi\"></a>\r\n    <a href=\"\"><img src=\"https://img.shields.io/github/directory-file-count/Puiching-Memory/pylibde265\" alt=\"count:file/dir\"></a>\r\n    <a href=\"\"><img src=\"https://img.shields.io/github/repo-size/Puiching-Memory/pylibde265\" alt=\"count:size\"></a>\r\n  </div>\r\n\r\n  [\u4e2d\u6587](https://github.com/Puiching-Memory/pylibde265/blob/main/README_zh.md) | [English](https://github.com/Puiching-Memory/pylibde265/blob/main/README.md)\r\n\r\n</div>\r\n\r\n# pylibde265\r\n\r\npython binding implementation of libde265, based on cython\r\n\r\nlibde265\u7684Python\u7ed1\u5b9a\u5b9e\u73b0\uff0c\u57fa\u4e8ecython\r\n\r\n### Warning! This repository is still in early release, the code is subject to frequent disruptive changes, and we cannot guarantee compatibility with the current version\r\n\r\n### \u8b66\u544a\uff01\u6b64\u5b58\u50a8\u5e93\u4ecd\u5904\u4e8e\u65e9\u671f\u7248\u672c\uff0c\u4ee3\u7801\u4f1a\u7ecf\u5e38\u6709\u7834\u574f\u6027\u66f4\u6539\uff0c\u6211\u4eec\u65e0\u6cd5\u4fdd\u8bc1\u76ee\u524d\u7248\u672c\u7684\u517c\u5bb9\u6027\r\n\r\n# \u6982\u5ff5\r\n\r\n<div>\r\n  <a href=\"\"><img src=\"./multimedia/image/vedio_steam.jpg\" alt=\"image:vedio_steam\"></a>\r\n</div>\r\n\r\n\u5e38\u89c1\u7684\u89c6\u9891\u6587\u4ef6\uff0c\u5982.mp4\u662f\u4e00\u7c7b\u5bb9\u5668\uff0c\u5176\u5305\u542b\u4e86\u89c6\u9891\u6d41(HEVC\u7f16\u7801)\u548c\u97f3\u9891\u6d41(ACC\u7f16\u7801)\u6570\u636e\u3002\r\n\r\nlibde265\u8d1f\u8d23\u5c06HEVC\u7f16\u7801\u7684\u89c6\u9891\u6d41\u89e3\u7801\u81f3\u539f\u59cb\u6bd4\u7279\u6d41\uff0c\u6b64\u7c7b\u6587\u4ef6\u901a\u5e38\u4ee5.265\u6216.hevc\u4f5c\u4e3a\u540e\u7f00\u540d\u3002\r\n\r\n*\u76ee\u524d\u7248\u672c\u4e2d\uff0c\u4e0d\u652f\u6301\u76f4\u63a5\u89e3\u7801.mp4\u6587\u4ef6\uff0c\u4f60\u9700\u8981\u624b\u52a8\u5206\u79bb\u89c6\u9891\u6587\u4ef6\u7684\u89c6\u9891\u90e8\u5206\uff0c\u53ef\u4ee5\u4f7f\u7528\u5982ffmpeg\u7684\u591a\u5a92\u4f53\u5de5\u5177\u3002\r\n\r\n# \u5feb\u901f\u5f00\u59cb\r\n\r\nrunning_example.py\r\n\r\n```python\r\nimport pylibde265.pyde265\r\nimport PIL.Image\r\nimport cupy as cp \r\n\r\nprint(pylibde265.pyde265.get_version())\r\n\r\nvedio_path = r\"D:\\GitHub\\pylibde265\\multimedia\\video\\Kinkaku-ji.h265\"\r\ndec = pylibde265.pyde265.decode_decoder(10)\r\n\r\nwith open(vedio_path,'rb') as data:\r\n    re = dec.load(data)\r\n    frame = 0\r\n    for re in dec.decode():\r\n        frame += 1\r\n        #print(re['pts'])\r\n        #print(re['ttd'],re['ttd_max'])\r\n        image_data = re['image']\r\n        image_data = cp.asnumpy(image_data)\r\n        image = PIL.Image.fromarray(image_data,mode='YCbCr')\r\n        #image.save(f'./cache/{str(frame).zfill(9)}.jpg')\r\n        image.show()\r\n```\r\n\r\n\r\n# \u6027\u80fd\r\n\r\n\u76ee\u524d\uff0ccython\u5c42\u7684\u90e8\u5206\u77e9\u9635\u5904\u7406\u5bfc\u81f4\u4e86\u5ef6\u8fdf\uff0c4k\u89c6\u9891\u4e0b\u65e0\u6cd5\u4fdd\u630124\u5e27\u6b63\u5e38\u64ad\u653e\u3002\r\n\r\n| \u5206\u8fa8\u7387 | FPS(libde265) | FPS(pylibde265) |\r\n| ------ | ------------- | --------------- |\r\n| 720p   | 284           |                 |\r\n| 1080p  | 150           |                 |\r\n| 4k     | 36            |                 |\r\n\r\n\u7ebf\u7a0b\u6027\u80fd\u5206\u6790\uff1a\r\n\r\n| \u7ebf\u7a0b | \u89c6\u98911-FPS | \u89c6\u98912-FPS |\r\n| ---- | --------- | --------- |\r\n| 1    |           |           |\r\n| 2    |           |           |\r\n\r\n\u6d4b\u8bd5\u73af\u5883\uff1a\r\n\r\n| CPU             | GPU       | \u7cfb\u7edf                  | \u7535\u6e90\u6027\u80fd\u8bbe\u7f6e | libde265 | pylibde265 |\r\n| --------------- | --------- | --------------------- | ------------ | -------- | ---------- |\r\n| intel@i5-12500H | RTX4060Ti | windows11(22631.3810) | \u5e73\u8861         | 1.0.15   | 0.0.1a     |\r\n\r\n# \u4ece\u6e90\u4ee3\u7801\u6784\u5efa\r\n\r\n1. \u4e0b\u8f7d\u5b58\u50a8\u5e93 `git clone https://github.com/Puiching-Memory/pylibde265.git`\r\n2. \u8fd0\u884c `python tools_build.py`\r\n\r\n\u73af\u5883\u9700\u6c42\r\n\r\n```python\r\ncython\r\nsetuptools>=69.0\r\nloguru\r\ncupy-cuda12x\r\nscipy\r\nnumpy\r\n```\r\n\r\n# \u5e38\u89c1\u95ee\u9898\r\n\r\nQ:\u652f\u6301\u4ec0\u4e48\u7cfb\u7edf\r\n\r\nA:\u76ee\u524d\u53ea\u652f\u6301windows\u7cfb\u7edf\r\n\r\n# \u8d21\u732e\r\n\r\n# \u7248\u6743\r\n\r\n### \u4f5c\u8005\r\n\r\n@\u68a6\u5f52\u4e91\u5e06\r\n\r\n### \u9e23\u8c22\r\n\r\n* libde265 C/C++\u4ed3\u5e93 : \u4f5c\u8005[@strukturag](https://github.com/strukturag/libde265)\r\n\r\n### \u6807\u7b7e\u6765\u6e90\r\n\r\nhttps://dev.to/envoy_/150-badges-for-github-pnk\r\n\r\nhttps://shields.io/badges\r\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "python binding implementation of libde265, based on cython",
    "version": "0.0.1a0",
    "project_urls": {
        "Homepage": "https://github.com/Puiching-Memory/pylibde265",
        "Issues": "https://github.com/Puiching-Memory/pylibde265/issues"
    },
    "split_keywords": [
        "libde265",
        " h265",
        " vedio",
        " decode",
        " mp4"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "dee24235cedfde22ecb09061a4c5d751703309e816399e35b115b9ac1a307f3f",
                "md5": "7d35c65911879ffbf07d23ae7738c966",
                "sha256": "7b8c075fa0ef1b9bbd134b8876728922e27b605d0cb13720eecd58adc287d31d"
            },
            "downloads": -1,
            "filename": "pylibde265-0.0.1a0-cp310-cp310-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "7d35c65911879ffbf07d23ae7738c966",
            "packagetype": "bdist_wheel",
            "python_version": "cp310",
            "requires_python": ">=3.8",
            "size": 1475684,
            "upload_time": "2024-07-06T16:55:22",
            "upload_time_iso_8601": "2024-07-06T16:55:22.435201Z",
            "url": "https://files.pythonhosted.org/packages/de/e2/4235cedfde22ecb09061a4c5d751703309e816399e35b115b9ac1a307f3f/pylibde265-0.0.1a0-cp310-cp310-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cf21fef13d80e8e50197faacec1954f0bfc1daae68a7589fd3f8356f1c9f9b28",
                "md5": "4da65eceaa1a72bc3c4d2ed17b64dace",
                "sha256": "d200d3a10cb0b2709235c2e056fb66ff299dd1ef82124302d519f5767f2b2eb7"
            },
            "downloads": -1,
            "filename": "pylibde265-0.0.1a0-cp311-cp311-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "4da65eceaa1a72bc3c4d2ed17b64dace",
            "packagetype": "bdist_wheel",
            "python_version": "cp311",
            "requires_python": ">=3.8",
            "size": 1475636,
            "upload_time": "2024-07-06T16:55:27",
            "upload_time_iso_8601": "2024-07-06T16:55:27.756053Z",
            "url": "https://files.pythonhosted.org/packages/cf/21/fef13d80e8e50197faacec1954f0bfc1daae68a7589fd3f8356f1c9f9b28/pylibde265-0.0.1a0-cp311-cp311-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ccb55083f5e9a3055628cca82295552cd577c97847a52cfc824690270631b245",
                "md5": "7002810dc7dc22e8caf1c585556df14e",
                "sha256": "c2e80a637af6e551e63c8fe35ac54f1831c233530d8260c0f3ef5b36d616375d"
            },
            "downloads": -1,
            "filename": "pylibde265-0.0.1a0-cp38-cp38-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "7002810dc7dc22e8caf1c585556df14e",
            "packagetype": "bdist_wheel",
            "python_version": "cp38",
            "requires_python": ">=3.8",
            "size": 1475925,
            "upload_time": "2024-07-06T16:55:24",
            "upload_time_iso_8601": "2024-07-06T16:55:24.528483Z",
            "url": "https://files.pythonhosted.org/packages/cc/b5/5083f5e9a3055628cca82295552cd577c97847a52cfc824690270631b245/pylibde265-0.0.1a0-cp38-cp38-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "776bcb38f397a835c55938bdc3db3b51670eb61556ef08fcf56586180e7c1239",
                "md5": "b42aeaaac54d0ecfa4e9102871b5c225",
                "sha256": "0b2a70c56095e74419516925deaf9987d996883adb572908aa37c59d8e1a2fa1"
            },
            "downloads": -1,
            "filename": "pylibde265-0.0.1a0-cp39-cp39-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "b42aeaaac54d0ecfa4e9102871b5c225",
            "packagetype": "bdist_wheel",
            "python_version": "cp39",
            "requires_python": ">=3.8",
            "size": 1475781,
            "upload_time": "2024-07-06T16:55:25",
            "upload_time_iso_8601": "2024-07-06T16:55:25.955469Z",
            "url": "https://files.pythonhosted.org/packages/77/6b/cb38f397a835c55938bdc3db3b51670eb61556ef08fcf56586180e7c1239/pylibde265-0.0.1a0-cp39-cp39-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "18c5ee2b41b881a631bf495c16d69f2bda2bcc0a8d74cd4ceb2e55ad04a72501",
                "md5": "38a40577f28223cd713e8cc2ee84e477",
                "sha256": "5fb3cc382a3959b766967a291d34a4eeae1b389e343822f64696610564294969"
            },
            "downloads": -1,
            "filename": "pylibde265-0.0.1a0.tar.gz",
            "has_sig": false,
            "md5_digest": "38a40577f28223cd713e8cc2ee84e477",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 888560,
            "upload_time": "2024-07-06T16:55:24",
            "upload_time_iso_8601": "2024-07-06T16:55:24.176366Z",
            "url": "https://files.pythonhosted.org/packages/18/c5/ee2b41b881a631bf495c16d69f2bda2bcc0a8d74cd4ceb2e55ad04a72501/pylibde265-0.0.1a0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-06 16:55:24",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Puiching-Memory",
    "github_project": "pylibde265",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "pylibde265"
}
        
Elapsed time: 0.40000s