diff --git a/transcode/manifest.go b/transcode/manifest.go index e0318ee90..1061d3420 100644 --- a/transcode/manifest.go +++ b/transcode/manifest.go @@ -64,7 +64,7 @@ func GetSourceSegmentURLs(sourceManifestURL string, manifest m3u8.MediaPlaylist) urls, SourceSegment{ URL: u, - DurationMillis: int64(segment.Duration), + DurationMillis: int64(segment.Duration * 1000), }, ) } diff --git a/transcode/transcode.go b/transcode/transcode.go index 3c89b9af6..e612bb1de 100644 --- a/transcode/transcode.go +++ b/transcode/transcode.go @@ -231,7 +231,7 @@ func transcodeSegment(segment segmentInfo, streamName, manifestID string, transc } for _, stats := range transcodedStats { - stats.BitsPerSecond = uint32(float64(stats.Bytes) * 8000.0 / float64(stats.DurationMs)) + stats.BitsPerSecond = uint32(float64(stats.Bytes) * 8000.0 / float64(stats.DurationMs/1000)) } return nil diff --git a/transcode/transcode_test.go b/transcode/transcode_test.go index 76b2b1328..02177c8aa 100644 --- a/transcode/transcode_test.go +++ b/transcode/transcode_test.go @@ -127,9 +127,9 @@ func TestItCanTranscode(t *testing.T) { // Confirm the master manifest was created and that it looks like a manifest var expectedMasterManifest = `#EXTM3U #EXT-X-VERSION:3 -#EXT-X-STREAM-INF:PROGRAM-ID=0,BANDWIDTH=28800,RESOLUTION=2020x2020,NAME="0-2020p0" +#EXT-X-STREAM-INF:PROGRAM-ID=0,BANDWIDTH=27428,RESOLUTION=2020x2020,NAME="0-2020p0" 2020p0/index.m3u8 -#EXT-X-STREAM-INF:PROGRAM-ID=0,BANDWIDTH=19200,RESOLUTION=2020x2020,NAME="1-low-bitrate" +#EXT-X-STREAM-INF:PROGRAM-ID=0,BANDWIDTH=18285,RESOLUTION=2020x2020,NAME="1-low-bitrate" low-bitrate/index.m3u8 `