tauri-apps / tauri

Build smaller, faster, and more secure desktop and mobile applications with a web frontend.
https://tauri.app
Apache License 2.0
85.16k stars 2.57k forks source link

[bug] Command.sidecar API doesn't pass args to the external bin #4887

Closed Sukaato closed 2 years ago

Sukaato commented 2 years ago

Describe the bug

Will you make an call to a sidecar with Command.sidecar('bin/ffmpeg', '-args') None of them is passed to the sidecar

Reproduction

  1. Clone https://github.com/Sukaato/blob-downloader
  2. npm i
  3. npm run tauri dev
  4. get .m3u8 url file
  5. click on button "Télécharger"
  6. Check web and rust logs

Expected behavior

pass args when sidecar is called

Platform and versions

Environment › OS: Windows 10.0.19044 X64 › Webview2: 103.0.1264.77 › MSVC:

Packages › @tauri-apps/cli [NPM]: 1.0.5 › @tauri-apps/api [NPM]: 1.0.2 › tauri [RUST]: 1.0.5, › tauri-build [RUST]: 1.0.4, › tao [RUST]: 0.12.2, › wry [RUST]: 0.19.0,

App › build-type: bundle › CSP: unset › distDir: ../www › devPath: http://localhost:3333/ › framework: React › bundler: Rollup

App directory structure ├─ bin ├─ node_modules ├─ scripts ├─ src ├─ src-tauri ├─ tmp └─ www

Stack trace

default message when ffmpeg is called without args

"ffmpeg version N-107644-gf56730fb6f-20220803 Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 12.1.0 (crosstool-NG 1.25.0.55_3defb7b)
  configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-w64-mingw32- --arch=x86_64 --target-os=mingw32 --enable-version3 --disable-debug --disable-w32threads --enable-pthreads --enable-iconv --enable-libxml2 --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-lzma --enable-fontconfig --enable-libvorbis --enable-opencl --disable-libpulse --enable-libvmaf --disable-libxcb --disable-xlib --enable-amf --enable-libaom --enable-libaribb24 --disable-avisynth --enable-libdav1d --disable-libdavs2 --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --disable-frei0r --enable-libgme --enable-libass --enable-libbluray --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librist --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --enable-libmfx --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-librav1e --disable-librubberband --enable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --disable-libdrm --disable-vaapi --disable-libvidstab --enable-vulkan --enable-libshaderc --enable-libplacebo --disable-libx264 --disable-libx265 --disable-libxavs2 --disable-libxvid --enable-libzimg --enable-libzvbi --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-ldflags=-pthread --extra-ldexeflags= --extra-libs=-lgomp --extra-version=20220803
  libavutil      57. 31.100 / 57. 31.100
  libavcodec     59. 41.100 / 59. 41.100
  libavformat    59. 29.100 / 59. 29.100
  libavdevice    59.  8.101 / 59.  8.101
  libavfilter     8. 46.101 /  8. 46.101
  libswscale      6.  8.101 /  6.  8.101
  libswresample   4.  8.100 /  4.  8.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

Use -h to get full help or, even better, run 'man ffmpeg'
"

Additional context

In this exemple i call rust back-end

     // it work
    await invoke('command_ffmpeg', {
      args: [
        '-y',
        `-i`,
        options.url,
        '-c:v',
        'h264_nvenc',
        '-b:v',
        '2.6M',
        '-filter:v',
        'fps=25',
        `${await downloadDir()}test.mp4`,
      ]
    });

    // it doesn't work
    await invoke('command_ffmpeg', {
      args: [
        '-y',
        `-i ${options.url}`,
        '-c:v h264_nvenc',
        '-b:v 2.6M',
        '-filter:v fps=25',
        `${await downloadDir()}test.mp4`,
      ]
    });

    // it doesn't work
    await invoke('command_ffmpeg', {
      args: [
        `-y -i ${options.url} -c:v h264_nvenc -b:v 2.6M -filter:v fps=25 ${await downloadDir()}test.mp4`,
      ]
    });

in JS i tried all of this options with Command.sidecar(), but none of them work.

amrbashir commented 2 years ago

you didn't configure the allowed args in your sidecar scope. check https://tauri.app/v1/api/config#shellallowedcommand.args