Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save minhhungit/e70b7db8f281888c2edd1fbc0e5b99ec to your computer and use it in GitHub Desktop.
Save minhhungit/e70b7db8f281888c2edd1fbc0e5b99ec to your computer and use it in GitHub Desktop.
# Check formats available
youtube-dl -F https://www.youtube.com/watch?v=dEMYRY8zPfM
# Download format no. 18 with subtitles
youtube-dl -f 18 --write-auto-sub --embed-subs --convert-subs srt --sub-lang pt -k https://www.youtube.com/watch?v=dEMYRY8zPfM
# NOTE: -k = download (otherwise subtitle file is deleted and only embedded)
# List subtitles
youtube-dl --list-subs
# Download just the subtitle..
youtube-dl --write-sub --sub-lang en --skip-download https://www.youtube.com/watch?v=dEMYRY8zPfM
# Or if auto-generated only
youtube-dl --write-auto-sub --sub-lang en --skip-download https://www.youtube.com/watch?v=dEMYRY8zPfM
# ffmgpeg below but another option..
# https://news.ycombinator.com/item?id=22804804
# https://lukespear.co.uk/blog/share-desktop-as-webcam-in-obs-loopback/
# Just a quick write-up on a recent “hack” to share your desktop as a webcam,
# letting you share your screen or specific windows to any number of people in any video conferencing app
# http://ubuntuhandbook.org/index.php/2019/02/obs-studio-23-0-released/
sudo add-apt-repository ppa:obsproject/obs-studio
sudo apt-get update
sudo apt-get install obs-studio
# and then NDI plug in for OBS
# https://github.com/Palakis/obs-ndi/releases/tag/4.8.0
# https://obsproject.com/forum/resources/obs-ndi-newtek-ndi%E2%84%A2-integration-into-obs-studio.528/
sudo apt install ./libndi4_4.5.1-1_amd64.1.deb
sudo apt install ./obs-ndi_4.8.0-1_amd64.deb
# Then to integrate phone camera..
# NOTE: App is $15 from there but free one in other link
# https://obs.camera/docs/getting-started/ndi-wifi/
# but for iOS app use
# https://www.newsshooter.com/2020/04/06/use-your-iphone-as-a-webcam-with-newteks-free-ndi-apps/
# Also read: https://support.newtek.com/hc/en-us/articles/115004589594-Connectivity-guidelines-for-the-NDI-Camera-App
# Finally integrate via the plug in within OBS
# https://www.youtube.com/watch?v=DyfMwXs4tKM
# Sound issues..
# iPhone sound?
# https://www.youtube.com/watch?v=pLCyo96qeE4&feature=youtu.be
# OK, but how to use as a standard webcam?
# Seems only Windows supported. See official video: https://www.youtube.com/watch?v=0XZujmgL3uc&t=4s
# And what about using Linux as an NID source?
# Seems there is a driver but not officially promoted
# https://support.newtek.com/hc/en-us/articles/360012318274-Linux-NDI-HX-Driver
https://ffmpeg.org/documentation.html
https://trac.ffmpeg.org/wiki/Capture/Desktop
# https://itsfoss.com/ffmpeg/
sudo add-apt-repository ppa:jonathonf/ffmpeg-4
sudo apt update
sudo apt install ffmpeg -y
# https://www.internalpointers.com/post/record-desktop-ffmpeg-linux
# list PulseAudio sources
pactl list sources
# https://unix.stackexchange.com/a/489522
# A="$(pacmd list-sources | grep -PB 1 "analog.*monitor>" | head -n 1 | perl -pe 's/.* //g')"
# F="$(date --iso-8601=minutes | perl -pe 's/[^0-9]+//g').mkv"
# V="$(xdpyinfo | grep dimensions | perl -pe 's/.* ([0-9]+x[0-9]+) .*/$1/g')"
# ffmpeg -loglevel error -video_size "$V" -f x11grab -i :0.0 -f pulse -i "$A" -f pulse -i default -filter_complex amerge -ac 2 -preset veryfast "$F"
#!/bin/bash
# open terminal in other screen and run ./record.sh
# Allow 2 breaths/seconds before quiting otherwise audio is cut off
ffmpeg -f x11grab -s 1920x1080 -i :0.0 -f alsa -i default $(date --iso-8601=minutes | perl -pe 's/[^0-9]+//g')_${1:-"screenrecording"}.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment