Convert GIF to MP4 and add to Video library

Comments

3 comments

  • Avatar
    Daniel Mendoza

    Hi @Al Petfield,

    There are two options that we can do, however, option 1 would be the better approach:

    1. Convert the GIF to MP4 during upload by applying an incoming transformation.
      • The videos can then be concatenated together by following the steps outlined here.
    2. If you wish to use an existing GIF, a time duration will need to be specified. Also, the height and width of the overlay needs to match the dimensions of the video. I have made an example here: https://res.cloudinary.com/demo/video/upload/w_300,h_200/w_300,h_200,l_kitten_fighting.gif,fl_splice,du_3/so_0,fl_layer_apply/dog.mp4.
      • More details on how to do that can be found here.

    Hope this helps, please let me know if you have any further questions.

    0
    Comment actions Permalink
  • Avatar
    Al Petfield

    Thanks, the way I achieved the GIF to MP4 transformation was to do this:

    $image_path = 'path/to/image.gif';
    $filename = 'filename';

    $default_upload_options = array(
    'format' => 'mp4',
    'public_id' => $filename,
    'resource_type' => 'video'
    );
    $files['unnamed_local'] = \Cloudinary\Uploader::upload($image_path, $default_upload_options);
    0
    Comment actions Permalink
  • Avatar
    Daniel Mendoza

    @Al Petfield

    Great job, thank you for sharing your example. This is referred to as an incoming transformation.

    Take care.

    0
    Comment actions Permalink

Please sign in to leave a comment.