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. |
30th December 2011, 00:45 | #1 | Link |
Registered User
Join Date: Dec 2011
Posts: 192
|
TrimSubs - Script to cut text subtitles + AvsP macros
This Python script parses a specified Avisynth script for a line with uncommented Trims, and cuts an input text subtitle file accordingly so the subtitles match the trimmed video. It's intended as a companion to vfr.py, script that creates chapter files based on Trims and that also can cut audio files. It can be specially useful for Matroska ordered chapters.
There are three ways of specifying the line of the avs used: · Parse the avs from top to bottom (default) or vice versa, and use the first line with Trims found. · Use a line with a specific comment at the end, e.g: Trim(0,99)++Trim(200,499) # cuts · Directly specifying the Trims line number, starting with 1. A frame rate or timecode file (v1 or v2) is required, except for MicroDVD subtitles. A new trimmed timecode v2 file can be generated optionally. Supported subtitle formats: ASS, SSA, SRT, SUB (MicroDVD). Code:
usage: TrimSubs.py script.avs [-h [{doc}]] [-V] [-v] [-r] [-l LABEL] [-g LINE] [-f FPS] [-t [OTC]] [-i [INPUT]] [-c ENCODING] [-o OUTPUT] Info arguments: -h [{doc}], --help [{doc}] Show a help message and exit. Add 'doc' to include also the documentation -V, --version Show program's version number and exit Required arguments: script.avs Avisynth script containing Trims Optional arguments: (--input or --otc parameter is required) -v, --verbose Show detailed info -r, --reversed Parse the avs from bottom to top -l LABEL, --label LABEL Use the Trims from the line in the avs that ends in a commentary with LABEL -g LINE, --line LINE Use the Trims from the line nº LINE -f FPS, --fps FPS Frame rate or timecode file (v1 or v2). If omitted, search for a timecode file or default to 24000/1001 -t [OTC], --otc [OTC] Output a new timecode file. Path optional -i [INPUT], --input [INPUT] Input subtitle file. If INPUT is not specified, search for a valid input file -c ENCODING, --encoding ENCODING Input subtitle file encoding -o OUTPUT, --output OUTPUT Custom path for the output subtitle file TrimSubs.py (Python script, needs Python 3.2 and PySubs) TrimSubs.exe (Windows executable, without dependencies) TrimSubs repository I've made some AvsP macros to easy the use of vfr.py and TrimSubs. These links may be out of date, latest version is always here: · AvsP macro - Insert and format Trims Contains the following macros:· AvsP macro - Insert Trims from Matroska chapter file This can be useful to redo a previously non-ordered chapters encode to ordered, if the original avs is no longer available. Currently only constant frame rate is supported.· AvsP macro - Create/join timecodes from Trims Assign a FPS or timecode to every Trim in a specified line and create a new timecode that can span all the video range or only the Trims. It's meant to be used when obtaining a VFR video as a result of deinterlacing/IVTC various sections of the video in different ways, or joining several videos of different FPS.. AvsP macro - Trim timecode This functionality is already included on TrimSubs, but it's useful to have it as a stand-alone macro as well.· AvsP macro - Matroska chapters from Trims (needs vfr.py and TrimSubs) Wrapper for vfr.py and TrimSubs.py. Generate Matroska chapters from Avisynth Trims. Additionally cut audio and text subtitles to match the trimmed video.· AvsP macro - Chapter names from file Replace default chapter names in the Matroska chapter files on a given directory with the ones provided in a specified file, one chapter name per line.The macros must be put in your "AvsPmod\macros" directory. Note that the order of appearance in the macro menu can be customized by prefixing "[number]" to the filenames. Please read the complete info and change (if desired) the preferences on the first lines of each script. Changelog: 2011-12-30: initial release Last edited by vdcrim; 17th September 2012 at 02:11. |
Tags |
avisynth, avsp, ordered chapters, subtitles |
Thread Tools | Search this Thread |
Display Modes | |
|
|