Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add filesize rendition info to Zencoder #175

Merged
merged 1 commit into from
Dec 15, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ type OutputFile struct {
VideoCodec string `json:"videoCodec"`
Height int64 `json:"height"`
Width int64 `json:"width"`
FileSize int64 `json:"fileSize"`
}

// SourceInfo contains information about media transcoded using the Transcoding
Expand Down
1 change: 1 addition & 0 deletions provider/zencoder/zencoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ func (z *zencoderProvider) getJobOutputs(job *db.Job, outputMediaFiles []*zencod
VideoCodec: mediaFile.VideoCodec,
Width: int64(mediaFile.Width),
Height: int64(mediaFile.Height),
FileSize: mediaFile.FileSizeInBytes,
}
if mediaFile.State == "finished" && mediaFile.Format == "" && strings.HasSuffix(mediaFile.Url, "m3u8") {
file.Container = "m3u8"
Expand Down
26 changes: 14 additions & 12 deletions provider/zencoder/zencoder_fake_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,22 @@ func (z *FakeZencoder) GetJobDetails(id int64) (*zencoder.JobDetails, error) {
SubmittedAt: "2016-11-05T05:02:57Z",
OutputMediaFiles: []*zencoder.MediaFile{
{
Url: "https://mybucket.s3.amazonaws.com/destination-dir/output1.mp4",
Format: "mp4",
VideoCodec: "h264",
Width: 1920,
Height: 1080,
DurationInMs: 10000,
Url: "https://mybucket.s3.amazonaws.com/destination-dir/output1.mp4",
Format: "mp4",
VideoCodec: "h264",
Width: 1920,
Height: 1080,
DurationInMs: 10000,
FileSizeInBytes: 66885256,
},
{
Url: "https://mybucket.s3.amazonaws.com/destination-dir/output2.webm",
Format: "webm",
VideoCodec: "vp8",
Width: 1080,
Height: 720,
DurationInMs: 10000,
Url: "https://mybucket.s3.amazonaws.com/destination-dir/output2.webm",
Format: "webm",
VideoCodec: "vp8",
Width: 1080,
Height: 720,
DurationInMs: 10000,
FileSizeInBytes: 92140022,
},
},
},
Expand Down
4 changes: 4 additions & 0 deletions provider/zencoder/zencoder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -893,10 +893,12 @@ func TestZencoderJobStatus(t *testing.T) {
"videoCodec": "h264",
"height": float64(1080),
"width": float64(1920),
"fileSize": float64(66885256),
},
map[string]interface{}{
"height": float64(720),
"width": float64(1080),
"fileSize": float64(92140022),
"path": "s3://mybucket/destination-dir/output2.webm",
"container": "webm",
"videoCodec": "vp8",
Expand Down Expand Up @@ -934,10 +936,12 @@ func TestZencoderJobStatus(t *testing.T) {
"videoCodec": "h264",
"height": float64(1080),
"width": float64(1920),
"fileSize": float64(66885256),
},
map[string]interface{}{
"height": float64(720),
"width": float64(1080),
"fileSize": float64(92140022),
"path": "s3://mybucket/destination-dir/output2.webm",
"container": "webm",
"videoCodec": "vp8",
Expand Down