eheikes / tts

Tools to convert text to speech :books::speech_balloon:
Apache License 2.0
94 stars 19 forks source link

ffmpeg related #22

Closed neonFog closed 6 years ago

neonFog commented 6 years ago

(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 commented 6 years ago

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 commented 6 years ago

Hi, Yes, we have also been corresponding on your blog. I also responded with this information there. I'm running highSierra 10.13.3

node -v v9.4.0

Do you think I incorrectly installed node? I have no experience with it. I am using the command "aws-tts"

aws-tts Sharott2018txt2Polly.txt Sharott2018.mp3 —access-key KEY —format mp3

This is the error returned: ✔ Reading text

✔ Splitting text

✔ Convert to audio (99/99)

✖ Combine audio

ℹ ffmpeg returned an error (1):

ffmpeg version N-89776-gb94cd55155-tessus Copyright (c) 2000-2018 the FFmpeg developers

built with Apple LLVM version 9.0.0 (clang-900.0.39.2)

configuration: --cc=/usr/bin/clang --prefix=/opt/ffmpeg --extra-version=tessus --enable-avisynth --enable-fontconfig --enable-gpl --enable-libass --enable-libbluray --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopus --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzmq --enable-libzvbi --enable-version3 --pkg-config-flags=--static --disable-ffplay

libavutil 56. 7.100 / 56. 7.100

libavcodec 58. 9.100 / 58. 9.100

libavformat 58. 3.100 / 58. 3.100

libavdevice 58. 0.100 / 58. 0.100

libavfilter 7. 11.101 / 7. 11.101

libswscale 5. 0.101 / 5. 0.101

libswresample 3. 0.101 / 3. 0.101

libpostproc 55. 0.100 / 55. 0.100

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

[mp3 @ 0x7f96f0802c00] Failed to read frame size: Could not seek to 1030.

[concat @ 0x7f96f0002e00] Impossible to open '/var/folders/xl/mwfv7m896z1g2fnr6c3mrgy00000gn/T/81320774-5505-441a-82ac-029b37d97223.mp3'

/var/folders/xl/mwfv7m896z1g2fnr6c3mrgy00000gn/T/74d7c3c5-1083-47b5-87f8-1b208ae35ae4.txt: Invalid argument

So, is this a failure merely to concat the files? I appreciate the help.

AV

On Sat, Jan 13, 2018 at 11:22 AM, Eric Heikes notifications@github.com wrote:

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.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/eheikes/aws-tts/issues/22#issuecomment-357459413, or mute the thread https://github.com/notifications/unsubscribe-auth/ALsOPZ2ccytntl5FzmRkI9iNf4k1nq4Mks5tKQKIgaJpZM4RcwDA .

-- Amir Vala Tavakoli Research Assistant, UCLA Department of Psychology Caltech Divison of Biology and Biological Engineering

eheikes commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

I appreciate it.

Script's terminal output: All good!

Your interpretation?

eheikes commented 6 years ago

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 commented 6 years ago

Got it. I appreciate it the help

eheikes commented 6 years ago

@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 commented 6 years ago

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

eheikes commented 6 years ago

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

brajeshvisio01 commented 1 year ago

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 commented 1 year ago

@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>