How to convert video with php without using ffmpeg?

2

I would like to know if there is any way to convert videos in PHP without using ffmpeg , since my hosting does not allow anything to be installed.

If you do not know how, someone knows of some API that does the conversion of videos and audios for free. Something like

http://[host da api]/convert?target=[url para arquivo]&output=[nome do arquivo saída]

This is by GET or by POST with AJAX or cURL.

    
asked by anonymous 16.02.2016 / 04:29

1 answer

6

Finding the only one I found that seems satisfactory has been link , follow links:

Short documentation:

PHP:

Java

Limitations of the free version

  • Maximum 30 conversions per day (every 24 hours)
  • Maximum upload limit per file is 100 Megabytes

(Really for something free this surprised me)

How to use

The process is done by REST using a JSON like this:

POST /jobs HTTP/1.1
Host: https://api2.online-convert.com
X-Oc-Api-Key: <sua chave da API key deve vir aqui>
Content-Type: application/json

{
    "input": [{
        "type": "remote",
        "source": "http:\/\/site\/arquivo"
    }],
    "conversion": [{
        "target": "wav"
    }]
}

Change <sua chave da API key deve vir aqui> by your access key (you need to register at link )

If you want to use PHP-ready classes, do so (using onlineconvert-api-sdk-php ):

<?php
define('API_KEY', 'sua chave da API key deve vir aqui');

require 'vendor/autoload.php';

$config = new \OnlineConvert\Configuration();
$config->setApiKey('main', API_KEY);
$client = new \OnlineConvert\Client\OnlineConvertClient($config, 'main');
$syncApi = new \OnlineConvert\Api($client);

The example is sync, but it can also be async:

$asyncApi = new \OnlineConvert\Api($client, true);

Note that it uses autoload, since the installation is done by composer , that is, if you want to do "manually" it will be a bit laborious because it is necessary to study and understand composer and autoload . p>     

16.02.2016 / 19:53