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

Output file #17

Closed
paveloom opened this issue Oct 3, 2022 · 3 comments
Closed

Output file #17

paveloom opened this issue Oct 3, 2022 · 3 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@paveloom
Copy link

paveloom commented Oct 3, 2022

Hello there. Seems like redirecting the standard output with either >, >> or tee doesn't work. Would be nice to have an option to save the output to a specific file.

@ggerganov ggerganov added enhancement New feature or request good first issue Good for newcomers labels Oct 4, 2022
@ghost
Copy link

ghost commented Oct 8, 2022

I use redirection with > and for me it works without problems.

Maybe you're experiencing buffering? Shell redirection to my knowledge by default uses output buffering, i.e. you will not see data as it is written by the program. Instead, data will be written to the file whenever there (according to the buffering implementation) is enough data.

You can change the buffering with stdbuf. For example, to write to the file once per line you could call:

stdbuf -oL ./main -m models/ggml-large.bin -f input.wav > output.txt

One useful option imo would be to get the output without all model loading info (lines starting with whisper_model_load: and main:). Imo, the model loading info could be written to stderr, because it is intended for human readers, while the actual detections could go to stdout. Then a normal redirection with > would still output the model loading info on the screen.

ggerganov added a commit that referenced this issue Oct 8, 2022
Support for:

- plain text
- VTT
- SRT
ggerganov added a commit that referenced this issue Oct 8, 2022
Only the transcribed/translted text is printed to stdout.
This way, one can redirect the result to a file.
@ggerganov
Copy link
Owner

You can now output the results to multiple file formats. For example:

./main -m models/ggml-tiny.en.bin -f samples/jfk.wav -otxt -ovtt -osrt

will generate .txt, .vtt and .srt files.

Also, you can now redirect the results with >, as suggested by @aufziehvogel

@paveloom
Copy link
Author

paveloom commented Oct 8, 2022

Yeah, I thought it's related to buffering, too, @aufziehvogel. I think I waited for quite a while, though, and yet nothing showed up. Anyhow, thanks for letting me know about stfbuf, that fixed it!

Thanks, @ggerganov!

@paveloom paveloom closed this as completed Oct 8, 2022
anandijain pushed a commit to anandijain/whisper.cpp that referenced this issue Apr 28, 2023
Support for:

- plain text
- VTT
- SRT
anandijain pushed a commit to anandijain/whisper.cpp that referenced this issue Apr 28, 2023
Only the transcribed/translted text is printed to stdout.
This way, one can redirect the result to a file.
jacobwu-b pushed a commit to jacobwu-b/Transcriptify-by-whisper.cpp that referenced this issue Oct 24, 2023
Support for:

- plain text
- VTT
- SRT
jacobwu-b pushed a commit to jacobwu-b/Transcriptify-by-whisper.cpp that referenced this issue Oct 24, 2023
Only the transcribed/translted text is printed to stdout.
This way, one can redirect the result to a file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants