What spiega is about
- Knowledge sharing
- Portfolio
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
remove silence from video
We want to remove silence from video clip
cd ~/VideoProd/clip/
bash ~/lav/src/malastro/media/video_cut_silence.sh obs_try.mp4 obs_voice.mp4
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.shcapture_video.shconvert_format.shdeshake.shdownload_website.shextract_frames.shframe_interpolate.shgrab_video.shimg2pdf.shimg2video.shmidi_bluetooth.shpackage_media.shpal2mp4.shplayer_bash.shrecordSoundCard.shrecord_soundcard.shreduce_video.shresize_video.shreverseClip.shrotate_180.shrotate_90.shrotate_metadata.shsnd_baudline.shsnd_cards.shsnd_convert.shsnd_recordSoundcard.shstabilize_clip.shstabilize_gyro.shstream_screen.shstream_usb.shtransparent_video.shwebcam.sh