Skip to content

ommer-of-noms/youtube-ass

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Code to download and convert Youtube XML annotations to ASS format
http://en.wikipedia.org/wiki/SubStation_Alpha#Advanced_SubStation_Alpha

Details about the ASS file format can be found at:
* http://www.matroska.org/technical/specs/subtitles/ssa.html
* http://moodub.free.fr/video/ass-specs.doc

This conversion script tries to maintain:

* Correct timing and text
* Font colour and background colour (can be improved)
* Positioning and width of subtitle text around the video

Positioning is hard to translated into ASS format because it uses Margins
instead of x/y and there's very little control over vertical spacing.

TODO:
* Support languages other than English
    * Done? Switched to Python3 and got this for free. Removed references to 'encode'
* Try to use ASS Picture Event lines to create transparent text boxes
* Use ffmpeg to mux the audio/video/subtitle streams into mkv
* What about automatic captions?
    * youtube-dl handles these now, so don't need to add this functionality
* Make a way to remove annotations like "Click Here", "Subscribe", etc.
* More that I'm forgetting.

Released under the CC-0 License

No code references were used while writing this parser, hence it's free of
derivative licensing problems.

Created for use by youtube-dl:
* ytdl-org/youtube-dl#90


$ ./youtube-ass.py -h
usage: youtube-ass.py [-h] [-c] [-d] (-a | -f FILENAME)

optional arguments:
  -h, --help            show this help message and exit
  -c, --youtube-dl-compatablity-mode
                        Use with youtube-dl --exec, strips the file extension
                        and replaces it with .annotations.xml, only functions
                        in single file mode
  -d, --delete-annotations
                        Delete annotations after processing them
  -a, --all             Process all *.annotations.xml files in the CWD
  -f FILENAME, --filename FILENAME
                        Single file name to process

to use with youtube-dl:
    Keep the annotation files
        youtube-dl --write-annotations --exec '/path/to/youtube-ass.py -c -f {}' [OPTIONS] URL [URL...]
    delete the annotation files when finished
        youtube-dl --write-annotations --exec '/path/to/youtube-ass.py -c -d -f {}' [OPTIONS] URL [URL...]

About

Converts YouTube XML Annotations to ASS subtitles

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%