whyleyc / zamzar-php

Simple PHP script to use the Zamzar file conversion API
MIT License
1 stars 1 forks source link

Parallel conversions with zamzar #3

Open ask2rg opened 2 years ago

ask2rg commented 2 years ago

Hi @whyleyc there is any way for parallel file conversions with zamzar

actually currently zamzar api taking 10-15 sec to convert for each file, when i convert 6 files one by one (in serial conversion mode) it take around 60-80sec, is it possible to send conversion request for all 6 files at once, and all the files conversions done at same time. So that i will able to get output in 10-20 sec.

whyleyc commented 2 years ago

@ask2rg Yes it's entirely possible to submit multiple conversions simultaneously. If you were trying to do that with this script you have a couple of options:

  1. Run multiple versions of this script in parallel (one for each file you wish to convert).

  2. Adapt the script to submit a file but don't wait until the conversion has been completed before submitting the next one - you could achieve this by grabbing the returned job ID after submission, storing that in an array (or similar), submitting your other jobs (and storing those job IDs), then iterating through the array to poll each job in turn and downloading the converted files.

Also I would recommend checking out the official Zamzar PHP SDK which has more features than this simple script:

https://github.com/zamzar/zamzar-php