How to specify maximum duration in an incoming transformation

jdali Member Posts: 1


I'm adding an incoming transformation in my unsigned upload preset to set a maximum duration of 9 sec per video whenever a video is uploaded client-side. So, if user uploads a video>9 sec, the video duration would be cut to 9 sec.

I'm using the conditional field in the incoming transformation section to set this up:

However, once this condition is added I get a 400 error when a video is uploaded (if I remove this condition everything works fine)

How could I specify this transformation correctly?



  • rlux
    rlux Administrator, Cloudinary Staff Posts: 49

    The error is because duration can’t be used in an if/else condition.

    In this case, you don't need the conditional anyway, because du_9 will return a max of 9 seconds, but shorter videos will stay the same length.

    I hope that helps!

  • arinh
    arinh Member Posts: 1

    I can't seem to find where you assign du_<number> in the upload preset UI for incoming transformation (UI screenshotted above). @rlux