2

Looking into AWS elastic transcoder, and have a few questions:

  1. Is there significant value using the transcoder in the first place, for my use case? I'm making an ios app that allows users to select a video. When they do this I'm uploading it to an S3 bucket. As I understand it, I should use elastic transcoder to then transcode those videos and drop them in a second bucket in hls format. Does this make sense, or would I be just as well off eliminating the transcoding step since I'm only creating content on ios devices and then streaming it on ios devices?

  2. Assuming there is some value to doing the pipeline jobs, I have an implementation question: if I'm using the ios SDK is there a way to get around the manual creation of the http authorization header specified in the elastic transcoder request docs? I don't see any methods specific to the transcoder when I'm working in xcode, but I'm just wondering if there is some way to use something like AWSRequest (as opposed to NSMutableURLRequest) that would save me the trouble of making the authorization key. I looked through a whole bunch of documentation, including the ios SDK sample projects, but did not see anything like AWSRequest being used. Please help point me in the right direction!

Code: I've already built the json structure for the body of the request based on the documentation here: http://docs.aws.amazon.com/elastictranscoder/latest/developerguide/making-http-requests.html#http-request-header Here is as far as I got before I ran into the complexity of the authorization header:

println("my json: \(jsonRequestString)")

                var dateFormatter:NSDateFormatter = NSDateFormatter()
                dateFormatter.dateFormat = "yyyyMMdd'T'HHmmss'Z'"
                var dateString = dateFormatter.stringFromDate(date)
                println("dateString: \(dateString)")
                var elasticTranscoderURLString:String = "elastictranscoder.us-west-1.amazonaws.com"
                var elasticTranscoderRequest:NSMutableURLRequest = NSMutableURLRequest(URL: NSURL(string: elasticTranscoderURLString)!)
                elasticTranscoderRequest.HTTPMethod = "POST"
                elasticTranscoderRequest.addValue("elastictranscoder.us-west-1.amazonaws.com", forHTTPHeaderField: "Host")
                elasticTranscoderRequest.addValue("application/x-amz-json-1.0", forHTTPHeaderField: "Content-Type")
                elasticTranscoderRequest.addValue(dateString, forHTTPHeaderField: "x-amz-date")
                //placeholder - need to add authorization header field
                //placeholder - need to add content-length header field
                var requestData: NSData = jsonRequestString.dataUsingEncoding(NSUTF8StringEncoding)!
                elasticTranscoderRequest.HTTPBody = requestData

                var elasticTranscoderSession = NSURLSession.sharedSession()

                var elasticTranscoderTask = elasticTranscoderSession.dataTaskWithRequest(elasticTranscoderRequest, completionHandler: {(elasticTranscoderData, response, error) in

                    println("here's the error: \(error)")
                    println("here's the response: \(response)")
                    println("I'm in the completion handler of elasticTranscoderTask")

                })//end elasticTranscoderTask completion handler
                elasticTranscoderTask.resume()

Obviously I get an error when I run this.

this is the closest thing to my question, but it does not have an answer: Rest call with amazon ios sdk to amazon elastic transcoder

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
bkopp
  • 478
  • 1
  • 8
  • 20

1 Answers1

3
  1. The answer to this question is entirely up to your use case. Amazon Elastic Transcoder can be a valuable option to convert the video format and create thumbnails, visual watermarks, and captions, etc. These are just a few of many examples. You should check out Amazon Elastic Transcoder Product Details.

  2. If you decide to use the Elastic Transcoder, 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.

Anbu.Karthik
  • 82,064
  • 23
  • 174
  • 143
Yosuke
  • 3,759
  • 1
  • 11
  • 21
  • OK that makes sense.. I did not realize I could set up a pipeline that would automatically take anything I put in one bucket, transcode it per my requirements, and drop it in another bucket. How do I configure that in the console? I have created a pipeline but only done jobs manually, I did not know I could set it to automatically run on any file saved to the bucket. Also, how will my app know when a given job has been completed? I'm thinking I need to know that because only once the file has been transcoded and dropped in the second bucket can I stream it to other users. – bkopp Dec 04 '14 at 04:48
  • Sorry, my explanation didn't cover the entire story. You need to create jobs from a backend server in order to actually convert the videos. [AWS Lambda](http://aws.amazon.com/lambda/details/) is a great service that can help you do that. – Yosuke Dec 04 '14 at 20:05