Git Product home page Git Product logo

scriptx's Introduction

ScriptX

Rust Project Status: Active โ€“ The project has reached a stable, usable state and is being actively developed.

ScriptX is a command line tool designed to extract scriptures out of the American Sign Language version of the New World Translation, NWT, Bible published by the Watch Tower Bible and Tract Society of Pennsylvania. It is useful when you need specific scripture(s) in a standalone file. A quick example would be if you need to splice scriptures into another video.

All the meta data stored within the original file is retained even after being extracted, so when extracting a range you will still have access to chapter markers within your extracted video.

Features

  • Extract single or a range of scriptures eg. -v 5-10 extracts verses ranging from 5 to 10
  • Extracts all scriptures into individual files with -a
  • Maintains all metadata from the original file
  • Doesn't transcode so blazing ๐Ÿ”ฅ fast!

scriptx-demo

Known Issues

Some scripture videos files that can be downloaded from https://www.jw.org do not contain the meta data necessary for ScriptX to process. At the moment there are not work around for this problem. If ScriptX is ran on a file that causes a crash, this is likely the problem.

Dependencies

ffmpeg is required and has to be installed.

Installation

ScriptX hasn't been tested on Windows but it should work. If it doesn't create an issue and I will look into it.

From Source

Use Cargo to install ScriptX.

$ cargo install scriptx

If you prefer to install using the repository instead:

$ cargo install --git https://github.com/JoelMon/scriptx

Package

Ubuntu deb packages for amd64 systems are provided in the releases.

Usage

ScriptX is a command line tool to extract scriptures out of the American Sign Language version of the New World
Translation.

USAGE:
    scriptx [OPTIONS] --file <file> <--all|--verse <verse>>

FLAGS:
    -a, --all        Extracts all scriptures from the file.
    -h, --help       Prints help information
    -V, --version    Prints version information

OPTIONS:
    -f, --file <file>             The input video file to process.
    -o, --output <output_path>    The path were to save the output file. [default: output.m4v]
    -v, --verse <verse>           The verse to be extracted out. A single verse or a range of verses can be extracted.
                                  e.g. 2-5

Contributing

Pull requests are welcome. For major changes or if unsure about a contribution, please open an issue first to discuss what you would like to change.

Please, also remember to run tests to make sure everything is okay.

License

MIT

Note

This project, ScriptX, is not made by nor is it associated with the Watch Tower Bible and Tract Society of Pennsylvania.

scriptx's People

Contributors

joelmon avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

scriptx's Issues

Crash with cretin books of the Bible, example Psalms 3

Some books of the Bible are producing errors:

thread 'main' panicked at 'The prefix pattern was not found.', src/ffwrappers/probe.rs:246:21
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

The reason for this crash is due to the Psalms videos not having a title tag.

        {
            "id": 2,
            "time_base": "1/1000",
            "start": 40007,
            "start_time": "40.007000",
            "end": 79413,
            "end_time": "79.413000",
            "tags": {
                "title": ""
            }

May crash with books that don't include all verses

Some books of the Bible don't include all verses. I suspect that the program will crash when using the -a flag with these books. Need to test it.

  • Find a book with a missing verse
  • Test it with the -a flag.

Some books do not cut properly: e.g. Deuteronomy & Exodus

Discovered that the book of Deuteronomy does not cut properly. Was trying to cut Deuteronomy 7:4 when I discovered the problem.

Update: Problem occurs with Exodus as well.

I also cut 1 Corinthians chapter 6 and 7 without an issue.

Problem

The video produced remains black and only shows the scripture towards the end in slow motion and choppy. Currently, Deuteronomy 7 is the only book I have run into that this happens, There may be more.

Notes

While using ScriptX v0.3.2, should affect all versions <= v0.3.2.

For Research

Codec: H.264

The H.264 codec isn't a single codec, there are various profiles, for example, there are to mention three:

  • H.264 (Baseline)
  • H.264 (Main)
  • H.264 (High)

These profiles produces video files with the same quality but uses less bandwidth when streaming.1, 2, 3 The video codec used with Deuteronomy is H.264 (High) while the codec used in 1 Corinthians chapter 6 and 7 is H.264 (Baseline). The book of Genesis uses H.264 (Constrained Baseline Profile) -- note, the book of Genesis cuts fine.

If the file's H.264 profile is causing the problem, then a possible solution is to pass the profile to ffmpeg when processing.4 As an example:

ffmpeg -i input.mp4 -c:v libx264 -profile:v high -level:v 4.0 -c:a copy output.mp4

Matadata regarding codec used in Exodus:

    Stream #0:0(eng): Data: bin_data (tx3g / 0x67337874), 0 kb/s
    Metadata:
      creation_time   : 2014-02-28T21:41:42.000000Z
      handler_name    : Apple Text Media Handler
    Stream #0:1(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720, 1563 kb/s, 29.97 fps, 29.97 tbr, 2997 tbn, 5994 tbc (default)
    Metadata:
      creation_time   : 2014-02-28T21:41:42.000000Z
      handler_name    : Apple Video Media Handler
    Stream #0:2: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 288x288, 90k tbr, 90k tbn, 90k tbc (attached pic)

Todo

  • Find another video that uses H.264 (High) and see if the problem occurs. [edit: problem occurs with the book of Exedus as well which uses - H.264 (High)]
    • If so, try passing the profile to ffmpeg.

Use a progress bar

Remove the time stamp debugging output to terminal and replace it with a progress bar instead. Especially helpful when the -a flag is used for extracting all scriptures from the file.

Consider using indicatif.

Add a video extension when user doesn't add one

When the user uses the -o flag, they have to add a video container extension otherwise the program crashes without any indication of what went wrong.

Example

$ scriptx -f nwt_01_Ge_ASL_10_r480P.m4v -v 20 -o Gen10-20
thread 'main' panicked at 'ffmpeg's exit status was FAILURE', /home/joel/.cargo/registry/src/github.com-1ecc6299db9ec823/scriptx-0.2.1/src/ff.rs:191:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Solution

  1. If the user doesn't add an extension, add one by default
  2. Improve error handling to be more informative

Write tests

The project needs to have tests, especially the library.

Improve error handling

Not all videos have the correct meta data causing the program to crash. Improve the error handling for better user experience.

See issue #30.

Update short description in app's --help

scriptx --help still displays a general short description. Replace it with: ScriptX cuts verses from the American Sign Language version of the New World Translation Bible.

Duplicate output file handling

ScriptX crashes when it tries to output a file that already exists.

Fix

  • handling of outputting of a file that already exists. Better error reporting for example.
  • fine a solution to three problem. The error Comes from ffmpeg, perhaps there's a flag that can be used to override existing files.

Set up a PPA

Set up a PPA so Ubuntu users can download the latest version without having to use cargo install.

Automatically detect book and chapter

ScriptX should be able to automatically detect the book and chapter of the video in order to avoid the user from having to type it in, for example, `-v "joel 1:1".

Instead the user should just have to type `-v 1" and program fills in the book name and chapter number when searching title tags.

Migration to clap 3

Make needed change to the clap code to be able to migrate to clap 3. The current version of clap being used is 2.33.4.

Restructure how data is passed around

Currently have a mess of methods chained together passing values around and it's only going to get worse.

Consider fixing it with additional structs to deal with time stamps and any other thing needed to carry out its function.

Implement ranges

Implement the ability to call for a range to be cut. For example, -v 4-6 would cut verses 4 though 6.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.