Skip to content

[feat] Way to get "raw" data from a sidecar #4673

@Xoffio

Description

@Xoffio

Describe the problem

Hi guys,

When using Sidecar to bundle and execute an external program that returns non UFT-8 characters it's impossible to get the "raw" data. For example:

Let's say I want to bundle FFmpeg into my Tauri app. I guess the only way for me to execute it is using Sidecar. The code is looking something like this:

let cmd_output = tauri::api::process::Command::new_sidecar("./ffmpeg").unwrap()
        .args([
            "-i",
            &img_full_path,
            "-vf",
            &format!("select=eq(n\\,{})", frame_number),
            "-f",
            "rawvideo",
            "-pix_fmt",
            "rgba",
            "-vframes",
            "1",
            "-",
        ])
        .output(){
            Ok(out) => out,
            Err(err) => return Err( (StatusCode::INTERNAL_SERVER_ERROR, format!("Error executing FFmpeg. \n{:?}", err)) )
        };

The FFmpeg command should return some information through the stderr and it should return the "raw data"/pixels of the image through the stdout

The problem is that Tauri tries to transform all the output and sometimes we just need the raw data. Here is where it happens:

let line = String::from_utf8(buf.clone());

I had this working with my own code std::process::Command before using Sidecar.

Describe the solution you'd like

Maybe we can have a function where we don't transform the data. Or a way to call std::process::Command with the relative path of the bundled executables.

Alternatives considered

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions