Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable saving subtitles as .txt file #72

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

soraproducer
Copy link

TLDR

This PR introduces an option (--output_txt) to save subtitles directly into text files, facilitating research and other text-based analyses. This feature caters to users who prefer working with plain text for easier manipulation and integration with various tools.

Key Changes

  • Added --output_txt CLI argument.

  • Implemented text file saving in the get_subtitles function.

Motivation

Providing subtitles in txt format supports diverse applications, including NLP research, educational content creation, and media processing. It simplifies workflows by offering a straightforward, editable format.

Usage

Enable text file output with --output_txt true when running auto_subtitle.

Testing

The feature has been tested across multiple video inputs to ensure reliable text output alongside existing .srt file generation.

This streamlined functionality aims to enhance the tool's versatility for all users.

Copy link

what-the-diff bot commented Mar 19, 2024

PR Summary

  • Introduction of New Command Line Argument
    A new command line argument named --output_txt has been added. This allows users to choose whether or not they want to save the subtitles in a text file. It offers greater flexibility to control the flow of the script.

  • Function 'get_subtitles' Modification
    The get_subtitles function has been updated to work in conjunction with the new output_txt argument. It now has the ability to save subtitles to a text file when output_txt is enabled (True). This makes the subtitle extraction process more adaptable to users' specific needs.

Copy link

@sbrl sbrl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a member of this repo, but got a small suggestion anyway.

Otherwise looks good! Hopefully the actual maintainer will see these PRs soon. If not, maybe fork time?

@@ -18,6 +18,8 @@ def main():
default=".", help="directory to save the outputs")
parser.add_argument("--output_srt", type=str2bool, default=False,
help="whether to output the .srt file along with the video files")
parser.add_argument("--output_txt", type=str2bool, default=False,
help="whether to save the subtitles in a txt file")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this would read better?

Suggested change
help="whether to save the subtitles in a txt file")
help="whether to also output the subtitles as a .txt file")

.....the existing description implies that a .txt file is generated instead of other outputs, which isn't the case I note from reading the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants