Cheatsheet related to video /camera etc. Mainly on Linux.
FFmpeg
Some random snippets:
# slice video
ffmpeg -ss 0:20.500 -to 1:20.100 -i waka.mkv -codec copy w.mkv
# slice audio
ffmpeg -i waka.mp3 -ss 60 -t 60 -acodec copy w.mp3
# produce gif (vid2gif script), adjust fps scale(resolution) to suit your needs
ffmpeg -ss 0 -t 5 -i <filename> -vf "fps=10,scale=320👎flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop 0 output.gif
# start length
# Make timelapse
TIMES_FASTER=60
ffmpeg -i input.mkv -filter:v "setpts=PTS/$TIMES_FASTER" output.mkv
# Speedup video (not sure if works 100%)
ffmpeg -i input -filter_complex "[0:v]setpts=PTS/2[v];[0:a]atempo=2[a]" -map "[v]" -map "[a]" output
### https://superuser.com/questions/611324/how-can-i-speed-up-a-video-without-pitch-distortion-in-linux
Reduce video size
# Quick copy-paste (without changing resolution) is:
ffmpeg -i input.mp4 -vcodec libx265 -crf 28 output.mp4
OBS
Add multiple instances of camera (YT)
Virtual camera
We can create virtual cameras using v4l2loopback
sudo modprobe v4l2loopback - creates camera we can write to.
sudo modprobe -r v4l2loopback - removes it
We can list the cameras using:
v4l2-ctl --list-devices
We can write to camera using e.g. ffmpeg:
ffmpeg -f v4l2 -i /dev/video0 -vf "vflip" -f v4l2 /dev/video2 - upsidedown camera
We can also use obs-studio to create scenes and output them to e.g. /dev/video2 using obs-v4l2sink.
MPV
View gif / movie in terminal:
mpv --vo=tct --really-quiet <GIF_FILE>
mpv --vo=tct <VIDEO_FILE>
Default keybindings
https://defkey.com/mpv-media-player-shortcuts (For moving viewport search for “pan”)
Download Teams video
https://www.reddit.com/r/sharepoint/comments/nuk8q0/is_there_any_way_to_download_view_only_videos/
To download Teams meeting videos you participated in but didn’t organize, you can use yt-dlp or ffmpeg.
Obtain the Video Manifest URL:
- Go to the video’s playback page (Teams, SharePoint, or Stream).
- Open your browser’s developer tools (usually F12, or via browser menus).
- Go to the “Network” tab.
- In the filter box, type
videomanifest. - Refresh the page (usually F5, or via browser menus).
- Start playing the video.
- A request starting with
videomanifest?providerwill appear in the list. - Right-click on this request and copy its URL.
- You can now pause or stop the video.
Modify the URL:
- Paste the copied URL into a text editor. It will be long.
- Find the string
index&format=dash. - Delete everything after this string, starting from
&altManifestMetadatato the end of the URL. - Copy this shortened URL.
Download the Video:
Use your preferred command-line tool:
Using yt-dlp:
Open your terminal or command prompt and run:
yt-dlp "PasteShortenedURLhere" -o "DesiredFilename.mp4"
Using ffmpeg:
Open your terminal or command prompt and run:
ffmpeg -i "PasteShortenedURLhere" -codec copy "DesiredFilename.mp4"
*
Comments