diff --git a/lbry/file_analysis.py b/lbry/file_analysis.py index 7e083991c..21dd8df61 100644 --- a/lbry/file_analysis.py +++ b/lbry/file_analysis.py @@ -8,6 +8,7 @@ import re import shlex import shutil import subprocess +from math import ceil import lbry.utils from lbry.conf import TranscodeConfig @@ -354,7 +355,7 @@ class VideoFileAnalyzer: def _build_spec(scan_data): assert scan_data - duration = float(scan_data["format"]["duration"]) # existence verified when scan_data made + duration = ceil(float(scan_data["format"]["duration"])) # existence verified when scan_data made width = -1 height = -1 for stream in scan_data["streams"]: @@ -363,7 +364,7 @@ class VideoFileAnalyzer: width = max(width, int(stream["width"])) height = max(height, int(stream["height"])) - log.debug(" Detected duration: %f sec. with resolution: %d x %d", duration, width, height) + log.debug(" Detected duration: %d sec. with resolution: %d x %d", duration, width, height) spec = {"duration": duration} if height >= 0: diff --git a/tests/integration/other/test_transcoding.py b/tests/integration/other/test_transcoding.py index 9bf654825..673e39a0c 100644 --- a/tests/integration/other/test_transcoding.py +++ b/tests/integration/other/test_transcoding.py @@ -60,7 +60,7 @@ class TranscodeValidation(ClaimTestCase): self.assertEqual(self.video_file_webm, new_file_name) self.assertEqual(spec["width"], 1280) self.assertEqual(spec["height"], 720) - self.assertEqual(spec["duration"], 15.054) + self.assertEqual(spec["duration"], 16) async def test_volume(self): self.conf.volume_analysis_time = 200