robbiepaul / cloudconvert-laravel

A Laravel wrapper for the CloudConvert API
177 stars 34 forks source link

Retrieve callback reponse to client-side #22

Closed bachras closed 8 years ago

bachras commented 8 years ago

Hi, I understand this is not completely related to this API but I would like to ask for your help. Is there any way to pass parameters from callback function to client size and notify the user when conversion is completed?

I would really appreciate any help. Thanks.

robbiepaul commented 8 years ago

It's dependent on your own business logic really, it's hard to give a concrete example.

My approach would be to create a database entry for the conversion (associated with the user) when it starts, then update the entry when the conversion is complete (via callback). Then notify the client using an event listener and websockets, probably with Pusher. There's a free lesson on Laracasts about it here: https://laracasts.com/series/whats-new-in-laravel-5-1/episodes/12

bachras commented 8 years ago

Thank you for your reply. I will watch the lesson and try to implement what you suggested as I was thinking something along those lines.

I have another question about cloudconvert video conversion. Is there any way to convert video from aspect ratio 9:16 to 16:9? Or any another solution? I am trying to achieve something like Facebook which adds black background on both sides for portrait video files.

Thank you for advises once again.

robbiepaul commented 8 years ago

To be honest I'm not sure, I haven't converted many videos using CloudConvert. Have you tried changing the converteroptions? You can test them out on the API console here: https://cloudconvert.com/api/console

I know you can pass a custom FFMPEG command through to CloudConvert, so maybe that's the best way to go? You can use placeholders for the input/output file eg:

CloudConvert::file('video1.mp4')
            ->command('-i {INPUTFILE} {OUTPUTFILE}')
            ->to('video2.mp4');

See the FFMPEG Documentation for all the options available.

Also just to be clear, I don't work for CloudConvert. I just created this package to make life a little easier.

bachras commented 8 years ago

Sorry for inconvenience, I do understand that you don't work for CloudConvert. I just thought you might know a solution to my problem as you have been very kind and helpful previously. I will try use command and I hope it solves the problem. Thank you once again.

robbiepaul commented 8 years ago

Happy to help!