-
Notifications
You must be signed in to change notification settings - Fork 639
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
MediaConvert CreateJobTemplate error for Baseline profiles #1582
Comments
Hi, is this still persisting with the latest version of SDK? |
This issue has not received a response in 1 week. If you want to keep this issue open, please just leave a comment below and auto-close will be canceled. |
@vudh1 yes, it is still present |
Hi @tigrato , Sorry for the really long wait time. This issue took time to investigate. The problem is that the default value 0, is being ignored even though you are trying to set it explicitly. In your case In the meantime, you can check out my workaround code. In short, what the code does is:
func main() {
customResolver := aws.EndpointResolverWithOptionsFunc(func(service, region string, options ...interface{}) (aws.Endpoint, error) {
if service == mediaconvert.ServiceID && region == "us-east-1" {
return aws.Endpoint{
PartitionID: "aws",
URL: "https://q25wbt2lc.mediaconvert.us-east-1.amazonaws.com",
SigningRegion: "us-east-1",
}, nil
}
return aws.Endpoint{}, &aws.EndpointNotFoundError{}
})
myMiddleware := middleware.SerializeMiddlewareFunc("MyTestMiddleware",
func(ctx context.Context, input middleware.SerializeInput, next middleware.SerializeHandler,
) (
output middleware.SerializeOutput, metadata middleware.Metadata, err error,
) {
req, ok := input.Request.(*smithyhttp.Request)
if !ok {
return output, metadata, fmt.Errorf("unexpected transport: %T", input.Request)
}
// get the body from the request
bodyStream := req.GetStream()
buf := new(strings.Builder)
_, err = io.Copy(buf, bodyStream)
actualBodyString := buf.String()
// the location after which we want to insert the parameter.
substring := `h264Settings":{`
index := strings.Index(actualBodyString, substring)
// re-constructing the body
newBodyString := actualBodyString[:index+len(substring)] + `"NumberBFramesBetweenReferenceFrames":0,` + actualBodyString[len(substring)+index:]
newStream := strings.NewReader(newBodyString)
// matching the content length
req.ContentLength = int64(len(newBodyString))
input.Request = req
// overriding the body
input.Request, err = req.SetStream(newStream)
if err != nil {
panic(err)
}
return next.HandleSerialize(ctx, input)
})
cfg, err := config.LoadDefaultConfig(context.TODO(), config.WithEndpointResolverWithOptions(customResolver), config.WithClientLogMode(aws.LogRequestWithBody|aws.LogResponseWithBody))
if err != nil {
log.Fatalf("unable to load SDK config, %v", err)
}
client := mediaconvert.NewFromConfig(cfg, func(options *mediaconvert.Options) {
options.APIOptions = append(options.APIOptions, func(stack *middleware.Stack) error {
return stack.Serialize.Add(myMiddleware, middleware.After)
})
})
// this is a fake template, your input fields might look different
out, err := client.CreateJobTemplate(context.Background(), &mediaconvert.CreateJobTemplateInput{
Name: aws.String("1582_template"),
Settings: &types.JobTemplateSettings{
OutputGroups: []types.OutputGroup{
{
OutputGroupSettings: &types.OutputGroupSettings{
Type: "CMAF_GROUP_SETTINGS",
CmafGroupSettings: &types.CmafGroupSettings{
SegmentLength: 1,
FragmentLength: 1,
},
},
Outputs: []types.Output{
{
ContainerSettings: &types.ContainerSettings{
Container: "CMFC",
},
VideoDescription: &types.VideoDescription{
CodecSettings: &types.VideoCodecSettings{
Codec: types.VideoCodecH264,
H264Settings: &types.H264Settings{
AdaptiveQuantization: "HIGH",
Bitrate: 1768615,
CodecLevel: "LEVEL_3_1",
CodecProfile: "BASELINE",
DynamicSubGop: "STATIC",
EntropyEncoding: "CAVLC",
FieldEncoding: "PAFF",
FlickerAdaptiveQuantization: "DISABLED",
FramerateControl: "SPECIFIED",
FramerateConversionAlgorithm: "DUPLICATE_DROP",
FramerateDenominator: 1,
FramerateNumerator: 25,
GopBReference: "DISABLED",
GopClosedCadence: 1,
GopSize: 50.0,
GopSizeUnits: "FRAMES",
HrdBufferInitialFillPercentage: 0,
HrdBufferSize: 0,
InterlaceMode: "PROGRESSIVE",
MaxBitrate: 0,
MinIInterval: 0,
NumberBFramesBetweenReferenceFrames: 0,
NumberReferenceFrames: 2,
ParControl: "SPECIFIED",
ParDenominator: 1,
ParNumerator: 1,
QualityTuningLevel: "SINGLE_PASS",
QvbrSettings: nil,
RateControlMode: "CBR",
RepeatPps: "DISABLED",
ScanTypeConversionMode: "",
SceneChangeDetect: "ENABLED",
Slices: 1,
SlowPal: "DISABLED",
Softness: 0,
SpatialAdaptiveQuantization: "ENABLED",
Syntax: "DEFAULT",
Telecine: "NONE",
TemporalAdaptiveQuantization: "ENABLED",
UnregisteredSeiTimecode: "DISABLED",
},
},
},
},
},
},
},
},
})
if err != nil {
panic(err)
}
} Let me know if this helps at all. Thanks again for your patience, |
Hey, @RanVaknin thanks for the response. |
Hi @tigrato , We are tracking this in a separate ticket aws/aws-sdk#577 Closing this in favor of tracking it there. |
|
Documentation
Describe the bug
When creating a simple encoding template job for H264 video output with Baseline profile the number
NumberBFramesBetweenReferenceFrames
has to be sent as0
(Baseline does not support Bframes between reference frames).The field
NumberBFramesBetweenReferenceFrames: int32
is only serialized if the provided value is not zero so it is never sent hereExpected behavior
The system allow me to create the JobTemplate without errors
Current behavior
MediaConvert API returns an error mentioning that NumberBFramesBetweenReferenceFrames must be <=0 OR that the Profile must be changed to something different than Baseline (If I sent the NumberBFramesBetweenReferenceFrames <0 the media convert api returns other error)
Steps to Reproduce
Create via GO API a template with the Following H264 config
Possible Solution
Mark NumberBFramesBetweenReferenceFrames to be serialized if the Baseline profile is selected even if it is zero or change the media convert behaviour to set it as 0 if baseline profile is found.
AWS Go SDK version used
v1.16
Compiler and Version used
1.17
Operating System and version
MacOS 11.6
The text was updated successfully, but these errors were encountered: