Skip to content

Instantly share code, notes, and snippets.

@azeemh
azeemh / .bashrc
Created December 29, 2023 21:12
Bash Function to convert webm to mp4
# Based on the command used in https://askubuntu.com/a/1462885
#
# ffmpeg -i screencast.webm -filter:v "scale=trunc(iw/2)*2:trunc(ih/2)*2,fps=30" screencast.mp4
#
# Easily call this lengthy command with webm2mp4 filename.webm
#
# Add this to your ~/.bashrc file to easily access
#function to convert webm to mp4 via ffmpeg
function webm2mp4() {
@mindplay-dk
mindplay-dk / image-url.ts
Last active September 13, 2024 22:45
Rotate image preview to compensate for EXIF orientation (Javascript / Typescript)
// Based on: https://stackoverflow.com/a/46814952/283851
/**
* Create a Base64 Image URL, with rotation applied to compensate for EXIF orientation, if needed.
*
* Optionally resize to a smaller maximum width - to improve performance for larger image thumbnails.
*/
export async function getImageUrl(file: File, maxWidth: number|undefined) {
return readOrientation(file).then(orientation => applyRotation(file, orientation || 1, maxWidth || 999999));
}