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

read_opus_ffmpeg fails on path with spaces #1153

Closed
CookiePPP opened this issue Sep 17, 2023 · 1 comment · Fixed by #1156
Closed

read_opus_ffmpeg fails on path with spaces #1153

CookiePPP opened this issue Sep 17, 2023 · 1 comment · Fixed by #1156

Comments

@CookiePPP
Copy link

CookiePPP commented Sep 17, 2023

# Add the input specifier after offset and duration.
cmd += f" -i {path}"

{path} isn't wrapped in quotes when creating the cmd string. ffmpeg misinterprets the spaces as arg separators.

Below is an example with dataset/J-Kash Uncensored/Legendary Tales of Georgia, Introduction &Pilot[38].opus as the path. The error raised by ffmpeg is dataset/J-Kash: No such file or directory

Stacktrace
(base) wrx80e@id2:/media/cookie/Designaire/_10_python_pkgs/_12_Speech/vall-e/egs/podcastsv3$ python prepare.py
Traceback (most recent call last):
  File "/home/wrx80e/anaconda3/lib/python3.10/site-packages/lhotse/audio.py", line 2351, in read_opus_ffmpeg
    channel_string = parse_channel_from_ffmpeg_output(proc.stderr)
  File "/home/wrx80e/anaconda3/lib/python3.10/site-packages/lhotse/audio.py", line 2388, in parse_channel_from_ffmpeg_output
    raise ValueError(
ValueError: Could not determine the number of channels for OPUS file from the following ffmpeg output (shown as bytestring due to avoid possible encoding issues):
b'/bin/sh: 1: Pilot[38].opus: not found\nffmpeg version 6.0-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2023 the FFmpeg developers\n  built with gcc 8 (Debian 8.3.0-6)\n  configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-libgme --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzvbi --enable-libzimg\n  libavutil      58.  2.100 / 58.  2.100\n  libavcodec     60.  3.100 / 60.  3.100\n  libavformat    60.  3.100 / 60.  3.100\n  libavdevice    60.  1.100 / 60.  1.100\n  libavfilter     9.  3.100 /  9.  3.100\n  libswscale      7.  1.100 /  7.  1.100\n  libswresample   4. 10.100 /  4. 10.100\n  libpostproc    57.  1.100 / 57.  1.100\ndataset/J-Kash: No such file or directory\n'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/media/cookie/Designaire/_10_python_pkgs/_12_Speech/vall-e/egs/podcastsv3/prepare.py", line 189, in <module>
    prepare_podcastsv3(args.src_dir, args.manifest_dir)
  File "/media/cookie/Designaire/_10_python_pkgs/_12_Speech/vall-e/egs/podcastsv3/prepare.py", line 45, in prepare_podcastsv3
    recording = Recording.from_file(opus_path)
  File "/home/wrx80e/anaconda3/lib/python3.10/site-packages/lhotse/audio.py", line 426, in from_file
    audio_info = info(
  File "/home/wrx80e/anaconda3/lib/python3.10/site-packages/lhotse/audio.py", line 1809, in info
    return opus_info(path, force_opus_sampling_rate=force_opus_sampling_rate)
  File "/home/wrx80e/anaconda3/lib/python3.10/site-packages/lhotse/audio.py", line 2244, in opus_info
    samples, sampling_rate = read_opus(
  File "/home/wrx80e/anaconda3/lib/python3.10/site-packages/lhotse/audio.py", line 2280, in read_opus
    return read_opus_ffmpeg(
  File "/home/wrx80e/anaconda3/lib/python3.10/site-packages/lhotse/audio.py", line 2364, in read_opus_ffmpeg
    raise AudioLoadingError(
lhotse.audio.AudioLoadingError: Could not determine the number of channels for OPUS file from the following ffmpeg output (shown as bytestring due to avoid possible encoding issues):
b'/bin/sh: 1: Pilot[38].opus: not found\nffmpeg version 6.0-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2023 the FFmpeg developers\n  built with gcc 8 (Debian 8.3.0-6)\n  configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-libgme --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzvbi --enable-libzimg\n  libavutil      58.  2.100 / 58.  2.100\n  libavcodec     60.  3.100 / 60.  3.100\n  libavformat    60.  3.100 / 60.  3.100\n  libavdevice    60.  1.100 / 60.  1.100\n  libavfilter     9.  3.100 /  9.  3.100\n  libswscale      7.  1.100 /  7.  1.100\n  libswresample   4. 10.100 /  4. 10.100\n  libpostproc    57.  1.100 / 57.  1.100\ndataset/J-Kash: No such file or directory\n'
The ffmpeg command for which the program failed is: 'ffmpeg -threads 1 -i dataset/J-Kash Uncensored/Legendary Tales of Georgia, Introduction &Pilot[38].opus -f f32le -threads 1 pipe:1', error code: 127
Suggested change
 # Add the input specifier after offset and duration. 
 cmd += f" -i {path}" 

to

 # Add the input specifier after offset and duration. 
 cmd += f" -i \"{path}\"" 
pzelasko added a commit that referenced this issue Sep 18, 2023
@pzelasko pzelasko linked a pull request Sep 18, 2023 that will close this issue
pzelasko added a commit that referenced this issue Sep 18, 2023
* Tutorial materials in main readme page

* Fixes for #1152 #1153 and #1154

* Fix isinstance use in Python 3.7-3.9
@pzelasko
Copy link
Collaborator

Thanks, should be fixed now.

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 a pull request may close this issue.

2 participants