TestsController.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: qiuzijian
  5. * Date: 2021-05-18
  6. * Time: 15:09
  7. */
  8. namespace App\Http\Controllers;
  9. use Illuminate\Support\Facades\Config;
  10. use Illuminate\Support\Facades\Input;
  11. use Illuminate\Support\Facades\Log;
  12. use Illuminate\Support\Facades\Redis;
  13. use Modules\Camera\Http\Controllers\Api\HaiKangController;
  14. use Modules\Camera\Jobs\CameraDownload;
  15. use Modules\Mine\Entities\MineListExt;
  16. use Modules\Mine\Services\MineServices;
  17. class TestsController {
  18. public function test()
  19. {
  20. $hk_result = MineServices::getHaiKangArea(5, 'local');
  21. dd($hk_result);
  22. Input::replace(
  23. [
  24. 'url' => 'https://10.71.252.64:4433',
  25. 'key' => '25720460',
  26. 'secret' => 'qqP7NLcIDwO9MgtYmp8L',
  27. 'cameraIndexCode' => 'a73931afd8bd4d1aba883699d65793d2',
  28. 'protocol' => 'rtmp',
  29. ]
  30. );
  31. $haikang = new HaiKangController();
  32. $result_hk = $haikang->getCamerasUrl();
  33. $arr = explode('/', $result_hk['data']['url']);
  34. $path = end($arr);
  35. // echo $result_hk['data']['url'];
  36. mkdir('/home/video_system/public/files/video/m3u8/' . $path, 0777, true);
  37. $exec = 'nohup /usr/bin/ffmpeg -i ' . $result_hk['data']['url'] . ' -vcodec copy -acodec copy -vbsf h264_mp4toannexb -f hls -hls_flags delete_segments -segment_list_size 10 -hls_list_size 2 /home/video_system/public/files/video/m3u8/' . $path . '/out.m3u8 >/dev/null &';
  38. echo $exec;
  39. echo '<br/>';
  40. $result = shell_exec($exec);
  41. echo '<br/>';
  42. dd(111);
  43. }
  44. }