PHP code example of runapi-ai / volcengine-lip-sync

1. Go to this page and download the library: Download runapi-ai/volcengine-lip-sync library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

runapi-ai / volcengine-lip-sync example snippets




unApi\VolcengineLipSync\VolcengineLipSyncClient;

$client = new VolcengineLipSyncClient(); // reads RUNAPI_API_KEY

$task = $client->lipSyncVideo->create([
    'model' => 'volcengine-lip-sync',
    'align_audio' => true,
    'align_audio_reverse' => true,
    'enable_vocal_separation' => true,
    'mode' => 'lite',
    'source_audio_url' => 'https://cdn.runapi.ai/public/samples/volcengine-lip-sync-voice-adam.mp3',
    'source_video_url' => 'https://cdn.runapi.ai/public/samples/volcengine-lip-sync-source.mp4',
    'template_start_seconds' => 0.5,
]);

$status = $client->lipSyncVideo->get($task->id);

$result = $client->lipSyncVideo->run([
    'model' => 'volcengine-lip-sync',
    'align_audio' => true,
    'align_audio_reverse' => true,
    'enable_vocal_separation' => true,
    'mode' => 'lite',
    'source_audio_url' => 'https://cdn.runapi.ai/public/samples/volcengine-lip-sync-voice-adam.mp3',
    'source_video_url' => 'https://cdn.runapi.ai/public/samples/volcengine-lip-sync-source.mp4',
    'template_start_seconds' => 0.5,
]);

echo $result->videos[0]->url . PHP_EOL;