tanersener / react-native-ffmpeg

FFmpeg for react-native. Not maintained anymore. Superseded by FFmpegKit.
GNU General Public License v3.0
401 stars 52 forks source link

Pipe to the input of ffmpeg #234

Closed Timber1900 closed 3 years ago

Timber1900 commented 3 years ago

Description I have a stream of a video and want to pipe it to the input of the ffmpeg process. On widows, using static ffmpeg and child process I can spawn a ffmpeg process and use the built in pipes to to pipe the stream to, but I dont know if theres something similar that can be done with this package. Using a blob as a input would also work.

Expected behavior For RUNFFmpeg tot have some sort of pipe to pipe data to.

Current behavior There doesnt appear to be any sort of feature

Screenshots Not applicable

Logs Not applicable

Environment

Other Example windows code

const ffmpegProcess = spawn(
    ffmpeg,
    [
      '-loglevel',
      '8',
      '-hide_banner',
      '-i',
      'pipe:4',
      '-i',
      'pipe:5',
      '-map',
      '0:a',
      '-map',
      '1:v',
      '-c:v',
      'copy',
      '-y',
      clips.length
        ? join(OS.homedir(), 'AppData', 'Roaming', '.webdl', `tempvideo.${ext}`)
        : join(path, `${fixedTitle}.${ext}`),
    ],
    {
      windowsHide: true,
      stdio: ['inherit', 'inherit', 'inherit', 'pipe', 'pipe', 'pipe'],
    },
  );
  // @ts-expect-error
  audio.pipe(ffmpegProcess.stdio[4]);
  // @ts-expect-error
  video.pipe(ffmpegProcess.stdio[5]);
tanersener commented 3 years ago

See the Pipe Support page written for MobileFFmpeg. You can do the same things in react-native-ffmpeg.

Timber1900 commented 3 years ago

I can create the pipe this way but cant seem to find a way to push data to it, on my windows app I used the fetch api to get the video data as a stream and used the Stream.pipe() method, however when I attempt to do the same in react native there seems to be no stream included in it, (it says that there is no body attribute of type Response). Using axios I can get the data as a blob, however the Blob.asStream() method also doesnt exist, and I cant seem to find any other way to pipe this data to the created pipe.

Thanks for the help.

github-actions[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.