diff --git a/CHANGELOG.md b/CHANGELOG.md index 49f7bf9..b1fd5c4 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ All Notable changes to `pbmedia/laravel-ffmpeg` will be documented in this file +## 8.1.1 - 2022-05-13 + +- Bugfix for parsing the average frame rate. + ## 8.1.0 - 2022-05-12 - You may now specify a separate temporary disk for processing HLS exports. diff --git a/src/Support/StreamParser.php b/src/Support/StreamParser.php index e30ab5c..69dcb0b 100644 --- a/src/Support/StreamParser.php +++ b/src/Support/StreamParser.php @@ -21,7 +21,7 @@ public static function new(Stream $stream): StreamParser public function getFrameRate(): ?string { - $frameRate = trim(Str::before(optional($this->stream)->get('avg_frame_rate'), "/1")); + $frameRate = trim(optional($this->stream)->get('avg_frame_rate')); if (!$frameRate || Str::endsWith($frameRate, '/0')) { return null; diff --git a/tests/StreamParserTest.php b/tests/StreamParserTest.php new file mode 100644 index 0000000..5d65903 --- /dev/null +++ b/tests/StreamParserTest.php @@ -0,0 +1,18 @@ +assertEquals(25, StreamParser::new(new Stream(['avg_frame_rate' => 25]))->getFrameRate()); + $this->assertEquals(25, StreamParser::new(new Stream(['avg_frame_rate' => '25/1']))->getFrameRate()); + $this->assertEquals(25, StreamParser::new(new Stream(['avg_frame_rate' => '250/10']))->getFrameRate()); + $this->assertEquals(25, StreamParser::new(new Stream(['avg_frame_rate' => '50/2']))->getFrameRate()); + } +}