Skip to content

Instantly share code, notes, and snippets.

@kevinvdburgt
Created April 20, 2013 11:54
Show Gist options
  • Save kevinvdburgt/5425760 to your computer and use it in GitHub Desktop.
Save kevinvdburgt/5425760 to your computer and use it in GitHub Desktop.
Twitch.tv livestream
#!/bin/sh
SIZE="1920x1080"
BITRATE="32K"
FRAMERATE="20"
KEY="KEY_HERE"
TIMESTAMP=$(date "%y%m%d%-h%m")
ffmpeg\
-f x11grab -s $SIZE -r $FRAMERATE -i :0.0\
-f alsa 0ac 2 -i pulse\
-vcodec libx264 -preset ultrafast\
-b:v 1024k -b:a 128k\
-pix_fmt yuv420p\
acodec libmp3lame -ar 44100 -ab 96k\
-threads 0\
-f flv - |\
ffmpeg -i - \
-c copy -f flv "rtmp://live.justin.tv/app/$KEY"
# -c copy -f mp4 "~/video_$TIMESTAMP.mp4"
@kevinvdburgt
Copy link
Author

[kevin@LT-KEVIN Scripts]$ ./Livestream.sh
date: invalid date ‘%y%m%d%-h%m’
ffmpeg version 1.2ffmpeg version 1.2 Copyright (c) 2000-2013 the FFmpeg developers Copyright (c) 2000-2013 the FFmpeg developers
built on Apr 1 2013 09:33:17 with gcc 4.7.2 (GCC)

configuration: --prefix=/usr --disable-debug --disable-static --enable-avresample --enable-dxva2 --enable-fontconfig --enable-gpl --enable-libass --enable-libbluray --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libv4l2 --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-postproc --enable-runtime-cpudetect --enable-shared --enable-vdpau --enable-version3 --enable-x11grab
built on Apr 1 2013 09:33:17 with gcc 4.7.2 (GCC)
configuration: --prefix=/usr --disable-debug --disable-static --enable-avresample --enable-dxva2 --enable-fontconfig --enable-gpl --enable-libass --enable-libbluray --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libv4l2 --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-postproc --enable-runtime-cpudetect --enable-shared --enable-vdpau --enable-version3 --enable-x11grab
libavutil 52. 18.100 / 52. 18.100
libavcodec 54. 92.100 / 54. 92.100
libavutil 52. 18.100 / 52. 18.100
libavformat 54. 63.104 / 54. 63.104
libavcodec 54. 92.100 / 54. 92.100
libavformat 54. 63.104 / 54. 63.104
libavdevice 54. 3.103 / 54. 3.103
libavfilter 3. 42.103 / 3. 42.103
libavdevice 54. 3.103 / 54. 3.103
libswscale 2. 2.100 / 2. 2.100
libavfilter 3. 42.103 / 3. 42.103
libswscale 2. 2.100 / 2. 2.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 2.100 / 52. 2.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 2.100 / 52. 2.100
[x11grab @ 0xae1d20] device: :0.0 -> display: :0.0 x: 0 y: 0 width: 1920 height: 1080
[x11grab @ 0xae1d20] shared memory extension found
[x11grab @ 0xae1d20] Estimating duration from bitrate, this may be inaccurate
Input #0, x11grab, from ':0.0':
Duration: N/A, start: 1366458795.173150, bitrate: 1327104 kb/s
Stream #0:0: Video: rawvideo (BGR[0] / 0x524742), bgr0, 1920x1080, 1327104 kb/s, 20 tbr, 1000k tbn, 20 tbc
pulse: No such file or directory
pipe:: Invalid data found when processing input

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment