@@ -617,23 +617,23 @@ async function toWav(
617617
618618// An example of using Ver 3 model to make a static photo move.
619619ai . defineFlow ( 'photo-move-veo' , async ( _ , { sendChunk } ) => {
620- const startingImage = fs . readFileSync ( 'photo.jpg ' , { encoding : 'base64' } ) ;
620+ const startingImage = fs . readFileSync ( 'woman.png ' , { encoding : 'base64' } ) ;
621621
622622 let { operation } = await ai . generate ( {
623- model : googleAI . model ( 'veo-3.1-fast -generate-preview' ) ,
623+ model : googleAI . model ( 'veo-3.1-lite -generate-preview' ) ,
624624 prompt : [
625625 {
626626 text : 'make the subject in the photo move' ,
627627 } ,
628628 {
629629 media : {
630- contentType : 'image/jpeg ' ,
631- url : `data:image/jpeg ;base64,${ startingImage } ` ,
630+ contentType : 'image/png ' ,
631+ url : `data:image/png ;base64,${ startingImage } ` ,
632632 } ,
633633 } ,
634634 ] ,
635635 config : {
636- resolution : '4k ' ,
636+ resolution : '1080p ' ,
637637 durationSeconds : 8 ,
638638 aspectRatio : '9:16' ,
639639 personGeneration : 'allow_adult' ,
@@ -659,6 +659,7 @@ ai.defineFlow('photo-move-veo', async (_, { sendChunk }) => {
659659 // operation done, download generated video to disk
660660 const video = operation . output ?. message ?. content . find ( ( p ) => ! ! p . media ) ;
661661 if ( ! video ) {
662+ sendChunk ( operation ) ;
662663 throw new Error ( 'Failed to find the generated video' ) ;
663664 }
664665 sendChunk ( 'Writing results to photo.mp4' ) ;
0 commit comments