livepeer / verification-classifier

Metrics-based Verification Classifier
MIT License
8 stars 7 forks source link

Unable to handle fractional FPS in renditions #120

Closed yondonfu closed 4 years ago

yondonfu commented 4 years ago

Background

go-livepeer currently supports fractional FPS in renditions (required for interoperability with certain applications). For example, the FPS for a rendition could be set to 29.97002997002997 by setting the numerator of the FPS to 30000 and the denominator of the FPS to 101.

The pre-verify FPS check currently fails resulting in the frame_rate field of the API response to be false when the rendition FPS is 29.97002997002997. I suspect this is because the FPS fetched for a video is currently converted into an int here. As a result, 29.97002997002997 would be truncated to 29 and 29 / 29.97002997002997 = .967633333 which would fail the pre-verify FPS check.

Desired Solution

We could convert the value to a float to be compared against the frame_rate field of a rendition which is already converted to a float.

Alternatives

The API request could allow a numerator or denominator to be passed in for the FPS. Since we're already accepting float values for the FPS in the API request, it may be easier to stick with that for now.

yondonfu commented 4 years ago

Closed by #121