Skip to main content

python binding implementation of libde265, based on cython

Project description

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

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

概念

image:vedio_steam

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

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

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

快速开始

running_example.py

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

环境需求

cython
setuptools>=69.0
loguru
cupy-cuda12x
scipy
numpy

常见问题

Q:支持什么系统

A:目前只支持windows系统

贡献

版权

作者

@梦归云帆

鸣谢

标签来源

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

https://shields.io/badges

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

pylibde265-0.0.1a0.tar.gz (888.6 kB view details)

Uploaded Source

Built Distributions

pylibde265-0.0.1a0-cp311-cp311-win_amd64.whl (1.5 MB view details)

Uploaded CPython 3.11 Windows x86-64

pylibde265-0.0.1a0-cp310-cp310-win_amd64.whl (1.5 MB view details)

Uploaded CPython 3.10 Windows x86-64

pylibde265-0.0.1a0-cp39-cp39-win_amd64.whl (1.5 MB view details)

Uploaded CPython 3.9 Windows x86-64

pylibde265-0.0.1a0-cp38-cp38-win_amd64.whl (1.5 MB view details)

Uploaded CPython 3.8 Windows x86-64

File details

Details for the file pylibde265-0.0.1a0.tar.gz.

File metadata

  • Download URL: pylibde265-0.0.1a0.tar.gz
  • Upload date:
  • Size: 888.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for pylibde265-0.0.1a0.tar.gz
Algorithm Hash digest
SHA256 5fb3cc382a3959b766967a291d34a4eeae1b389e343822f64696610564294969
MD5 38a40577f28223cd713e8cc2ee84e477
BLAKE2b-256 18c5ee2b41b881a631bf495c16d69f2bda2bcc0a8d74cd4ceb2e55ad04a72501

See more details on using hashes here.

File details

Details for the file pylibde265-0.0.1a0-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pylibde265-0.0.1a0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 d200d3a10cb0b2709235c2e056fb66ff299dd1ef82124302d519f5767f2b2eb7
MD5 4da65eceaa1a72bc3c4d2ed17b64dace
BLAKE2b-256 cf21fef13d80e8e50197faacec1954f0bfc1daae68a7589fd3f8356f1c9f9b28

See more details on using hashes here.

File details

Details for the file pylibde265-0.0.1a0-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pylibde265-0.0.1a0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 7b8c075fa0ef1b9bbd134b8876728922e27b605d0cb13720eecd58adc287d31d
MD5 7d35c65911879ffbf07d23ae7738c966
BLAKE2b-256 dee24235cedfde22ecb09061a4c5d751703309e816399e35b115b9ac1a307f3f

See more details on using hashes here.

File details

Details for the file pylibde265-0.0.1a0-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pylibde265-0.0.1a0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 0b2a70c56095e74419516925deaf9987d996883adb572908aa37c59d8e1a2fa1
MD5 b42aeaaac54d0ecfa4e9102871b5c225
BLAKE2b-256 776bcb38f397a835c55938bdc3db3b51670eb61556ef08fcf56586180e7c1239

See more details on using hashes here.

File details

Details for the file pylibde265-0.0.1a0-cp38-cp38-win_amd64.whl.

File metadata

File hashes

Hashes for pylibde265-0.0.1a0-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 c2e80a637af6e551e63c8fe35ac54f1831c233530d8260c0f3ef5b36d616375d
MD5 7002810dc7dc22e8caf1c585556df14e
BLAKE2b-256 ccb55083f5e9a3055628cca82295552cd577c97847a52cfc824690270631b245

See more details on using hashes here.

Supported by

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