@@ -76,7 +76,7 @@ func DescribeJobs() {
7676// https://cloud.tencent.com/document/product/460/84765
7777func DescribeJob () {
7878 c := getClient ()
79- DescribeJobRes , _ , err := c .CI .DescribeJob (context .Background (), "j5c6b2d1e044e11ee8b23bda0f853af96 " )
79+ DescribeJobRes , _ , err := c .CI .DescribeJob (context .Background (), "ja507fb3413f711eebccc9dd62ab48c0e " )
8080 log_status (err )
8181 fmt .Printf ("%+v\n " , DescribeJobRes .JobsDetail )
8282}
@@ -120,6 +120,7 @@ func InvokeTranscodeJob() {
120120}
121121
122122// InvokeVideoEnhanceJob 提交一个画质增强任务
123+ // https://cloud.tencent.com/document/product/460/84775
123124func InvokeVideoEnhanceJob () {
124125 c := getClient ()
125126 createJobOpt := & cos.CreateJobsOptions {
@@ -180,7 +181,7 @@ func InvokeVideoEnhanceJob() {
180181 fmt .Printf ("%+v\n " , createJobRes .JobsDetail )
181182}
182183
183- // InvokeMediaInfoJob 提交一个获取媒体信息
184+ // InvokeMediaInfoJob 提交一个获取媒体信息任务
184185// https://cloud.tencent.com/document/product/460/84776
185186func InvokeMediaInfoJob () {
186187 c := getClient ()
@@ -522,6 +523,10 @@ func InvokeConcatJob() {
522523 Codec : "AAC" ,
523524 },
524525 ConcatFragment : concatFragment ,
526+ SceneChangeInfo : & cos.SceneChangeInfo {
527+ Mode : "GRADIENT" , // Default:不添加转场特效; FADE:淡入淡出; GRADIENT:渐变
528+ Time : "4.5" , // 取值范围:(0, 5], 支持小数, 默认值3
529+ },
525530 },
526531 },
527532 }
@@ -947,6 +952,99 @@ func InvokeMultiJobs() {
947952 }
948953}
949954
955+ // InvokeFillConcatJob 提交一个填充拼接任务
956+ func InvokeFillConcatJob () {
957+ c := getClient ()
958+ FillConcat := make ([]cos.FillConcatInput , 0 )
959+ FillConcat = append (FillConcat , cos.FillConcatInput {
960+ Url : "https://test-1234567890.cos.ap-chongqing.myqcloud.com/input/car.mp4" ,
961+ })
962+ FillConcat = append (FillConcat , cos.FillConcatInput {
963+ FillTime : "5.5" ,
964+ })
965+ FillConcat = append (FillConcat , cos.FillConcatInput {
966+ Url : "https://test-1234567890.cos.ap-chongqing.myqcloud.com/input/game.mp4" ,
967+ })
968+ createJobOpt := & cos.CreateJobsOptions {
969+ Tag : "FillConcat" ,
970+ Operation : & cos.MediaProcessJobOperation {
971+ FillConcat : & cos.FillConcat {
972+ Format : "mp4" ,
973+ FillInput : FillConcat ,
974+ },
975+ Output : & cos.JobOutput {
976+ Region : "ap-chongqing" ,
977+ Object : "fill_concat.mp4" ,
978+ Bucket : "test-1234567890" ,
979+ },
980+ },
981+ }
982+ createJobRes , _ , err := c .CI .CreateJob (context .Background (), createJobOpt )
983+ log_status (err )
984+ fmt .Printf ("%+v\n " , createJobRes .JobsDetail )
985+ }
986+
987+ // InvokeVideoSynthesisJob 提交一个视频合成任务
988+ func InvokeVideoSynthesisJob () {
989+ c := getClient ()
990+ SpliceInfo := make ([]cos.VideoSynthesisSpliceInfo , 0 )
991+ SpliceInfo = append (SpliceInfo , cos.VideoSynthesisSpliceInfo {
992+ Url : "https://test-1234567890.cos.ap-chongqing.myqcloud.com/input/car.mp4" ,
993+ Width : "640" ,
994+ })
995+ SpliceInfo = append (SpliceInfo , cos.VideoSynthesisSpliceInfo {
996+ Url : "https://test-1234567890.cos.ap-chongqing.myqcloud.com/input/game.mp4" ,
997+ X : "640" ,
998+ Width : "640" ,
999+ })
1000+ w := cos.Watermark {
1001+ Type : "Text" ,
1002+ LocMode : "Absolute" ,
1003+ Dx : "640" ,
1004+ Pos : "TopLeft" ,
1005+ Text : & cos.Text {
1006+ Text : "helloworld" ,
1007+ FontSize : "25" ,
1008+ FontType : "simfang.ttf" ,
1009+ FontColor : "0xff0000" ,
1010+ Transparency : "100" ,
1011+ },
1012+ }
1013+ ws := []cos.Watermark {}
1014+ ws = append (ws , w )
1015+ createJobOpt := & cos.CreateJobsOptions {
1016+ Tag : "VideoSynthesis" ,
1017+ Operation : & cos.MediaProcessJobOperation {
1018+ VideoSynthesis : & cos.VideoSynthesis {
1019+ KeepAudioTrack : "false" ,
1020+ SpliceInfo : SpliceInfo ,
1021+ },
1022+ Transcode : & cos.Transcode {
1023+ Container : & cos.Container {
1024+ Format : "mp4" ,
1025+ },
1026+ Video : & cos.Video {
1027+ Codec : "H.264" ,
1028+ Width : "1280" ,
1029+ Height : "960" ,
1030+ },
1031+ Audio : & cos.Audio {
1032+ Codec : "AAC" ,
1033+ },
1034+ },
1035+ Watermark : ws ,
1036+ Output : & cos.JobOutput {
1037+ Region : "ap-chongqing" ,
1038+ Object : "video_synthesis.mp4" ,
1039+ Bucket : "test-1234567890" ,
1040+ },
1041+ },
1042+ }
1043+ createJobRes , _ , err := c .CI .CreateJob (context .Background (), createJobOpt )
1044+ log_status (err )
1045+ fmt .Printf ("%+v\n " , createJobRes .JobsDetail )
1046+ }
1047+
9501048// JobNotifyCallback 解析任务回调
9511049func JobNotifyCallback () {
9521050 taskBody := "<Response><EventName>TaskFinish</EventName><JobsDetail><Code>Success</Code><CreationTime>2022-06-30T19:30:20+0800</CreationTime><EndTime>2022-06-30T19:31:56+0800</EndTime><Input><BucketId>test-123456789</BucketId><Object>input/demo.mp4</Object><Region>ap-chongqing</Region><CosHeaders><Key>Content-Type</Key><Value>video/mp4</Value></CosHeaders><CosHeaders><Key>x-cos-request-id</Key><Value>NjJiZDYwYTFfNjUzYTYyNjRfZjEwZl8xMmZhYzY5</Value></CosHeaders><CosHeaders><Key>EventName</Key><Value>cos:ObjectCreated:Put</Value></CosHeaders><CosHeaders><Key>Size</Key><Value>1424687</Value></CosHeaders></Input><JobId>j06668dc0f86811ecb90d0b03267ce0e5</JobId><Message/><Operation><DigitalWatermark><IgnoreError>false</IgnoreError><Message>123456789ab</Message><State>Failed</State><Type>Text</Type><Version>V1</Version></DigitalWatermark><MediaInfo><Format><Bitrate>8867.172000</Bitrate><Duration>13.654000</Duration><FormatLongName>QuickTime / MOV</FormatLongName><FormatName>mov,mp4,m4a,3gp,3g2,mj2</FormatName><NumProgram>0</NumProgram><NumStream>2</NumStream><Size>15134046</Size><StartTime>0.000000</StartTime></Format><Stream><Audio><Bitrate>128.726000</Bitrate><Channel>2</Channel><ChannelLayout>stereo</ChannelLayout><CodecLongName>AAC (Advanced Audio Coding)</CodecLongName><CodecName>aac</CodecName><CodecTag>0x6134706d</CodecTag><CodecTagString>mp4a</CodecTagString><CodecTimeBase>1/44100</CodecTimeBase><Duration>13.652993</Duration><Index>1</Index><Language>und</Language><SampleFmt>fltp</SampleFmt><SampleRate>44100</SampleRate><StartTime>0.000000</StartTime><Timebase>1/44100</Timebase></Audio><Subtitle/><Video><AvgFps>25.000000</AvgFps><Bitrate>9197.180000</Bitrate><CodecLongName>H.265 / HEVC (High Efficiency Video Coding)</CodecLongName><CodecName>hevc</CodecName><CodecTag>0x31766568</CodecTag><CodecTagString>hev1</CodecTagString><CodecTimeBase>1/12800</CodecTimeBase><ColorPrimaries>bt470bg</ColorPrimaries><ColorRange>tv</ColorRange><ColorTransfer>smpte170m</ColorTransfer><Duration>12.960000</Duration><FieldOrder>progressive</FieldOrder><Fps>25.000000</Fps><HasBFrame>2</HasBFrame><Height>1920</Height><Index>0</Index><Language>und</Language><Level>120</Level><NumFrames>324</NumFrames><PixFormat>yuv420p</PixFormat><Profile>Main</Profile><RefFrames>1</RefFrames><Rotation>0.000000</Rotation><StartTime>0.000000</StartTime><Timebase>1/12800</Timebase><Width>1088</Width></Video></Stream></MediaInfo><MediaResult><OutputFile><Bucket>test-123456789</Bucket><Md5Info><Md5>852883012a6ba726e6ed8d9b984edfdf</Md5><ObjectName>output/super_resolution.mp4</ObjectName></Md5Info><ObjectName>output/super_resolution.mp4</ObjectName><ObjectPrefix/><Region>ap-chongqing</Region></OutputFile></MediaResult><Output><Bucket>test-123456789</Bucket><Object>output/super_resolution.${ext}</Object><Region>ap-chongqing</Region></Output><TemplateId>t1f1ae1dfsdc9ds41dsb31632d45710642a</TemplateId><TemplateName>template_superresolution</TemplateName><TranscodeTemplateId>t156c107210e7243c5817354565d81b578</TranscodeTemplateId><UserData>This is my SuperResolution job.</UserData><JobLevel>0</JobLevel><WatermarkTemplateId>t143ae6e040af6431aa772c9ec3f0a3f36</WatermarkTemplateId><WatermarkTemplateId>t12a74d11687d444deba8a6cc52051ac27</WatermarkTemplateId></Operation><QueueId>p2242ab62c7c94486915508540933a2c6</QueueId><StartTime>2022-06-30T19:30:21+0800</StartTime><State>Success</State><Progress>100</Progress><SubTag>DigitalWatermark</SubTag><Tag>SuperResolution</Tag><Workflow><Name>SuperResolution_1581665960537</Name><RunId>ic90edd59f84f11ec9d4f525400a3c59f</RunId><WorkflowId>web6ac56c1ef54dbfa44d7f4103203be9</WorkflowId><WorkflowName>workflow-test</WorkflowName></Workflow></JobsDetail></Response>"
0 commit comments