Giter VIP home page Giter VIP logo

json2video / json2video-php-sdk Goto Github PK

View Code? Open in Web Editor NEW
13.0 2.0 1.0 19 KB

Video automation with PHP: add watermarks, resize videos, create slideshows, add soundtrack, voice-over with text-to-speech (TTS), text animations.

Home Page: https://json2video.com

License: MIT License

PHP 100.00%
video video-processing video-editing text-to-speech slideshow watermarking watermark-video php php7 video-edit-sdk

json2video-php-sdk's Introduction

Note: Updated for API v2.0

Create videos programmatically in PHP

Create and edit videos: add watermarks, resize videos, create slideshows, add soundtrack, automate the creation of videos in multiple languages, add voice-over, add text animations.

JSON2Video is a video editing API that simplifies creating, editing and customising videos programmatically. Its dead simple approach, close to the web development mindset, makes it the ultimate solution for developers that want to create or customise videos in an automated way.

Additionally, the simple integration of real HTML5+CSS elements, the already built-in text animations and voice generation (TTS) converts JSON2Video in the best solution in its category.

Use cases

  • Automate the production of promotional videos for your e-commerce products
  • Automate publication of social media videos created directly from your news feed
  • Customize your advertising campaigns with different images, videos, texts and create tens or hundreds of different options
  • From weather forecasts to traffic bulletins or financial reports, if you have a data source you can create an audiovisual experience
  • Convert your text, pictures and information into engaging videos of your real estate properties
  • Add watermarks, bumpers, titles; Concatenate different videos into one; Add voice-over or music; Create photo slideshows; โ€ฆ

Get your FREE API Key

JSON2Video is free to use. Get your API Key at JSON2Video.com

Documentation

The API Specification will provide you with all the details of the JSON payload and the endpoints.

For a step by step guide, read the Tutorial that will introduce you through all features with code examples.

PHP SDK installation

You can use JSON2Video PHP SDK as a Composer package or with a simple require_once.

Using require_once

The simplest way :-)

  1. Download all.php from the /bundled folder into your project directory
  2. Import the library:
<?php
    require_once 'path/to/the/sdk/all.php';

    use JSON2Video\Movie;
    use JSON2Video\Scene;

Using Composer

The SDK has no external dependencies on other packages.

  1. Open the terminal and cd to your project directory
  2. Use composer:
composer require json2video/json2video-php-sdk

Hello world

JSON2Video makes video creation easy as a piece of cake:

<?php

    require 'vendor/autoload.php';

    use JSON2Video\Movie;
    use JSON2Video\Scene;

    // Create a new movie
    $movie = new Movie;

    // Set your API key
    // Get your free API key at https://json2video.com
    $movie->setAPIKey(YOUR_API_KEY);

    // Set movie quality: low, medium, high
    $movie->quality = 'high';
    $movie->draft = true;

    // Create a new scene
    $scene = new Scene;

    // Set the scene background color
    $scene->background_color = '#4392F1';

    // Add a text element printing "Hello world" in a fancy way (basic/006)
    // The element is 10 seconds long and starts 2 seconds from the scene start
    // Element's vertical position is 50 pixels from the top
    $scene->addElement([
        'type' => 'text',
        'style' => '003',
        'text' => 'Hello world',
        'duration' => 10,
        'start' => 2
    ]);

    // Add the scene to the movie
    $movie->addScene($scene);

    // Call the API and start rendering the movie
    $result = $movie->render();
    var_dump($result);

    //$result = $movie->getStatus('cLiLZ7fKeMvjb4b8');
    //var_dump($result);

    // Wait for the render to finish
    $movie->waitToFinish();
?>

This is the resulting video:

https://assets.json2video.com/sites/github/hello-world.mp4

json2video-php-sdk's People

Contributors

imdavidbosch avatar joaquimcardona avatar qcardona avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

sw0rdf1sh1

json2video-php-sdk's Issues

Clean Install php 8.2

array(3) { ["success"]=> bool(true) ["project"]=> string(16) "ANIpWLaD9AqeCI3j" ["timestamp"]=> string(24) "2023-08-21T16:53:27.804Z" } Status: running / downloading assets Status: done / Movie URL: https://assets.json2video.com/clients/xxxx/renders/2023-08-21-24936.mp4 Remaining quota: movies(
Warning: Undefined array key "movies" in /xxx/vendor/json2video/json2video-php-sdk/src/Movie.php on line 141
) and drafts(
Warning: Undefined array key "drafts" in /xxx/vendor/json2video/json2video-php-sdk/src/Movie.php on line 141

I can see it my account on json2video but was expecting no errors and have it moved to local file - what should have been expectations, also please see errors on arrays

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.