Skip to content
This repository was archived by the owner on Apr 21, 2020. It is now read-only.

initial checkin, and initial guess as to what this should be #156

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
34 changes: 32 additions & 2 deletions provider/mediaconvert/h264.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,36 @@ func h264CodecSettingsFrom(preset db.Preset) (*mediaconvert.VideoCodecSettings,
tuning = mediaconvert.H264QualityTuningLevelMultiPassHq
}

if rateControl == mediaconvert.H264RateControlModeQvbr {
var qvbrLevel int64 = 9
height, err := strconv.Atoi(preset.Video.Height)
if err == nil {
if height <= 720 {
qvbrLevel = 8
}
if height <= 540 {
qvbrLevel = 7
}
}
return &mediaconvert.VideoCodecSettings{
Codec: mediaconvert.VideoCodecH264,
H264Settings: &mediaconvert.H264Settings{
// MaxBitrate: aws.Int64(bitrate),
GopSize: aws.Float64(gopSize),
GopSizeUnits: gopUnit,
RateControlMode: rateControl,
QvbrSettings: &mediaconvert.H264QvbrSettings{
MaxAverageBitrate: aws.Int64(bitrate),
QvbrQualityLevel: aws.Int64(qvbrLevel),
},
CodecProfile: profile,
CodecLevel: mediaconvert.H264CodecLevelAuto,
InterlaceMode: mediaconvert.H264InterlaceModeProgressive,
QualityTuningLevel: mediaconvert.H264QualityTuningLevelMultiPassHq,
},
}, nil
}

return &mediaconvert.VideoCodecSettings{
Codec: mediaconvert.VideoCodecH264,
H264Settings: &mediaconvert.H264Settings{
Expand Down Expand Up @@ -74,9 +104,9 @@ func h264RateControlModeFrom(rateControl string) (mediaconvert.H264RateControlMo
switch rateControl {
case "vbr":
return mediaconvert.H264RateControlModeVbr, nil
case "", "cbr":
case "cbr":
return mediaconvert.H264RateControlModeCbr, nil
case "qvbr":
case "", "qvbr":
return mediaconvert.H264RateControlModeQvbr, nil
default:
return "", fmt.Errorf("rate control mode %q is not supported with mediaconvert", rateControl)
Expand Down
4 changes: 2 additions & 2 deletions provider/mediaconvert/h265.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ func h265RateControlModeFrom(rateControl string) (mediaconvert.H265RateControlMo
switch rateControl {
case "vbr":
return mediaconvert.H265RateControlModeVbr, nil
case "", "cbr":
case "cbr":
return mediaconvert.H265RateControlModeCbr, nil
case "qvbr":
case "", "qvbr":
return mediaconvert.H265RateControlModeQvbr, nil
default:
return "", fmt.Errorf("rate control mode %q is not supported with mediaconvert", rateControl)
Expand Down