A Python library for rendering ASS subtitle file format using libass.

Overview

ass_renderer

A Python library for rendering ASS subtitle file format using libass.

Installation

pip install --user ass-renderer

Contributing

# Clone the repository:
git clone https://github.com/bubblesub/ass_renderer.git
cd ass_renderer

# Install to a local venv:
poetry install

# Install pre-commit hooks:
poetry run pre-commit install

# Enter the venv:
poetry shell

This project uses poetry for packaging, install instructions at poetry#installation

You might also like...
Discord-Token-Formatter - A simple script to convert discord tokens from email token to token only format

Discord-Token-Formatter A simple script to convert discord tokens from email:pas

Adriano's Diets Consulting Bot - Parses and extracts informations about your diet (files in the Adriano's format).

Adriano's Diets Consulting Bot - Parses and extracts informations about your diet (files in the Adriano's format).

Wats2PDF - Convert whatsapp exported chat(without media) into a readable pdf format
Wats2PDF - Convert whatsapp exported chat(without media) into a readable pdf format

Wats2PDF convert whatsApp exported chat into a readable pdf format. convert with

A script to generate the m3u playlist containing direct streamable file (.mpd or MPEG-DASH or DASH) based on the channels that the user has subscribed on the Tata Sky portal. You just have to login using your password or otp that's it .
Simple script to ban bots at Twitch chats using a text file as a source.

AUTOBAN πŸ‡ΊπŸ‡Έ English version Simple script to ban bots at Twitch chats using a text file as a source. How to use Windows Go to releases for further in

A simple telegram Bot, Upload Media File| video To telegram using the direct download link. (youtube, Mediafire, google drive, mega drive, etc)

URL-Uploader (Bot) A Bot Upload file|video To Telegram using given Links. Features: πŸ‘‰ Only Auth Users (AUTH_USERS) Can Use The Bot πŸ‘‰ Upload YTDL Sup

A Bot Upload file|video To Telegram using given Links.

A Bot Upload file|video To Telegram using given Links.

Python-random-quote - A file-based quote bot written in Python

Let's Write a Python Quote Bot! This repository will get you started with building a quote bot in Python. It's meant to be used along with the Learnin

Aio-binance-library - Async library for connecting to the Binance API on Python

aio-binance-library Async library for connecting to the Binance API on Python Th

Comments
  • Fix storage_size

    Fix storage_size

    Storage size must be the actual encoded (i.e. stored) resolution of the video stream, without any anamorphic de-squeeze applied. Other values will lead to distorted rendering.

    This will fix the the rendering for files with PlayRes different from the video's storage resolution if the video is not anamorphic. Anamorphic files are currently mistreated even beyond subtitle rendering (at least with how ass_renderer is used by bubblesub) and will require more effort to fix. Nonetheless, this already constitutes a clear improvement.

    Setting pixel aspect to 1.0 is also incorrect for anamorppic content. If rendering at video resolution as ass_renderer does, libass can calculate the pixel aspect itself if storage_size and frame_size are both set correctly.

    Reported in: https://github.com/bubblesub/bubblesub/issues/85

    opened by TheOneric 0
  • Defaults for ASS track are wrong

    Defaults for ASS track are wrong

    ASS has standard default values for those headers but ass_renderer assigns different ones. If those fields are linked with the actual C object from libass, i.e. the values are automatically updated when libass changes them, simply removing the custom defaults is the correct thing to do as libass will take care of it. If not, and those fields are exposed/used somewhere (after #1 removes the usage as a bogus storage size) a patch similar to the following will emulate the correct fallbacks:

    From 9c921570adae3bcdbdffc7b782be1ec5accf2edf Mon Sep 17 00:00:00 2001
    From: Oneric <[email protected]>
    Date: Wed, 16 Feb 2022 19:38:24 +0100
    Subject: [PATCH] Fix default values for ASS headers
    
     - ScaledBorderAndShadow defaults to no
     - WrapStyle defaults to 0 ("smart" mode)
     - PlayRes{X,Y} has obscure fallback values
    ---
     ass_renderer/libass.py | 24 +++++++++++++++++-------
     1 file changed, 17 insertions(+), 7 deletions(-)
    
    diff --git a/ass_renderer/libass.py b/ass_renderer/libass.py
    index 0cad674..b714057 100644
    --- a/ass_renderer/libass.py
    +++ b/ass_renderer/libass.py
    @@ -369,16 +369,26 @@ class AssTrack(ctypes.Structure):
             text = write_ass(ass_file).encode("utf-8")
             _libass.ass_process_data(ctypes.byref(self), text, len(text))
     
    -        self.play_res_x = int(
    -            ass_file.script_info.get("PlayResX") or video_resolution[0]
    +        self.wrap_style = int(ass_file.script_info.get("WrapStyle") or 0)
    +        self.scaled_border_and_shadow = (
    +            ass_file.script_info.get("ScaledBorderAndShadow", "no") == "yes"
             )
    -        self.play_res_y = int(
    -            ass_file.script_info.get("PlayResY") or video_resolution[1]
    +        res_x = int(
    +            ass_file.script_info.get("PlayResX") or 0
             )
    -        self.wrap_style = int(ass_file.script_info.get("WrapStyle") or 1)
    -        self.scaled_border_and_shadow = (
    -            ass_file.script_info.get("ScaledBorderAndShadow", "yes") == "yes"
    +        res_y = int(
    +            ass_file.script_info.get("PlayResY") or 0
             )
    +        if res_x <= 0 and res_y <= 0:
    +            res_x = 384
    +            res_y = 288
    +        elif res_x <= 0:
    +            res_x = 1280 if res_y == 1024 else max(1, res_y * 4 // 3)
    +        elif res_y <= 0:
    +            res_y = 1024 if res_x == 1280 else max(1, res_x * 3 // 4)
    +        self.play_res_x = res_x
    +        self.play_res_y = res_y
    +
     
     
     _libc.free.argtypes = [ctypes.c_void_p]
    -- 
    2.30.2
    
    
    
    opened by TheOneric 0
Owner
null
Cloud-optimized, single-file archive format for pyramids of map tiles

PMTiles PMTiles is a single-file archive format for tiled data. A PMTiles archive can be hosted on a commodity storage platform such as S3, and enable

Protomaps 325 Jan 4, 2023
Converts between Spotify's new lyrics (and their proprietary format) to an LRC file for local playback.

spotify-lyrics-to-lrc Converts between Spotify's new lyrics (and their proprietary format) to an LRC file for local playback. How to use: Open Spotify

~noah~ 6 Nov 19, 2022
A Python script for rendering glTF files with V-Ray App SDK

V-Ray glTF viewer Overview The V-Ray glTF viewer is a set of Python scripts for the V-Ray App SDK that allow the parsing and rendering of glTF (.gltf

Chaos 24 Dec 5, 2022
Clisd.py - UI framework with client side rendering for python

clisd.py Clisd is UI framework with client side rendering for python. It uses WA

null 2 Mar 25, 2022
Parse discord tokens from any file, even if there is other shit in the file with them.

Discord-Token-Parser Parse discord tokens from any file, even if there is other shit in the file with them. Any. File. I glued together all html from

null 4 May 7, 2022
This bot is created by AJTimePyro and It accepts direct downloading url & then return file as telegram file.

URL Uploader Bot This is the source code of URL Uploader Bot. And the developer of this bot is AJTimePyro, His Telegram Channel & Group. You can use t

Abhijeet 23 Nov 13, 2022
Python script to backup/convert your Spotify playlists into the XSPF format.

Python script to backup/convert your Spotify playlists into the XSPF format.

Chris Ovenden 4 Jun 9, 2022
A Discord bot to easily and quickly format your JSON data

Invite PrettyJSON to your Discord server Table of contents About the project What is JSON? What is pretty printing? How to use Input options Command I

Sem 4 Jan 24, 2022
A Telegram bot for Download songs in mp3 format from YouTube and Extract lyrics from Genius.com ❀️

MeudsaMusic A Telegram bot for Download songs in mp3 format from YouTube and Extract lyrics from Genius.com ❀️ Commands Reach @MedusaMusic on Telegram

Bibee 14 Oct 6, 2022
Utility for converting IP Fabric webhooks into a Teams format

IP Fabric Webhook Integration for Microsoft Teams and/or Slack Setup IP Fabric Setup Go to Settings > Webhooks > Add webhook Provide a name URL will b

Community Fabric 1 Jan 26, 2022