0

Hey guys i am newbie to node and ffmpeg,

Right now i am working on getting different resolution of video with ffmpeg. Its working fine i am getting new converted video. But my question is after original file get converted, new files are getting store in same folder where original file exists.

Can some please please let me know how to not to store converted files into the server? Or its will automatically store video to the folder?

Please help, any help will be appreciated. Thanks in advance

Below is my code

    const outOptions: any = VIDEO_OPTIONS.OUTPUT.FFMPEG_OPTIONS[format];
    const outPath = pathJoin(dirname(url), `${getFileName(url)}_${outOptions.height}p_${outOptions.bitRate}_${outOptions.fps}fps${VIDEO_OPTIONS.OUTPUT.EXTENSION}`);
    await runFfmpeg(['-i', pathJoin(__dirname, '..', url),
        '-vf', 'scale=-2:' + outOptions.height, '-c:v', 'h264',
        '-profile:v', 'baseline', '-r', outOptions.fps, '-g', outOptions.fps * 2,
        '-b:v', outOptions.bitRate, '-f', VIDEO_OPTIONS.OUTPUT.FORMAT, pathJoin(__dirname, '..', outPath), '-y']);
    return outPath;
}

This is where ffmpeg command fires
  let ffmpeg = spawn(ffmpeg, ffmpegOptions);
Rutu
  • 1
  • ... where do you want to store them? It you are not saving the files, why do you bother to convert them? – gbalduzzi Aug 20 '20 at 13:25
  • I wanted to store files in S3 bucket, right now which is getting store in server only – Rutu Aug 20 '20 at 13:27
  • Can you please let me know? would it automatically create a converted file where actuall file is stored? @gbalduzzi – Rutu Aug 20 '20 at 13:28
  • Then you need to move the files to s3 and then delete them from your server. FFMPEG needs to save the converted output somewhere – gbalduzzi Aug 20 '20 at 13:30
  • Okay, Thanks a lot – Rutu Aug 20 '20 at 13:31
  • @gbalduzzi, Sorry but i still have doubt, if i dont give any path for storing ouput does it automatically store where original file is store? cause right now i didn't give any output path but its still storing the converted videos where original file is stored. Please help me to solve my confusion – Rutu Aug 20 '20 at 13:37
  • Yes, you need to provide an output path – gbalduzzi Aug 20 '20 at 13:38
  • Can i give path to store output to S3 bucket directly? or it isn't possible? @gbalduzzi – Rutu Aug 20 '20 at 13:39
  • 1
    You can store directly to s3, but it's not straightforward: https://stackoverflow.com/questions/31530772/local-ffmpeg-output-to-s3-bucket . much easier to output locally, move to s3 and delete – gbalduzzi Aug 20 '20 at 13:56

0 Answers0