public function testBatchGenerate()
 {
     $times = ['00:00:00:01', '00:00:00:11', '00:00:00:21'];
     foreach ($times as $time) {
         $timecode = TimeCode::fromString($time);
         $this->ffmpeg->open('1.mp4')->willReturn($this->video->reveal())->shouldBeCalled();
         $this->video->frame($timecode)->willReturn($this->frame->reveal())->shouldBeCalled();
         $this->frame->save(str_replace(':', '.', '/' . $time . '.jpg'))->shouldBeCalled();
     }
     $this->videoThumbnailService->batchGenerate('1.mp4', $times, '');
 }
Beispiel #2
0
 public function testFrameShouldReturnAFrame()
 {
     $driver = $this->getFFMpegDriverMock();
     $ffprobe = $this->getFFProbeMock();
     $at = $this->getTimeCodeMock();
     $video = new Video(__FILE__, $driver, $ffprobe);
     $frame = $video->frame($at);
     $this->assertInstanceOf('FFMpeg\\Media\\Frame', $frame);
     $this->assertSame($at, $frame->getTimeCode());
     $this->assertSame(__FILE__, $frame->getPathfile());
 }
Beispiel #3
0
 /**
  * Get Picture.
  *
  * @param int $time
  *
  * @return string
  */
 public function getPicture($time = 30)
 {
     $duration = $this->video->getStreams()->first()->get('duration');
     $this->video->frame(BFFC\TimeCode::fromSeconds($duration * ($time / 100)))->save('/tmp/picture.jpg');
     return file_get_contents('/tmp/picture.jpg');
 }
Beispiel #4
0
 /**
  * @param int $frameNumber
  *
  * @return Frame
  */
 public function getFrame($frameNumber)
 {
     return $this->movie->frame(TimeCode::fromSeconds($frameNumber));
 }