Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
|
|
Thread Tools | Search this Thread | Display Modes |
|
19th May 2023, 17:33 | #1 | Link |
Registered User
Join Date: Feb 2022
Posts: 125
|
ass2bdnxml – direct ASS to BDNXML+PNG conversion without AviSynth
ass2bdnxml is a command line software that converts ASS files to BDN XML + PNG assets. It is a clone of avs2bdnxml, except that it interfaces directly with libass and does not need AviSynth or an AVS script and has fewer options.
This software was originally written by mia-0 for a project. I have forked it and made some basic fixes, like supporting embedded fonts and setting pixel ratio to render subtitles for anamorphic content. All credits to mia-0 and ps auxw for the software. Usage: Everything is in the readme. Generally, you will not need any advanced options. This should be enough most of the time: Code:
./ass2bdnxml -f 25 -v 1080i ./subtitles.ass -v --video-format Sets the video format. Accepted values: [480i, 576i, 720p, 1080i, 1080p] Default: 1080p -f --fps Sets the FPS. Values: [23.976, 24, 25, 29.97, 50, 59.94, 60 (UHD BD only)] Default: 23.976 -q --quantize Enables image palettization and sets the max number of colours to use. Default: 0 (quantization disabled, 32-bit RGBA PNGs) -a --fontdir Specify an additional look-up directory for fonts. -s --split Sets split mode. 0: Off, 1: Vertical, 2: V+Horizontal, 3: V+H Aggressive, 4: Ugly. Default: 0 (Not enabled). -m --splitmargin Sets the minimum vertical and opt. horizontal margins to do a split. Format: VxH (E.g 10x200) -h --anamorphic Flag to squeeze bitmaps for 16:9 SD anamorphic content. -o --offset Sets the NDF TC offset to shift all of the BDN Timecodes. Default: 00:00:00:00 (no offset) -p --par Sets a custom pixel aspect ratio (PAR) to use in libass. Default: inferred from --video-format and --anamorphic -r --rleopt Flag to prevent usage of palette ID 0 to avoid line encoding error at authoring. -c --copyname Flag to reflect the name of the ASS file to the output XML. --dim Dim subtitles by percentage, useful subtitles targeting HDR content. 33% is roughly 200 nits. Default: 0 -t --trackname Sets the human-readable name of the subtitle track. Default: Undefined -l --language Sets the language of the subtitle track. Default: und -w --width-render Specify a custom ASS render width. Default: --video-format width. -x --width-store ASS storage width to use in libass. Default: libass guess (generally 1:1 to video-format unless --par is specified.) -z --downsample Additive flag for events downsampling. Specify the flag once to prevent events shorter than 2 frames, twice for 3 frames, and so on. If --quantize N is used: --liq-speed Sets LIQ speed. Lower is better but slower. Value within [1; 10] incl. Default: 4 --liq-quality Sets quantization quality. Values >85 are generally lossless and compress better. Default: 100 --liq-dither Sets the dithering level, value must be within [0; 1.0] incl. Default: 1.0 Special / debugging: --height-store ASS storage height to use in libass. Default: libass guess (generally 1:1 to video-format unless --par is specified.) --height-render Sets the height to use as output ASS frame. Defaults to BDN output height if unspecified. --keep-dupes Flag to not merge events that are reported as different by libass yet identical when composited (e.g ASSDraw). --hinting Enables soft libass hinting. Default: Not enabled --dvd-mode Uses 4 colors and increase contrast to make the subs visually pleasant. Default: Not enabled --negative Flag to indicate a negative --offset. Ignored if no offset is provided SUP output ass2bdnxml does not support exporting to SUP. Conversion to SUP/PGS is done by other softwares like SUPer. In this case, image splitting or quantization should NOT be used as SUPer recalculates it internally. Download https://github.com/cubicibo/ass2bdnxml Windows binaries https://github.com/cubicibo/ass2bdnxml/releases/ Last edited by cubicibo; 21st March 2024 at 09:59. |
2nd June 2023, 19:32 | #3 | Link |
Registered User
Join Date: Feb 2022
Posts: 125
|
What error? I don't use Windows but I can build it on macOS and Ubuntu 20.04 without issues (Ubuntu needs libbsd-dev installed and libbsd specified in cflags, also some distrib wants "libpng" rather than "png" in the gcc command line).
Maybe someone knows how to cross compile libass with mingw... I don't. I would recommend to install WSL so you can use all those nifty doom9 tools and filters on your favorite Windows machine but in a Linux command line window Last edited by cubicibo; 2nd June 2023 at 19:38. |
3rd June 2023, 12:51 | #4 | Link | |
Registered User
Join Date: Nov 2010
Posts: 4
|
Quote:
Code:
meson builddir The Meson build system Version: 1.1.1 Source dir: \\testproject Build dir: \\testproject\builddir Build type: native build Project name: ass2bdnxml Project version: undefined C compiler for the host machine: cl (msvc 19.36.32532 " Microsoft (R) C/C++ 19.36.32532 x86") C linker for the host machine: link link 14.36.32532.0 Host machine cpu family: x86 Host machine cpu: x86 Did not find pkg-config by name 'pkg-config' Found Pkg-config: NO Found CMake: \Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.EXE (3.26.0) Run-time dependency libass found: NO (tried cmake) meson.build:6:4: ERROR: Dependency lookup for libass with method 'pkgconfig' failed: Pkg-config binary for machine 1 not found. Giving up. A full log can be found at \\testproject\builddir\meson-logs\meson-log.txt WARNING: Running the setup command as meson [options] instead of meson setup [options] is ambiguous and deprecated. |
|
2nd June 2023, 20:26 | #5 | Link |
Registered User
Join Date: Nov 2010
Posts: 4
|
Error those:
meson builddir The Meson build system Version: 1.1.1 Source dir: \\testproject Build dir: \\testproject\builddir Build type: native build Project name: ass2bdnxml Project version: undefined C compiler for the host machine: cl (msvc 19.36.32532 "��⨬������騩 ��������� Microsoft (R) C/C++ ���ᨨ 19.36.32532 ��� x86") C linker for the host machine: link link 14.36.32532.0 Host machine cpu family: x86 Host machine cpu: x86 Did not find pkg-config by name 'pkg-config' Found Pkg-config: NO Found CMake: \Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.EXE (3.26.0) Run-time dependency libass found: NO (tried cmake) meson.build:6:4: ERROR: Dependency lookup for libass with method 'pkgconfig' failed: Pkg-config binary for machine 1 not found. Giving up. A full log can be found at \\testproject\builddir\meson-logs\meson-log.txt WARNING: Running the setup command as meson [options] instead of meson setup [options] is ambiguous and deprecated. |
3rd June 2023, 13:48 | #6 | Link |
Registered User
Join Date: Feb 2022
Posts: 125
|
There's no pkg-config on windows. You have to specify the (compiled) library paths for libass and libpng.
I would suggest you to try with msys2, you can get pkgconf (equivalent to pkg-config) and directly compiled libass and libpng ready to use with make. Else, you could try to setup the project to be like assrender and to follow the build instructions, which lets you build libass. You would have to find your way with libpng. |
26th July 2023, 22:03 | #8 | Link |
Registered User
Join Date: Feb 2022
Posts: 125
|
I have managed to build ass2bdnxml on Windows. The .exe file can be obtained here: ass2bdnxml.exe v0.3.
|
27th July 2023, 13:06 | #9 | Link |
Big Bit Savings Now !
Join Date: Feb 2007
Location: close to the wall
Posts: 1,656
|
Many thanks, cubicibo !
__________________
"To bypass shortcuts and find suffering...is called QUALity" (Die toten Augen von Friedrichshain) "Data reduction ? Yep, Sir. We're that issue working on. Synce invntoin uf lingöage..." |
27th August 2023, 12:05 | #10 | Link |
Registered User
Join Date: Feb 2022
Posts: 125
|
ass2bdnxml v0.4
This version greatly improve the time accuracy of the output. Combined with SUPer v0.2.0, you can now generate frame accurate masking effects in your (authoring compliant) PGS In the next version, I will try to add support for libimagequant to output 8-bit palletized PNG for users who want to directly import the PNG in Scenarist BD. At the moment, ass2bdnxml outputs 32-bit images and Scenarist users must execute "pngquant.exe 255 -f --ext .png *.png" on the images. |
5th October 2023, 20:32 | #11 | Link | ||
Registered User
Join Date: Feb 2022
Posts: 125
|
ass2bdnxml v0.6a
Image quantization added with libimagequant. DO NOT use image quantization if you generate a BDN XML that will be converted to PGS with SUPer. v0.6a changes Quote:
v0.5 changes Quote:
Last edited by cubicibo; 9th October 2023 at 21:41. |
||
20th November 2023, 09:05 | #12 | Link |
Registered User
Join Date: Nov 2023
Posts: 2
|
Hi! Is it possible to add compatibility support for the vsfiltermod plugin? With the help of filter, My ASS subs have more setting options to be able to handle and display some more complex dynamic subtitle effects, and realize more advanced and useful functions, e.g.: importing external image sequences... I have been using avs2bndxml to output xmlPNG, but this project has been discontinued for many years, it needs to write extra AVS scripts to load .dll filters for rendering, and the processing speed is so slow, it basically takes about 10 minutes to convert over thousand lines in ASS subs, which is really maddening.
Recently, I have changed to use ass2bdnxml to convert ASS, the same subtitles only need less than 1 minute, and then with SUPer, to make Blu-ray subtitles, the experience is simply amazing and easier, but the shortcoming is that ass2bdnxml does not have that filter and can not customize the output path, I hope that the project can be perfected, and finally still say thanks to cubicibo brought us such good tools! |
20th November 2023, 09:55 | #13 | Link |
Registered User
Join Date: Feb 2022
Posts: 125
|
You are welcome.
I don't think I understand your request. Do you want ass2bdnxml to: 1) Offer the possibility to switch between libass or xy-VSFilter/VSFilterMod to render .ASS input files (or other types of files supported by VSFilter)? Akin to the user option in MPC-HC. 2) Be an actual VapourSynth/AviSynth filter, feed it a clip and expect it to output BDNXML using either libass/VSFilter? VSFilter has tons of dependencies and is much less portable than libass. If it is option #1, maybe. Option #2 is less likely. Also, what's the use case? Shouldn't libass mimicks VSFilter? EDIT: Looked into VSFilterMod, API is barely usable and it is C++, so I cannot add a dll and call it. Sorry, there's not much I can do for that. I will however fix the output path in the future. Last edited by cubicibo; 20th November 2023 at 20:02. |
29th February 2024, 04:06 | #14 | Link | |
Registered User
Join Date: Nov 2023
Posts: 2
|
Quote:
https://github.com/koroban/avs2bdnxml), I saw it is also written in C, just porting and integrating it into your ass2bdnxml will be fine, if it is possible, multi-threading optimization during execution can improve efficiency, by the way, avs2bdnxml needs to be generated as an .avs script before running, like :"LoadPlugin("D:/VSFilterMod.dll") MaskSubMod("D:/mysubs/2.ass", 1920, 1080, 23.97602397602398, 223752) " , which has to be left to the main program to complete. |
|
13th December 2023, 23:16 | #15 | Link | |
Registered User
Join Date: Feb 2022
Posts: 125
|
ass2bdnxml v0.7a
This version fixes ASSDraw exports (before, it would often generate one XML/PNG event per frame...) and optimises the palette structure for the PGS format and Scenarist BD. Changes Quote:
Last edited by cubicibo; 18th January 2024 at 08:26. |
|
29th February 2024, 10:04 | #19 | Link |
Registered User
Join Date: Feb 2022
Posts: 125
|
avs2bdnxml and ass2bdnxml are very different. ass2bdnxml interfaces directly with libass and has its own frame rendering functions: it is very portable and efficient. avs2bdnxml is just differentiating contiguous frames and outputs PNG of whatever it gets. All of the code complexity is in VSFilter(Mod), AviSynth or any other AVS filter. I can't just pull kedaitinh12 VsFilterMod.dll and call it from ass2bdnxml easily.
Beside, I develop everything on macOS; I cannot build easily Windows apps, and VSFilter is a Windows-only technology. When I have time (not these days), I will try to parrot that code. If it does not work out, I will not try any harder with VsFilterMod. Just request or add the missing ASSA commands to libass. |
25th March 2024, 09:53 | #20 | Link | |
Registered User
Join Date: Feb 2022
Posts: 125
|
ass2bdnxml v0.7c
Very minor release again. Changes Quote:
|
|
Thread Tools | Search this Thread |
Display Modes | |
|
|