0

I looked at the docs and i don't see support for elastic transcoding sdk for ios. My use case is to move the file "videoFile.mp4" from "bucket1" in mp4 format to transcode and create the file "videoFile.webm" again back to "bucket1".

How can i use amazon sdk(code sample) to make the rest calls to do this task?

UPDATE: I am able to get something going but i am having another issue. But i am getting this message when I am making the call to https://elastictranscoder.us-west-2.amazonaws.com/2014-06-16/jobs

<InvalidSignatureException>
  <Message>Credential should be scoped to correct service: 'elastictranscoder'. </Message>
</InvalidSignatureException>

The code below is what i have tried.

  AmazonCredentials *credentials = [[AmazonCredentials alloc] init];
    credentials.secretKey = SECRET_KEY;
    credentials.accessKey = ACCESS_KEY_ID;

    NSMutableDictionary *parameter = [NSMutableDictionary dictionaryWithObjectsAndKeys:
//                                    dateString1, @"x-amz-date",
                                      @"elastictranscoder.us-west-2.amazonaws.com:443",@"host",
                                      @"application/x-amz-json-1.0", @"content-type",
                                      length, @"content-length",
                                      nil];

    AmazonServiceRequest *request = [[AmazonServiceRequest alloc] init];
    request.urlRequest.HTTPMethod = @"POST";
    request.regionName = @"us-west-2";
    request.serviceName = @"ets";
    NSLog(@"***********************************************************************************************");
    NSLog(@"***********************************************************************************************");
    [AmazonAuthUtils signRequestV4:request headers:parameter payload:jsonStringData credentials:credentials];
    NSLog(@"***********************************************************************************************");
    NSLog(@"***********************************************************************************************");




    NSMutableURLRequest *mutableRequest = [[NSMutableURLRequest alloc]
                                    initWithURL:[NSURL
                                                 URLWithString:@"https://elastictranscoder.us-west-2.amazonaws.com"]];
    [mutableRequest setHTTPMethod:@"POST"];
    for(id key in parameter){
        [mutableRequest setValue:[parameter objectForKey:key] forHTTPHeaderField:key];
    }
    NSLog([request.urlRequest valueForHTTPHeaderField:@"x-amz-date"]);
    NSLog([request.urlRequest valueForHTTPHeaderField:@"Authorization"]);
    // add the Authorization signature and the date
    [mutableRequest setValue:[request.urlRequest valueForHTTPHeaderField:@"x-amz-date"] forHTTPHeaderField:@"x-amz-date"];
    [mutableRequest setValue:[request.urlRequest valueForHTTPHeaderField:@"Authorization"] forHTTPHeaderField:@"Authorization"];
    [mutableRequest setHTTPBody:[jsonStringData dataUsingEncoding:NSUTF8StringEncoding]];
    [[NSURLConnection alloc] initWithRequest:mutableRequest delegate:self];
varun
  • 2,014
  • 5
  • 17
  • 20

1 Answers1

1

In general, you should set up a pipeline from the AWS Management Console because it is a one-time setup. It does not make sense to create a pipeline from mobile devices. From mobile devices, you should just upload video files to your Amazon S3 bucket. A backend server (e.g. Amazon EC2 and AWS Elastic Beanstalk are both good options) should monitor the bucket and create jobs for Elastic Transcoder. AWS just announced AWS Lambda, and you may want to check it. Once the job is done, you can use Amazon SNS to get notified.

Yosuke
  • 3,759
  • 1
  • 11
  • 21