@@ -18,16 +18,16 @@ public class VideoSynthesisUsage {
1818 */
1919 public static void basicCall () throws ApiException , NoApiKeyException , InputRequiredException {
2020 VideoSynthesis vs = new VideoSynthesis ();
21- List <String > referenceVideoUrls = new ArrayList <>();
22- referenceVideoUrls .add ("https://cdn.wanx.aliyuncs.com/wanx/1014827220770308/upload-video-cut/cda0f4dc063ec258184263691558af36.mp4" );
21+ List <String > referenceUrls = new ArrayList <>();
22+ referenceUrls .add ("https://cdn.wanx.aliyuncs.com/wanx/1014827220770308/upload-video-cut/cda0f4dc063ec258184263691558af36.mp4" );
2323
2424 List <String > referenceVideoDescription = new ArrayList <>();
2525 referenceVideoDescription .add ("这段视频展示一位年轻女性(<cast>)身着灰色长袖上衣与裤子,乌黑长发垂落,面容清秀。她先低头后抬头,目光侧移,继而转身背对再面向镜头,动作流畅自然。背景为素净灰色墙面,环境简约无装饰。镜头由面部特写缓缓拉远至全身,光影柔和,突出人物形态与情绪。" );
2626 VideoSynthesisParam param =
2727 VideoSynthesisParam .builder ()
2828 .model ("wan2.6-r2v" )
2929 .prompt (" character1 站在海边,吹着海风,夕阳西下,阳光洒在她的脸上" )
30- .referenceVideoUrls ( referenceVideoUrls )
30+ .referenceUrls ( referenceUrls )
3131 .referenceVideoDescription (referenceVideoDescription )
3232 .shotType (VideoSynthesis .ShotType .MULTI )
3333 .watermark (Boolean .TRUE )
@@ -39,6 +39,83 @@ public static void basicCall() throws ApiException, NoApiKeyException, InputRequ
3939 VideoSynthesisResult result = vs .call (param );
4040 System .out .println (result );
4141 }
42+ /**
43+ * Create a video compositing task and wait for the task to complete.
44+ */
45+ public static void basicCallI2V27 () throws ApiException , NoApiKeyException , InputRequiredException {
46+ VideoSynthesis vs = new VideoSynthesis ();
47+ final String prompt = "一幅都市奇幻艺术的场景。一个充满动感的涂鸦艺术角色。一个由喷漆所画成的少年,正从一面混凝土墙上活过来。他一边用极快的语速演唱一首英文rap,一边摆着一个经典的、充满活力的说唱歌手姿势。场景设定在夜晚一个充满都市感的铁路桥下。灯光来自一盏孤零零的街灯,营造出电影般的氛围,充满高能量和惊人的细节。视频的音频部分完全由他的rap构成,没有其他对话或杂音。" ;
48+ final String negativePrompt = "ugly, bad anatomy" ;
49+ List <VideoSynthesisParam .Media > media = new ArrayList <VideoSynthesisParam .Media >(){{
50+ add (VideoSynthesisParam .Media .builder ()
51+ .url ("https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/wpimhv/rap.png" )
52+ .type (VideoSynthesis .MediaType .FIRST_CLIP )
53+ .build ());
54+ add (VideoSynthesisParam .Media .builder ()
55+ .url ("https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/ozwpvi/rap.mp3" )
56+ .type (VideoSynthesis .MediaType .DRIVING_AUDIO )
57+ .build ());
58+ }};
59+ VideoSynthesisParam param =
60+ VideoSynthesisParam .builder ()
61+ .model ("wan2.7-i2v" )
62+ .prompt (prompt )
63+ .media (media )
64+ .watermark (Boolean .TRUE )
65+ .duration (10 )
66+ .negativePrompt (negativePrompt )
67+ .size ("1280*720" )
68+ .build ();
69+ VideoSynthesisResult result = vs .call (param );
70+ System .out .println (result );
71+ }
72+ /**
73+ * Create a video compositing task and wait for the task to complete.
74+ */
75+ public static void basicCallR2V27 () throws ApiException , NoApiKeyException , InputRequiredException {
76+ VideoSynthesis vs = new VideoSynthesis ();
77+ final String prompt = "一幅都市奇幻艺术的场景。一个充满动感的涂鸦艺术角色。一个由喷漆所画成的少年,正从一面混凝土墙上活过来。他一边用极快的语速演唱一首英文rap,一边摆着一个经典的、充满活力的说唱歌手姿势。场景设定在夜晚一个充满都市感的铁路桥下。灯光来自一盏孤零零的街灯,营造出电影般的氛围,充满高能量和惊人的细节。视频的音频部分完全由他的rap构成,没有其他对话或杂音。" ;
78+ final String negativePrompt = "ugly, bad anatomy" ;
79+ List <VideoSynthesisParam .Media > media = new ArrayList <VideoSynthesisParam .Media >(){{
80+ add (VideoSynthesisParam .Media .builder ()
81+ .url ("https://test-data-center.oss-accelerate.aliyuncs.com/wanx/image/res240_269.jpg" )
82+ .type (VideoSynthesis .MediaType .REFERENCE_IMAGE )
83+ .build ());
84+ add (VideoSynthesisParam .Media .builder ()
85+ .url ("https://test-data-center.oss-accelerate.aliyuncs.com/wanx/image/man_5K_7_7K_18_4M.JPG" )
86+ .referenceVoice ("https://test-data-center.oss-accelerate.aliyuncs.com/wanx/audio/2s.wav" )
87+ .type (VideoSynthesis .MediaType .REFERENCE_IMAGE )
88+ .build ());
89+ add (VideoSynthesisParam .Media .builder ()
90+ .url ("https://test-data-center.oss-accelerate.aliyuncs.com/wanx/video/resources/cast/100M.mov" )
91+ .referenceVoice ("https://test-data-center.oss-accelerate.aliyuncs.com/wanx/audio/mp3_1s.mp3" )
92+ .type (VideoSynthesis .MediaType .REFERENCE_VIDEO )
93+ .build ());
94+ add (VideoSynthesisParam .Media .builder ()
95+ .url ("https://test-data-center.oss-accelerate.aliyuncs.com/wanx/video/resources/cast/29_99s.mp4" )
96+ .referenceDescription ("这是一个身穿蓝衣的男子<cast>,他有着浓密的络腮胡" )
97+ .type (VideoSynthesis .MediaType .REFERENCE_VIDEO )
98+ .build ());
99+ add (VideoSynthesisParam .Media .builder ()
100+ .url ("https://test-data-center.oss-accelerate.aliyuncs.com/wanx/video/resources/cast/cat_127.mp4" )
101+ .referenceVoice ("https://test-data-center.oss-accelerate.aliyuncs.com/wanx/audio/wav_10s.wav" )
102+ .referenceDescription ("这是一只毛绒小猫<cast>,它正在对着镜头微笑" )
103+ .type (VideoSynthesis .MediaType .REFERENCE_VIDEO )
104+ .build ());
105+ }};
106+ VideoSynthesisParam param =
107+ VideoSynthesisParam .builder ()
108+ .model ("wan2.7-r2v" )
109+ .prompt (prompt )
110+ .media (media )
111+ .watermark (Boolean .TRUE )
112+ .duration (10 )
113+ .negativePrompt (negativePrompt )
114+ .size ("1280*720" )
115+ .build ();
116+ VideoSynthesisResult result = vs .call (param );
117+ System .out .println (result );
118+ }
42119
43120 /**
44121 * List all tasks.
@@ -63,7 +140,9 @@ public static void fetchTask(String taskId) throws ApiException, NoApiKeyExcepti
63140
64141 public static void main (String [] args ) {
65142 try {
66- basicCall ();
143+ // basicCall();
144+ // basicCallI2V27();
145+ basicCallR2V27 ();
67146 // listTask();
68147 // fetchTask("b451725d-c48f-4f08-9d26-xxx-xxx");
69148 } catch (ApiException | NoApiKeyException | InputRequiredException e ) {
0 commit comments