Skip to content

Instantly share code, notes, and snippets.

@makoto1984
makoto1984 / live-meta.sh
Last active January 15, 2021 15:57
streaming music with generated video to youtube via ffmpeg
#!/bin/sh
# This script is a companion of the script youtube-music-live.sh. Assuming the MUSIC_PATH is an icecast2 stream, The script will fetch the metadata tag StreamTitle every 5 seconds and update the file /tmp/artist, /tmp/title. Generally, the StreamTitle should be like "artist - title", though sometimes there is only title. You may also update the files manually and ignore this script. Be sure to run this script after youtube-music-live.sh.
# You have to define music url.
MUSIC_PATH=
while [ `pgrep -x ffmpeg` ]
do
meta=`ffprobe -v error -show_format "$MUSIC_PATH" | grep StreamTitle | cut -d= -f2`
case "$meta" in
@makoto1984
makoto1984 / live.sh
Created July 9, 2019 14:56
Streaming screen capture with camera at corner and playback with microphone input. Assuming first graphic card with kms support, camera available and pulseaudio.
#!/bin/sh
#required for kmsgrab
setcap cap_sys_admin+ep /usr/bin/ffmpeg
#specify streamurl provided by streaming platform
#streamurl='rtmp://a.rtmp.youtube.com/live2/xxxx-xxxx-xxxx-xxxx'
streamurl=
#specify loopback pulseaudio device