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

ffmpeg related #22

Closed
neonFog opened this issue Jan 12, 2018 · 13 comments
Closed

ffmpeg related #22

neonFog opened this issue Jan 12, 2018 · 13 comments

Comments

@neonFog
Copy link

neonFog commented Jan 12, 2018

(from https://ericheikes.com/text-speech-tool-aws-polly/#comment-66038)

Any idea what I may need to fix. I'm new to this and just trying to speech2text some school literature.
Thanks.

Used format: aws-tts [inputfile] outputfile [--access-key KEY --format mp3]
✔ Reading text
✔ Splitting text
✔ Convert to audio (99/99)
✖ Combine audio
ℹ ffmpeg returned an error (1):
receive errors:
[mp3 @ 0x7fc596008000] Format mp3 detected only with low score of 1, misdetection possible!

[mp3 @ 0x7fc596008000] Failed to read frame size: Could not seek to 1030.
[concat @ 0x7fc595802e00] Impossible to open '/var/folders/xl/mwfv7m896z1g2fnr6c3mrgy00000gn/T/f71ad45b-8738-4170-8b20-86164d2f0f7e.mp3'

@eheikes
Copy link
Owner

eheikes commented Jan 13, 2018

I'm not sure I can reproduce this problem. Can you provide me with any of the following info?

  1. Run node -v; ffmpeg -version in the terminal and paste the output here.
  2. What is the exact aws-tts command you are running? (Leave out your access key/secret)
  3. If possible, upload the input text file to pastebin.com or somewhere and link to it here.

@neonFog
Copy link
Author

neonFog commented Jan 14, 2018 via email

@eheikes
Copy link
Owner

eheikes commented Jan 15, 2018

Yeah, it looks like ffmpeg is failing to concat the individual MP3 pieces together. It's basically running ffmpeg -f concat -safe 0 -i xxxxxx.txt -c copy to combine the MP3s from AWS.

I tested your text file on my Macbook and it runs fine:

✗ aws-tts Sharott2018txt2Polly.txt Sharott2018.mp3 --format mp3
✔ Reading text
✔ Splitting text
✔ Convert to audio (49/49)
✔ Combine audio
✔ Clean up
✔ Done. Saved to Sharott2018.mp3

I ran it under Node 9.4.0 and the ffmpeg binary that installs with Homebrew (v3.4.1). I also downloaded the snapshot you're using (from https://evermeet.cx/pub/ffmpeg/snapshots/) and it worked too.

So it seems to be a problem with your machine. Are you able to use ffmpeg normally? You should be able to combine 2 or more MP3s using the concat demuxer, as shown on this page and the above command.

The only other thing I can think of is that the temporary files are not being saved correctly. Does running mkdir -p /var/folders/xl/mwfv7m896z1g2fnr6c3mrgy00000gn/T in the terminal work? (There should be no output if it succeeds.)

@neonFog
Copy link
Author

neonFog commented Jan 15, 2018

Thanks for giving it a go.
I don't use ffmpeg for anything else. I installed it just for this purpose.

I made two mp3s, followed the directions at your link and successfully concatenated the files. I ran the command:
ffmpeg -f concat -safe 0 -i mylist.txt -c copy output.mp3
It worked and the file plays. So, ffmpeg appears to function.

Perhaps your final intuition is correct. From my desktop, I ran:
mkdir -p /var/folders/xl/mwfv7m896z1g2fnr6c3mrgy00000gn/T
As you warned, there was no output. However, I ran ls -a and no directory was made, neither on my desktop nor at my root dir.

Still, I'm receiving the following error. May these lines suggest that the correct temporary files are not being written?

[mp3 @ 0x7f90dd008000] Format mp3 detected only with low score of 1, misdetection possible!

[mp3 @ 0x7f90dd008000] Failed to read frame size: Could not seek to 1030.
[concat @ 0x7f90dc800000] Impossible to open '/tmp/a2a40612-1a6f-48dd-be66-3d8e73738666.mp3'

/tmp/323574e6-999b-4a8b-a5d4-6a7cf7c88cbf.txt: Invalid argument

I've checked around online for similar errors and restarted my computer. Please let me know if you think of anything. It would be great to resolve this.

@eheikes
Copy link
Owner

eheikes commented Jan 17, 2018

I'm not sure what else to try without modifying the aws-tts script itself. Can you save this script and run it?

So if you save it to your desktop as test.js, you can run it on the command line with node ~/Desktop/test.js.

@neonFog
Copy link
Author

neonFog commented Jan 19, 2018

I appreciate it.

Script's terminal output:
All good!

Your interpretation?

@eheikes
Copy link
Owner

eheikes commented Jan 20, 2018

I think that rules out one possible problem. Unfortunately, I don't have any more good ideas. I can try adding more debugging to aws-tts to help narrow down the issue, but that will take a bit of work.

@neonFog
Copy link
Author

neonFog commented Jan 21, 2018

Got it. I appreciate it the help

@eheikes
Copy link
Owner

eheikes commented Feb 1, 2018

@neonFog I have published a new version that can print out debugging info. Can you install that and try again?

npm install tts-cli@1.4.0 -g
export DEBUG=*
tts-cli Sharott2018txt2Polly.txt Sharott2018.mp3 --access-key KEY --format mp3

then copy & paste the output here? It should obscure your AWS credentials if I programmed it correctly.

@kinnera01
Copy link

I ran into the similar problem, I could fix it by passing my AWS credentials in opts object.

@eheikes
Copy link
Owner

eheikes commented May 8, 2018

I haven't heard of further problems, so closing for now.

@eheikes eheikes closed this as completed May 8, 2018
@brajeshvisio01
Copy link

I ran into the similar problem, I could fix it by passing my AWS credentials in opts object.

@kinnera01 can you please tell me in details to solve this issue, I didn't get opts object.

@eheikes
Copy link
Owner

eheikes commented Oct 30, 2023

@brajeshvisio01 The credentials can be included through the --access-key and --secret-key options on the command line -- see the docs. That's my best guess for what kinnera01 meant.

If you're still running into problems, can you open a new issue and I will investigate?

npm install tts-cli@5.0.0 -g
export DEBUG=*
tts-cli <REST OF YOUR COMAND HERE>

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

No branches or pull requests

4 participants