Closed ffd8 closed 4 years ago
Aha! Found a way to fix it! Was wondering how I could remove that Streaming
portion of the command that was being injected (assuming it shouldn't be there) – not very familiar with how this structure works in PHP.. but added a \
infront of FFMpeg
= viola, poster frame generated!
$frame = $video->frame(\FFMpeg\Coordinate\TimeCode::fromSeconds(1));
$frame->save('poster.jpg');
Not sure if it's something to update in the docs (few times under 'Other Advanced Features') or if it's something that should be adjusted within the library to not need that \
?
Same is true for the instructions for a gif, as written gave same error as frame()
, but added 2x \
worked:
$video
->gif(\FFMpeg\Coordinate\TimeCode::fromSeconds(1), new \FFMpeg\Coordinate\Dimension(640, 480), 1)
->save('animated_image.gif');
The bug is related to some versions of PHP on Mac and Linux, In other words, PHP can not use the namespace without the backslash.
It seems like you found a solution, so I closed this issue. If you have any further questions about this issue, please post it here.
Describe the bug Attempt to save a
$video->frame()
failes while using this library. If it's not importanted and the base PHP-FFMpeg library is used, it works.To Reproduce
Expected behavior Save a single frame of the video at a given time.
Desktop/Server (please complete the following information):
Additional context When using just PHP-FFMpeg, it's no problem to grab a poster frame from the video with the following code:
Once importing and using PHP-FFmpeg-video-streaming I'm getting a 500 error for nearly the same code:
FYI, this library worked fine for exporting HLS files based on the documentation (logging as well) – it's only when trying to grab the frame from a video.
If I disable the importing of library and revert to the PHP-FFmpeg instancing of
$ffmpeg
, then it works again:Also tried using:
Edit: just added full error_reporting, and get the following error while trying to save a frame:
Fatal error: Uncaught Error: Class 'Streaming\FFMpeg\Coordinate\TimeCode' not found in...
(path to file) So the script is injectStreaming\
in front of the frame'sFFMpeg\Coordinate\TimeCode
command...Is this a bug, or am I doing something wrong above?