audiogrep icon indicating copy to clipboard operation
audiogrep copied to clipboard

subprocess.CalledProcessError ... returned non-zero exit status 255

Open sethwoodworth opened this issue 9 years ago • 14 comments

» ./audiogrep.py --input ./Romeo_and_Juliet_Act_1_64kb.mp3 --transcribe                                                                                                                 seth@localhost
ffmpeg version 2.5.4-1 Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.9.2 (Debian 4.9.2-10)
  configuration: --prefix=/usr --extra-version=1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --shlibdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --enable-shared --disable-stripping --enable-avresample --enable-avisynth --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libshine --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libwavpack --enable-libwebp --enable-libxvid --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzvbi --enable-libzmq --enable-frei0r --enable-libvpx --enable-libx264 --enable-libsoxr --enable-gnutls --enable-openal --enable-libopencv --enable-librtmp --enable-libx265
  libavutil      54. 15.100 / 54. 15.100
  libavcodec     56. 13.100 / 56. 13.100
  libavformat    56. 15.102 / 56. 15.102
  libavdevice    56.  3.100 / 56.  3.100
  libavfilter     5.  2.103 /  5.  2.103
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Input #0, mp3, from './Romeo_and_Juliet_Act_1_64kb.mp3':
  Metadata:
    title           : Act 1
    artist          : William Shakespeare
    album           : Romeo and Juliet
    track           : 1
  Duration: 00:46:15.25, start: 0.050113, bitrate: 64 kb/s
    Stream #0:0: Audio: mp3, 22050 Hz, mono, s16p, 64 kb/s
    Metadata:
      encoder         : LAME3.96r
    Side data:
      replaygain: track gain - 7.300000, track peak - unknown, album gain - unknown, album peak - unknown, 
File './Romeo_and_Juliet_Act_1_64kb.mp3.temp.wav' already exists. Overwrite ? [y/N] n
Not overwriting - exiting
1/1 Transcribing ./Romeo_and_Juliet_Act_1_64kb.mp3.temp.wav
Traceback (most recent call last):
  File "./audiogrep.py", line 217, in <module>
    transcribe(files)
  File "./audiogrep.py", line 37, in transcribe
    transcript = subprocess.check_output(['pocketsphinx_continuous', '-infile', f, '-time', 'yes', '-logfn', '/dev/null', '-vad_prespeech', str(pre), '-vad_postspeech', str(post)])
  File "/usr/lib/python2.7/subprocess.py", line 573, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '['pocketsphinx_continuous', '-infile', './Romeo_and_Juliet_Act_1_64kb.mp3.temp.wav', '-time', 'yes', '-logfn', '/dev/null', '-vad_prespeech', '10', '-vad_postspeech', '50']' returned non-zero exit status 255

I'm less clear what the error is since it is happening on the far side of the subprocess call.

sethwoodworth avatar Mar 07 '15 19:03 sethwoodworth

Pocketsphinx was failing for me, too. If you remove '-logfn', '/dev/null' from the parameters in line 37 of audiogrep.py, you will see the log from pocketsphinx.

Mine said this at first:

INFO: feat.c(713): Initializing feature stream to type: '1s_c_d_dd', ceplen=13, CMN='current', VARNORM='no', AGC='none'
INFO: cmn.c(142): mean[0]= 12.00, mean[1..12]= 0.0
ERROR: "acmod.c", line 85: Acoustic model definition is not specified neither with -mdef option nor with -hmm

I realized that the way I installed it (I'm on ubuntu and did apt-get install pocketsphinx-utils), might not have installed any kind of acoustic/language models. So I installed the package, pocketsphinx-hmm-en-hub4wsj, and then it complained about not setting anything with -hmm.

So I modified the line that sets the parameters to the pocketsphinx_continuous call, giving it the location of the language model:

transcript = subprocess.check_output(['pocketsphinx_continuous', '-infile', f, '-hmm', '/usr/share/sphinx-voxforge-en/hmm/voxforge_en_sphinx.cd_cont_3000', '-time', 'yes', '-vad_prespeech', str(pre), '-vad_postspeech', str(post)])

It still complained about a missing something or other, so I installed another package, pocketsphinx-lm-en-hub4.

Now it is analyzing happily and my computer fan is buzzing away. It's taking a while... hopefully nothing breaks! I also wonder if there was a more straightforward way of doing this...

brianfay avatar Mar 07 '15 22:03 brianfay

Hey - thanks for letting me know about this - I've only tested it on a mac. I should add some instructions about installing it on Ubuntu.

antiboredom avatar Mar 07 '15 22:03 antiboredom

Your comment was very helpful. I've removed where the subprocess pipes the logs to /dev/null but I'm still not quite able to get it to work.

The debian version of pocketsphinx-hmm-en-hub4wsj doesn't contain the file voxforge_en_sphinx.cd_cont_3000:

https://packages.debian.org/jessie/all/pocketsphinx-hmm-en-hub4wsj/filelist

I will dig into this more in the morning.

sethwoodworth avatar Mar 08 '15 06:03 sethwoodworth

I got it running on ubuntu 14.04 after applying @YottaSecond’s suggestions. Caveat on 14.04: I needed to change ffmpeg to avconv, since avconv is the shipped alternative to ffmpeg in this version.

jdittrich avatar Mar 08 '15 15:03 jdittrich

@jdittrich, have you successfully generated any mp3s? Supercut.mp3 keeps coming back as 0 bytes for me, even though the log shows a bunch of different areas that are being cut.

brianfay avatar Mar 08 '15 15:03 brianfay

@YottaSecond No, only transcripts – avconv crashes while generating (so I get 0byte files, too).

jdittrich avatar Mar 08 '15 16:03 jdittrich

@YottaSecond @jdittrich I'm having the same problem. It generates transcripts (which for the most part are single words on each line but with some very large unbroken sections) and indicates its adding bits into the supercut but this ends up being 0 bytes. Perhaps a new bug should be filed for this specifically?

OisinMoran avatar Mar 08 '15 22:03 OisinMoran

@OisinMoran @jdittrich We're all using avconv, right? Maybe this will work properly if we actually switch to ffmpeg? Or maybe it's just a matter of getting the right arguments for avconv?

I was having trouble finding a repository for ffmpeg, though, and I'm wondering if I'll have to build that from source? Right now it seems like a lot of work to do in order to make Obama say silly things, but if I do make any progress I'll be sure to update!

brianfay avatar Mar 09 '15 03:03 brianfay

future ubuntu 15.04 includes ffmpeg again. The rather active ubuntuusers.de-wiki suggests using ppa:jon-severinsson/ffmpeg if one needs it. If anybody tries ffmpeg on linux instead of avconv, let us know.

jdittrich avatar Mar 09 '15 08:03 jdittrich

@YottaSecond I am using ffmpeg and got it from the ppa:jon-severinsson/ffmpeg that @jdittrich suggested. I'm doing this all on linux btw

OisinMoran avatar Mar 09 '15 12:03 OisinMoran

@OisinMoran a new bug makes sense imho, otherwise it will be hard for maintainers to see what the actual issues are.

jdittrich avatar Mar 09 '15 12:03 jdittrich

I am working on a docker image for audiogrep and I ran into some of these issues as well. It really helps to just run the pocketsphinx command directly and see what it throws - so far I came across missing the hmm and lm libs and now I am trying a file that is too big and I get this error http://sourceforge.net/p/cmusphinx/discussion/help/thread/f609780c/

kevinhughes27 avatar Mar 21 '15 20:03 kevinhughes27

Dockerfile for interests sake https://github.com/kevinhughes27/audiogrep-docker/blob/master/Dockerfile

kevinhughes27 avatar Mar 21 '15 20:03 kevinhughes27

@sethwoodworth If you install pocketsphinx from the pocketsphinx website rather than from the debian package manager it works. The version packaged in debian is 0.8-5, the current version is 4-5

SwartzCr avatar Oct 26 '16 21:10 SwartzCr