ffmpeg cropper
π π¨βπ» π
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
ondragover
andondragleave
should callevent.preventDefault();
to allow the drop -
the (video) file to
src
conversionconst fileURL = window.URL.createObjectURL(file); video = document.createElement("video"); video.src = fileURL;
Note that
createObjectURL
can use a lot of memory, so donβt forget to revoke the URL when you donβt need it anymore withwindow.URL.revokeObjectURL(fileURL);