quasarstream / PHP-FFmpeg-video-streaming

📼 Package media content for online streaming(DASH and HLS) using FFmpeg
https://www.quasarstream.com/op/php/ffmpeg-streaming?u=php-ff
MIT License
514 stars 117 forks source link

Please add Stream To File for hardware conversion #99

Closed adis0308 closed 3 years ago

adis0308 commented 3 years ago

Describe the bug I want to add a hardware conversion to convert hls / mpd to mp4. I want to use the h264_nvenc video codec for an NVIDIA GPU. Here is the php code that I use. $ff = \Streaming\FFMpeg::create($config, $log); $video = $ff->open('https://bitmovin-a.akamaihd.net/content/MI20192708/master.m3u8'); $format = new \Streaming\Format\x264('h264_nvenc'); $format->setInitialParameters(array('-vsync', 0, '-hwaccel', 'cuda')); $convert = $video->stream2file()->setFormat($format)->save('test.mp4');

I got the following FFMpeg running command. ffmpeg.exe -y -i "https://bitmovin-a.akamaihd.net/content/MI20192708/master.m3u8" -c:v libx264 -c:a aac -bf 1 -keyint_min 25 -g 250 -sc_threshold 40 -threads 6 test.mp4

Expected behavior The FFMpeg running command I expected. ffmpeg.exe -vsync 0 -hwaccel cuda -y -i "https://bitmovin-a.akamaihd.net/content/MI20192708/master.m3u8" -c:v h264_nvenc -c:a aac -bf 1 -keyint_min 25 -g 250 -sc_threshold 40 -threads 6 test.mp4

Desktop/Server (please complete the following information):