Ever add a ffmpeg video that you wanted to crop?
But it’s a pain to do have the right crop filter 😟?
Introducing ffmpeg-cropper. Drag and drop your video and select the crop area. The tool will generate the ffmpeg filter for you (you can even play the video to check if the crop is correct).
Links:
Most important part of the code are
-
the drop zone
<div ondrop="dropHandler(event);" ondragover="dragOverHandler(event, true);" ondragleave="dragOverHandler(event, false);" >The
ondragoverandondragleaveshould callevent.preventDefault();to allow the drop -
the (video) file to
srcconversionconst fileURL = window.URL.createObjectURL(file); video = document.createElement("video"); video.src = fileURL;Note that
createObjectURLcan use a lot of memory, so don’t forget to revoke the URL when you don’t need it anymore withwindow.URL.revokeObjectURL(fileURL);