百度智能云

All Product Document

          Multimedia Cloud Processing

          Job

          Job is the most basic execution unit in audio and video transcoding. Each job transcodes an original audio and video resource into a target audio and video resource. Therefore, there is a one-to-one correspondence between jobs and transcoding goals, that is, if the user needs to convert an original video specification into three target specifications, such as transcoding from AVI format to FLV/MP4/HLS format, then the user needs to create three jobs.

          Parameter meanings and value methods of the job interface see Job Transcoding API.

          Create Job

          When creating the job, the user needs to assign the affiliated pipeline, the applied Preset, the BOS Key of the original AV resources and the BOS Key of the target AV resources.

          The following code creates a Job and gets the created job Id:

          pipeline_name = "your_pipeline"
          source = {'sourceKey': 'your_source_key'} 
          target = {'targetKey': 'your_target_key', 'presetName': 'your_preset'}        
          response = client.create_job(pipeline_name, source, target) 
          print response 

          Conditionally Filter Job

          After creating the job, you can conduct conditional screening for thumbnail job and transcoding job through the following four parameters, and the parameters can coordinate with each other:

          • pipelineName: Pipeline name
          • job_status: Transcoding status
          • begin: createTime upper limit, used for filtering the Jobs with the creation time at or later than begin.
          • end: createTime lower limit, used for filtering the Jobs with the creation time at or later than begin.

          The following example code is used for filtering all the Jobs under the assigned pipeline:

          pipeline_name = "your_pipeline"
          response = client.list_jobs(pipeline_name) 
          for job in response.jobs: 
            print job 

          The following example code is used for filter all the Jobs with the status of “RUNNING” under the assigned pipeline:

          pipeline_name = "your_pipeline"
          response = client.list_jobs(pipeline_name, job_status='RUNNING') 
          for job in response.jobs: 
            print job 

          The following example code is used for filtering all the Jobs created after 14:30:00 on March 31 2016 under the assigned pipeline:

          pipeline_name = "your_pipeline"
          response = client.list_jobs(pipeline_name, begin='2016-03-31T14:30:00Z') 
          for job in response.jobs: 
            print job 

          The following example code is used for selecting all the Jobs created between 14:30:00-15:00:00 March 31 in 2016 in the assigned pipeline:

          pipeline_name = "your_pipeline"
          response = client.list_jobs(pipeline_name, begin='2016-03-31T14:30:00Z', end='2016-03-31T15:00:00Z') 
          for job in response.jobs: 
            print job 

          Query the Assigned Job Information

          The user can read a certain Job through the following code:

          job_id = "your_job"
          response = client.get_job(job_id) 
          print response
          Previous
          Pipeline
          Next
          Preset