0

I can't send hls video. aws-sdk-php mp4 video working well but hls videos only send .m3u8 file all .ts file come in local storage

Here my actual code. Submit-ffmpeg.php:

  $ffmpeg_b = $pt->config->ffmpeg_binary_file;
  $filepath = explode('.', $_POST['video-location'])[0];
  $time     = time();
  $full_dir = str_replace('ajax', '/', __DIR__);

 $structure = $filepath;

 if (!mkdir($structure, 0777, true)) {
   die('Failed to create folders...');
 }
 $hls_link = $structure . "/_360p_converted.m3u8";

 $video_file_full_path = $full_dir . $_POST['videolocation'];
 $shell                = shell_exec("$ffmpeg_b -y -i $video_file_full_path -vcodec copy -acodec copy -start_number 0 -hls_time 10 -hls_list_size 0 -f hls $hls_link 2>&1");
 $upload_s3            = PT_UploadToS3($filepath . "/_360p_converted.m3u8");
 $db->where('id', $insert);
 $db->update(T_VIDEOS, array( 
   'converted' => 1,
   '360p' => 1,
   'video_location' => $filepath . "/_360p_converted.m3u8"
 ));

function.php the sent file in aws-sdk-php

 $s3->putObject([
    'Bucket' => $pt->config->s3_bucket_name,
    'Key'    => $filename,
    'Body'   => fopen($filename, 'r+'),
    'ACL'    => 'public-read',
 ]);
halfer
  • 19,824
  • 17
  • 99
  • 186
  • @Sandwell: thanks for the edit. I tend to recommend not code-formatting code filenames, since doing so causes problems when showing multiple blocks - either something redundant has to be put in between each one, or the filename has to be repeated. It's best to add it as paragraph text. – halfer Apr 12 '18 at 15:47
  • 1
    @halfer duly noted – Sandwell Apr 12 '18 at 15:49
  • @Sandwell now my bran is off the filename mixed to type content image & video if you know about this please explane me. – Waqas Mani Apr 12 '18 at 16:13

0 Answers0