Spiega documentation

Article: multimedia_utils

What spiega is about

multimedia utils

Multimedia utils

Here is a collection of useful scripts created over 16y to manage multimedia processing.

audio

#cat ~/lav/src/malastro/media/audio_extract.sh
ffmpeg -i $1 -q:a 0 -map a $outF.mp3

images

video to gif

We need to convert video clips into light gif for blog posts

cd ~/VideoProd/clip/
for i in *mp4; do
    echo ${i/.mp4/.gif} 
    #ffmpeg -i $i -y -vf "fps=10,scale:500-1,palettegen" -loop 0 ${i/.mp4/.gif}
    ffmpeg -i $i -vf "palettegen" -y palette.png
    #ffmpeg -i $i -y -vf "fps=10" -i palette.png -filter_complex "paletteuse" -loop 0 ${i/.mp4/.gif}
    ffmpeg -i $i -y -vf "fps=10,scale=500:-1:flags=lanczos,split[s0][s1];[s0]palettegen=max_colors=32:stats_mode=single:[p];[s1][p]paletteuse=dither=floyd_steinberg" \
	   ${i/.mp4/.gif}
done
org_mode_11.gif
org_mode_12.gif

video

deshake video

To deshake a video we need first to create a vector transform which computes the camera movements compared to the images movement and reconstruct the 3d scene.

#cat ~/lav/src/malastro/media/deshake.sh
ffmpeg -y -i unstable_$fName -vf vidstabdetect -f null -
ffmpeg -y -i unstable_$fName -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 $fName
cat ~/lav/src/malastro/media/audio_extract.sh
ffmpeg -i $1 -q:a 0 -map a $outF.mp3
ls ~/lav/src/malastro/media/
audio_extract.sh
capture_video.sh
convert_format.sh
deshake.sh
download_website.sh
extract_frames.sh
frame_interpolate.sh
grab_video.sh
img2pdf.sh
img2video.sh
midi_bluetooth.sh
package_media.sh
pal2mp4.sh
player_bash.sh
recordSoundCard.sh
record_soundcard.sh
reduce_video.sh
resize_video.sh
reverseClip.sh
rotate_180.sh
rotate_90.sh
rotate_metadata.sh
snd_baudline.sh
snd_cards.sh
snd_convert.sh
snd_recordSoundcard.sh
stabilize_clip.sh
stabilize_gyro.sh
stream_screen.sh
stream_usb.sh
transparent_video.sh
webcam.sh

Date: 2026-06-22 Mon 00:00

Author: sabeiro

Created: 2026-06-28 Sun 17:43

Validate