Merge pull request #2898 from lbryio/duration_is_int
`ffmpeg` file analysis returns duration as integer now
This commit is contained in:
commit
e62678e4e6
2 changed files with 4 additions and 3 deletions
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue