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

Convert mp4 to hls with Call to a member function get() on null #78

Closed QVllasa closed 3 years ago

QVllasa commented 3 years ago

Describe the bug

I am not able to save a mp4 file as hls.

To Reproduce Steps to reproduce the behavior:

$config = [
                'ffmpeg.binaries' => '/usr/bin/ffmpeg',
                'ffprobe.binaries' => '/usr/bin/ffprobe',
                'timeout' => 0, // The timeout for the underlying process
                'ffmpeg.threads' => 1,   // The number of threads that FFmpeg should use
            ];

            $ffmpeg = FFMpeg::create($config);

            $video = $ffmpeg->open('path/to/file/mp4');

            $video->hls()
                ->x264() // Format of the video. Alternatives: x264() and vp9()
                ->autoGenerateRepresentations() // Auto generate representations
                ->save(); // It can be passed a path to the method or it can be null`

Expected behavior

.ts and .m3u8 files in the same directory

Screenshots

error

Desktop/Server (please complete the following information):

ffmpeg version 4.3.1 Copyright (c) 2000-2020 the FFmpeg developers built with gcc 9.3.0 (Alpine 9.3.0) configuration: --prefix=/usr --enable-avresample --enable-avfilter --enable-gnutls --enable-gpl --enable-libass --enable-libmp3lame --enable-libvorbis --enable-libvpx --enable-libxvid --enable-libx264 --enable-libx265 --enable-libtheora --enable-libv4l2 --enable-libdav1d --enable-postproc --enable-pic --enable-pthreads --enable-shared --enable-libxcb --enable-libssh --disable-stripping --disable-static --disable-librtmp --enable-vaapi --enable-vdpau --enable-libopus --enable-libaom --disable-debug libavutil 56. 51.100 / 56. 51.100 libavcodec 58. 91.100 / 58. 91.100 libavformat 58. 45.100 / 58. 45.100 libavdevice 58. 10.100 / 58. 10.100 libavfilter 7. 85.100 / 7. 85.100 libavresample 4. 0. 0 / 4. 0. 0 libswscale 5. 7.100 / 5. 7.100 libswresample 3. 7.100 / 3. 7.100 libpostproc 55. 7.100 / 55. 7.100 Hyper fast Audio and Video encoder usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

reidcarver commented 3 years ago

getting same error after this update.

reidcarver commented 3 years ago

This error is limited to some videos, I don't know exactly why.

QVllasa commented 3 years ago

This is good to know! Will try it out with some more videos. I already tried with video only files in various formats with no success. What format are you using? Breaking down the error it looks like it has to do something with the audio bitrate. Also worth noting: dash works perfectly...

QVllasa commented 3 years ago

It works in version 1.2.7

aminyazdanpanah commented 3 years ago

Thank you for the report. I have just fixed the bug and now you can update the package:

composer update aminyazdanpanah/php-ffmpeg-video-streaming