Пробуем настроить формат видео

This commit is contained in:
p.belezov 2024-06-19 11:57:08 +08:00
parent 8887ebb2e7
commit 8be7755917

View File

@ -17,7 +17,8 @@ class YoutubeDownloadController extends Controller
Options::create()
->downloadPath(env('PATH_TO_DOWNLOAD'))
->url($url)
->remuxVideo('mp4')
->formatSort(['bestvideo[ext=mp4]+bestaudio[ext=m4a]/bestvideo+bestaudio'])
->mergeOutputFormat('mp4')
);
$videotitle = '';
foreach ($collection->getVideos() as $video) {
@ -28,7 +29,7 @@ class YoutubeDownloadController extends Controller
return response(json_encode($response));
} else {
$videotitle = $video->getFile()->getFilename(); // Will return Phonebloks
$videotitle = str_replace('webm', 'mp4', $videotitle);
//$videotitle = str_replace('webm', 'mp4', $videotitle);
//$file_path = public_path('/'.'downloads/'.$videotitle);
//return response()->download($file_path);
// $video->getFile(); // \SplFileInfo instance of downloaded file