How to crop audio file in laravel using ffmpeg commands?

Viewed 32

I have the audio file on my s3 bucket and I have to crop it using some seconds portion from the whole file and upload it again at the exact location.

I am trying this using the FFmpeg command and shell_exec but the FFmpeg command is not executing on local as well as on the server.

I have divided my task into chunks :

  1. How to get the input file from the s3 bucket?
  2. How to write output file on s3 bucket in FFmpeg command execution output
  3. How to check shell_exec() function output or log?

MY Code:

$input_file= Storage::disk('recording_files')->url($path);

$new_file_with_crop = "ffmpeg -i ".$input_file." -ss 00:00:00 -to 00:00:15 -async 1 ".Storage::disk('recording_files')->put($path.'/test_audio.mp3',$input_file->getRealPath())." -y";

$new_file_with_crop_output = shell_exec($new_file_with_crop);
0 Answers
Related