Skip to content

Commit e0ec358

Browse files
Merge pull request #175 from NYTimes/zencoder-rendition-filesize
Add filesize rendition info to Zencoder
2 parents cb88914 + d863498 commit e0ec358

File tree

4 files changed

+20
-12
lines changed

4 files changed

+20
-12
lines changed

provider/provider.go

+1
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ type OutputFile struct {
9494
VideoCodec string `json:"videoCodec"`
9595
Height int64 `json:"height"`
9696
Width int64 `json:"width"`
97+
FileSize int64 `json:"fileSize"`
9798
}
9899

99100
// SourceInfo contains information about media transcoded using the Transcoding

provider/zencoder/zencoder.go

+1
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,7 @@ func (z *zencoderProvider) getJobOutputs(job *db.Job, outputMediaFiles []*zencod
329329
VideoCodec: mediaFile.VideoCodec,
330330
Width: int64(mediaFile.Width),
331331
Height: int64(mediaFile.Height),
332+
FileSize: mediaFile.FileSizeInBytes,
332333
}
333334
if mediaFile.State == "finished" && mediaFile.Format == "" && strings.HasSuffix(mediaFile.Url, "m3u8") {
334335
file.Container = "m3u8"

provider/zencoder/zencoder_fake_test.go

+14-12
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,22 @@ func (z *FakeZencoder) GetJobDetails(id int64) (*zencoder.JobDetails, error) {
3939
SubmittedAt: "2016-11-05T05:02:57Z",
4040
OutputMediaFiles: []*zencoder.MediaFile{
4141
{
42-
Url: "https://mybucket.s3.amazonaws.com/destination-dir/output1.mp4",
43-
Format: "mp4",
44-
VideoCodec: "h264",
45-
Width: 1920,
46-
Height: 1080,
47-
DurationInMs: 10000,
42+
Url: "https://mybucket.s3.amazonaws.com/destination-dir/output1.mp4",
43+
Format: "mp4",
44+
VideoCodec: "h264",
45+
Width: 1920,
46+
Height: 1080,
47+
DurationInMs: 10000,
48+
FileSizeInBytes: 66885256,
4849
},
4950
{
50-
Url: "https://mybucket.s3.amazonaws.com/destination-dir/output2.webm",
51-
Format: "webm",
52-
VideoCodec: "vp8",
53-
Width: 1080,
54-
Height: 720,
55-
DurationInMs: 10000,
51+
Url: "https://mybucket.s3.amazonaws.com/destination-dir/output2.webm",
52+
Format: "webm",
53+
VideoCodec: "vp8",
54+
Width: 1080,
55+
Height: 720,
56+
DurationInMs: 10000,
57+
FileSizeInBytes: 92140022,
5658
},
5759
},
5860
},

provider/zencoder/zencoder_test.go

+4
Original file line numberDiff line numberDiff line change
@@ -893,10 +893,12 @@ func TestZencoderJobStatus(t *testing.T) {
893893
"videoCodec": "h264",
894894
"height": float64(1080),
895895
"width": float64(1920),
896+
"fileSize": float64(66885256),
896897
},
897898
map[string]interface{}{
898899
"height": float64(720),
899900
"width": float64(1080),
901+
"fileSize": float64(92140022),
900902
"path": "s3://mybucket/destination-dir/output2.webm",
901903
"container": "webm",
902904
"videoCodec": "vp8",
@@ -934,10 +936,12 @@ func TestZencoderJobStatus(t *testing.T) {
934936
"videoCodec": "h264",
935937
"height": float64(1080),
936938
"width": float64(1920),
939+
"fileSize": float64(66885256),
937940
},
938941
map[string]interface{}{
939942
"height": float64(720),
940943
"width": float64(1080),
944+
"fileSize": float64(92140022),
941945
"path": "s3://mybucket/destination-dir/output2.webm",
942946
"container": "webm",
943947
"videoCodec": "vp8",

0 commit comments

Comments
 (0)