https://wiki.archlinux.org/api.php?action=feedcontributions&user=Zorfmorf&feedformat=atomArchWiki - User contributions [en]2024-03-28T21:01:56ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=Streaming_to_twitch.tv&diff=311118Streaming to twitch.tv2014-04-20T11:43:38Z<p>Zorfmorf: Made hint to to use pavucontrol more visible</p>
<hr />
<div>[[Category:Streaming]]<br />
Twitch.tv is one of the more popular [https://en.wikipedia.org/wiki/Real_Time_Messaging_Protocol RTMP] based streaming services offered. As [[Steam]] has a Linux client available, some people may be in search of solutions to stream their games or Linux desktop. As there are no well known Linux broadcasting programs just yet, most solutions at this point are CLI based. The info included here should serve as a list of such solutions. <br />
<br />
==Twitch streaming Guidelines==<br />
''From'' [http://help.twitch.tv/customer/portal/articles/1253460-broadcast-requirements Twitch.tv support]: <br />
<br />
'''Video Requirements'''<br />
* Codec: H.264 (x264)<br />
* Mode: Strict CBR<br />
* Keyframe Interval: 2 seconds<br />
<br />
'''Audio Requirements'''<br />
* Codec: AAC-LC or MP3, Stereo or Mono<br />
* Maximum bit rate: 160 kbps (AAC), 128 kbps (MP3)<br />
* Sampling frequency: any (AAC), 44.1 KHz (MP3)<br />
<br />
'''Other Requirements'''<br />
<br />
Not listed on their page is a requirement of the [https://en.wikipedia.org/wiki/YUV#Y.27UV420p_.28and_Y.27V12_or_YV12.29_to_RGB888_conversion Y'UV420p pixel format], as Y'UV444 is not widely supported just yet. <br />
<br />
==GUI solutions==<br />
[https://aur.archlinux.org/packages/castawesome/ Castawesome] is a Gtk3 frontend for ffmpeg streaming with builtin Twitch.tv support.<br />
<br />
==Ffmpeg solutions==<br />
These solutions revolve around making use of the [[FFmpeg]] package:<br />
===.bashrc script method===<br />
One method of streaming to twitch using FFMPEG makes use of a simple script that is placed in a user's ~/.bashrc file. this script supports streaming of both desktop and OpenGL elements. <br />
* Depending on your internet upload speed, you may need to modify the Ffmpeg parameters. use the breakdown list for reference.<br />
<br />
The script can be used by typing <br />
streaming streamkeyhere<br />
into a terminal. While it's running, use '''pavucontrol''' to edit sound sources.<br />
The .bashrc script is as follows:<br />
<br />
streaming() {<br />
INRES="1920x1080" # input resolution<br />
OUTRES="1920x1080" # output resolution<br />
FPS="15" # target FPS<br />
GOP="30" # i-frame interval, should be double of FPS, <br />
GOPMIN="15" # min i-frame interval, should be equal to fps, <br />
THREADS="2" # max 6<br />
CBR="1000k" # constant bitrate (should be between 1000k - 3000k)<br />
QUALITY="ultrafast" # one of the many FFMPEG preset<br />
AUDIO_RATE="44100"<br />
STREAM_KEY="$1" # use the terminal command Streaming streamkeyhere to stream your video to twitch or justin<br />
SERVER="live-fra" # twitch server in frankfurt, see http://bashtech.net/twitch/ingest.php for list<br />
<br />
ffmpeg -f x11grab -s "$INRES" -r "$FPS" -i :0.0 -f alsa -i pulse -f flv -ac 2 -ar $AUDIO_RATE \<br />
-vcodec libx264 -g $GOP -keyint_min $GOPMIN -b $CBR -minrate $CBR -maxrate $CBR -pix_fmt yuv420p\<br />
-s $OUTRES -preset $QUALITY -tune film -acodec libmp3lame -threads $THREADS -strict normal \<br />
-bufsize $CBR "rtmp://$SERVER.twitch.tv/app/$STREAM_KEY"<br />
}<br />
<br />
{| class="wikitable"<br />
|+ '''Ffmpeg Parameter breakdown'''<br />
! Parameter !! Description<br />
|-<br />
| ffmpeg || The converter<br />
|-<br />
| -f x11grab || -f forces input to be from x11grab<br />
|-<br />
| -s "$INRES" || -s sets a specific image size, relying on the variable $INRES<br />
|-<br />
| -r "$FPS" || -r sets framerate to be the value equal to $FPS<br />
|-<br />
| -i :0.0 || -i gets input, in this case its pulling in screen :0.0 from x11. Can be adjusted, e.g. -i :0.0+500,100 to start at screenpos 500/100<br />
|-<br />
| -ab 96k || -ab sets audio bitrate to 96k. '''-b:a''' is the alternate form of this command<br />
|-<br />
| -f alsa || forces input(?) to be from alsa<br />
|-<br />
| -ac 2 || sets audio channels to 2<br />
|-<br />
| -i pulse || gets input from pulse<br />
|-<br />
| -vcodec libx264 || sets video codec to libx264<br />
|-<br />
| -crf 23 || sets the ffmpeg constant rate factor to 23<br />
|-<br />
| -preset "$QUAL" || sets the preset compression quality and speed<br />
|-<br />
| -s "1280x720" || specifies size of image to be 720p<br />
|-<br />
| -acodec libmp3lame || sets audio codec to use libmp3lame<br />
|-<br />
| -ar 44100 || sets audio rate to 44100 hz<br />
|-<br />
| -threads 0 || sets cpu threads to start, 0 autostarts threads based on cpu cores<br />
|-<br />
| -pix_fmt yuv420p || sets pixel format to Y'UV420p. Otherwise by default Y'UV444 is used and is incompatible with twitch<br />
|-<br />
| -f flv "$URL" || forces format to flv, and outputs to the twitch RTMP url<br />
|}</div>Zorfmorfhttps://wiki.archlinux.org/index.php?title=Streaming_to_twitch.tv&diff=310907Streaming to twitch.tv2014-04-19T13:17:29Z<p>Zorfmorf: Fixed whitespace issues and changed some comments</p>
<hr />
<div>[[Category:Streaming]]<br />
Twitch.tv is one of the more popular [https://en.wikipedia.org/wiki/Real_Time_Messaging_Protocol RTMP] based streaming services offered. As [[Steam]] has a Linux client available, some people may be in search of solutions to stream their games or Linux desktop. As there are no well known Linux broadcasting programs just yet, most solutions at this point are CLI based. The info included here should serve as a list of such solutions. <br />
<br />
==Twitch streaming Guidelines==<br />
''From'' [http://help.twitch.tv/customer/portal/articles/1253460-broadcast-requirements Twitch.tv support]: <br />
<br />
'''Video Requirements'''<br />
* Codec: H.264 (x264)<br />
* Mode: Strict CBR<br />
* Keyframe Interval: 2 seconds<br />
<br />
'''Audio Requirements'''<br />
* Codec: AAC-LC or MP3, Stereo or Mono<br />
* Maximum bit rate: 160 kbps (AAC), 128 kbps (MP3)<br />
* Sampling frequency: any (AAC), 44.1 KHz (MP3)<br />
<br />
'''Other Requirements'''<br />
<br />
Not listed on their page is a requirement of the [https://en.wikipedia.org/wiki/YUV#Y.27UV420p_.28and_Y.27V12_or_YV12.29_to_RGB888_conversion Y'UV420p pixel format], as Y'UV444 is not widely supported just yet. <br />
<br />
==GUI solutions==<br />
[https://aur.archlinux.org/packages/castawesome/ Castawesome] is a Gtk3 frontend for ffmpeg streaming with builtin Twitch.tv support.<br />
<br />
==Ffmpeg solutions==<br />
These solutions revolve around making use of the [[FFmpeg]] package:<br />
===.bashrc script method===<br />
One method of streaming to twitch using FFMPEG makes use of a simple script that is placed in a user's ~/.bashrc file. this script supports streaming of both desktop and OpenGL elements. <br />
* Depending on your internet upload speed, you may need to modify the Ffmpeg parameters. use the breakdown list for reference.<br />
<br />
<br />
The script can be used by typing <br />
streaming streamkeyhere<br />
into a terminal. sound sources can be manipulated by using pavucontrol.<br />
The .bashrc script is as follows:<br />
<br />
streaming() {<br />
INRES="1920x1080" # input resolution<br />
OUTRES="1920x1080" # output resolution<br />
FPS="15" # target FPS<br />
GOP="30" # i-frame interval, should be double of FPS, <br />
GOPMIN="15" # min i-frame interval, should be equal to fps, <br />
THREADS="2" # max 6<br />
CBR="1000k" # constant bitrate (should be between 1000k - 3000k)<br />
QUALITY="ultrafast" # one of the many FFMPEG preset<br />
AUDIO_RATE="44100"<br />
STREAM_KEY="$1" # use the terminal command Streaming streamkeyhere to stream your video to twitch or justin<br />
SERVER="live-fra" # twitch server in frankfurt, see http://bashtech.net/twitch/ingest.php for list<br />
<br />
ffmpeg -f x11grab -s "$INRES" -r "$FPS" -i :0.0 -f alsa -i pulse -f flv -ac 2 -ar $AUDIO_RATE \<br />
-vcodec libx264 -g $GOP -keyint_min $GOPMIN -b $CBR -minrate $CBR -maxrate $CBR -pix_fmt yuv420p\<br />
-s $OUTRES -preset $QUALITY -tune film -acodec libmp3lame -threads $THREADS -strict normal \<br />
-bufsize $CBR "rtmp://$SERVER.twitch.tv/app/$STREAM_KEY"<br />
}<br />
<br />
{| class="wikitable"<br />
|+ '''Ffmpeg Parameter breakdown'''<br />
! Parameter !! Description<br />
|-<br />
| ffmpeg || The converter<br />
|-<br />
| -f x11grab || -f forces input to be from x11grab<br />
|-<br />
| -s "$INRES" || -s sets a specific image size, relying on the variable $INRES<br />
|-<br />
| -r "$FPS" || -r sets framerate to be the value equal to $FPS<br />
|-<br />
| -i :0.0 || -i gets input, in this case its pulling in screen :0.0 from x11. Can be adjusted, e.g. -i :0.0+500,100 to start at screenpos 500/100<br />
|-<br />
| -ab 96k || -ab sets audio bitrate to 96k. '''-b:a''' is the alternate form of this command<br />
|-<br />
| -f alsa || forces input(?) to be from alsa<br />
|-<br />
| -ac 2 || sets audio channels to 2<br />
|-<br />
| -i pulse || gets input from pulse<br />
|-<br />
| -vcodec libx264 || sets video codec to libx264<br />
|-<br />
| -crf 23 || sets the ffmpeg constant rate factor to 23<br />
|-<br />
| -preset "$QUAL" || sets the preset compression quality and speed<br />
|-<br />
| -s "1280x720" || specifies size of image to be 720p<br />
|-<br />
| -acodec libmp3lame || sets audio codec to use libmp3lame<br />
|-<br />
| -ar 44100 || sets audio rate to 44100 hz<br />
|-<br />
| -threads 0 || sets cpu threads to start, 0 autostarts threads based on cpu cores<br />
|-<br />
| -pix_fmt yuv420p || sets pixel format to Y'UV420p. Otherwise by default Y'UV444 is used and is incompatible with twitch<br />
|-<br />
| -f flv "$URL" || forces format to flv, and outputs to the twitch RTMP url<br />
|}</div>Zorfmorfhttps://wiki.archlinux.org/index.php?title=Streaming_to_twitch.tv&diff=310906Streaming to twitch.tv2014-04-19T13:15:25Z<p>Zorfmorf: /* .bashrc script method */</p>
<hr />
<div>[[Category:Streaming]]<br />
Twitch.tv is one of the more popular [https://en.wikipedia.org/wiki/Real_Time_Messaging_Protocol RTMP] based streaming services offered. As [[Steam]] has a Linux client available, some people may be in search of solutions to stream their games or Linux desktop. As there are no well known Linux broadcasting programs just yet, most solutions at this point are CLI based. The info included here should serve as a list of such solutions. <br />
<br />
==Twitch streaming Guidelines==<br />
''From'' [http://help.twitch.tv/customer/portal/articles/1253460-broadcast-requirements Twitch.tv support]: <br />
<br />
'''Video Requirements'''<br />
* Codec: H.264 (x264)<br />
* Mode: Strict CBR<br />
* Keyframe Interval: 2 seconds<br />
<br />
'''Audio Requirements'''<br />
* Codec: AAC-LC or MP3, Stereo or Mono<br />
* Maximum bit rate: 160 kbps (AAC), 128 kbps (MP3)<br />
* Sampling frequency: any (AAC), 44.1 KHz (MP3)<br />
<br />
'''Other Requirements'''<br />
<br />
Not listed on their page is a requirement of the [https://en.wikipedia.org/wiki/YUV#Y.27UV420p_.28and_Y.27V12_or_YV12.29_to_RGB888_conversion Y'UV420p pixel format], as Y'UV444 is not widely supported just yet. <br />
<br />
==GUI solutions==<br />
[https://aur.archlinux.org/packages/castawesome/ Castawesome] is a Gtk3 frontend for ffmpeg streaming with builtin Twitch.tv support.<br />
<br />
==Ffmpeg solutions==<br />
These solutions revolve around making use of the [[FFmpeg]] package:<br />
===.bashrc script method===<br />
One method of streaming to twitch using FFMPEG makes use of a simple script that is placed in a user's ~/.bashrc file. this script supports streaming of both desktop and OpenGL elements. <br />
* Depending on your internet upload speed, you may need to modify the Ffmpeg parameters. use the breakdown list for reference.<br />
<br />
<br />
The script can be used by typing <br />
streaming streamkeyhere<br />
into a terminal. sound sources can be manipulated by using pavucontrol.<br />
The .bashrc script is as follows:<br />
<br />
<br />
streaming() {<br />
INRES="1920x1080" # input resolution<br />
OUTRES="1920x1080" # output resolution<br />
FPS="15" # target FPS<br />
GOP="30" # FPS x2, i-frame interval<br />
GOPMIN="15" # should be equal to fps, min i-frame interval<br />
THREADS="2" # max 6<br />
CBR="1000k" # constant bitrate (should be between 1000k - 3000k)<br />
QUALITY="ultrafast" # one of the many FFMPEG preset<br />
AUDIO_RATE="44100"<br />
STREAM_KEY="$1" # use the terminal command Streaming streamkeyhere to stream your video to twitch or justin<br />
SERVER="live-fra" # twitch server in frankfurt, see http://bashtech.net/twitch/ingest.php for list<br />
<br />
ffmpeg -f x11grab -s "$INRES" -r "$FPS" -i :0.0 -f alsa -i pulse -f flv -ac 2 -ar $AUDIO_RATE \<br />
-vcodec libx264 -g $GOP -keyint_min $GOPMIN -b $CBR -minrate $CBR -maxrate $CBR -pix_fmt yuv420p\<br />
-s $OUTRES -preset $QUALITY -tune film -acodec libmp3lame -threads $THREADS -strict normal \<br />
-bufsize $CBR "rtmp://$SERVER.twitch.tv/app/$STREAM_KEY"<br />
}<br />
<br />
{| class="wikitable"<br />
|+ '''Ffmpeg Parameter breakdown'''<br />
! Parameter !! Description<br />
|-<br />
| ffmpeg || The converter<br />
|-<br />
| -f x11grab || -f forces input to be from x11grab<br />
|-<br />
| -s "$INRES" || -s sets a specific image size, relying on the variable $INRES<br />
|-<br />
| -r "$FPS" || -r sets framerate to be the value equal to $FPS<br />
|-<br />
| -i :0.0 || -i gets input, in this case its pulling in screen :0.0 from x11. Can be adjusted, e.g. -i :0.0+500,100 to start at screenpos 500/100<br />
|-<br />
| -ab 96k || -ab sets audio bitrate to 96k. '''-b:a''' is the alternate form of this command<br />
|-<br />
| -f alsa || forces input(?) to be from alsa<br />
|-<br />
| -ac 2 || sets audio channels to 2<br />
|-<br />
| -i pulse || gets input from pulse<br />
|-<br />
| -vcodec libx264 || sets video codec to libx264<br />
|-<br />
| -crf 23 || sets the ffmpeg constant rate factor to 23<br />
|-<br />
| -preset "$QUAL" || sets the preset compression quality and speed<br />
|-<br />
| -s "1280x720" || specifies size of image to be 720p<br />
|-<br />
| -acodec libmp3lame || sets audio codec to use libmp3lame<br />
|-<br />
| -ar 44100 || sets audio rate to 44100 hz<br />
|-<br />
| -threads 0 || sets cpu threads to start, 0 autostarts threads based on cpu cores<br />
|-<br />
| -pix_fmt yuv420p || sets pixel format to Y'UV420p. Otherwise by default Y'UV444 is used and is incompatible with twitch<br />
|-<br />
| -f flv "$URL" || forces format to flv, and outputs to the twitch RTMP url<br />
|}</div>Zorfmorfhttps://wiki.archlinux.org/index.php?title=Streaming_to_twitch.tv&diff=310905Streaming to twitch.tv2014-04-19T13:14:33Z<p>Zorfmorf: /* Ffmpeg solutions */</p>
<hr />
<div>[[Category:Streaming]]<br />
Twitch.tv is one of the more popular [https://en.wikipedia.org/wiki/Real_Time_Messaging_Protocol RTMP] based streaming services offered. As [[Steam]] has a Linux client available, some people may be in search of solutions to stream their games or Linux desktop. As there are no well known Linux broadcasting programs just yet, most solutions at this point are CLI based. The info included here should serve as a list of such solutions. <br />
<br />
==Twitch streaming Guidelines==<br />
''From'' [http://help.twitch.tv/customer/portal/articles/1253460-broadcast-requirements Twitch.tv support]: <br />
<br />
'''Video Requirements'''<br />
* Codec: H.264 (x264)<br />
* Mode: Strict CBR<br />
* Keyframe Interval: 2 seconds<br />
<br />
'''Audio Requirements'''<br />
* Codec: AAC-LC or MP3, Stereo or Mono<br />
* Maximum bit rate: 160 kbps (AAC), 128 kbps (MP3)<br />
* Sampling frequency: any (AAC), 44.1 KHz (MP3)<br />
<br />
'''Other Requirements'''<br />
<br />
Not listed on their page is a requirement of the [https://en.wikipedia.org/wiki/YUV#Y.27UV420p_.28and_Y.27V12_or_YV12.29_to_RGB888_conversion Y'UV420p pixel format], as Y'UV444 is not widely supported just yet. <br />
<br />
==GUI solutions==<br />
[https://aur.archlinux.org/packages/castawesome/ Castawesome] is a Gtk3 frontend for ffmpeg streaming with builtin Twitch.tv support.<br />
<br />
==Ffmpeg solutions==<br />
These solutions revolve around making use of the [[FFmpeg]] package:<br />
===.bashrc script method===<br />
One method of streaming to twitch using FFMPEG makes use of a simple script that is placed in a user's ~/.bashrc file. this script supports streaming of both desktop and OpenGL elements. <br />
* Depending on your internet upload speed, you may need to modify the Ffmpeg parameters. use the breakdown list for reference.<br />
<br />
<br />
The script can be used by typing <br />
streaming streamkeyhere<br />
into a terminal. sound sources can be manipulated by using pavucontrol.<br />
The .bashrc script is as follows:<br />
<br />
<br />
streaming() {<br />
INRES="1920x1080" # input resolution<br />
OUTRES="1920x1080" # output resolution<br />
FPS="15" # target FPS<br />
GOP="30" # FPS x2, i-frame interval<br />
GOPMIN="15" # should be equal to fps, min i-frame interval<br />
THREADS="2" # max 6<br />
CBR="1000k" # constant bitrate (should be between 1000k - 3000k)<br />
QUALITY="ultrafast" # one of the many FFMPEG preset<br />
AUDIO_RATE="44100"<br />
STREAM_KEY="$1" # use the terminal command Streaming streamkeyhere to stream your video to twitch or justin<br />
SERVER="live-fra" # twitch server in frankfurt, see http://bashtech.net/twitch/ingest.php for list<br />
<br />
ffmpeg -f x11grab -s "$INRES" -r "$FPS" -i :0.0 -f alsa -i pulse -f flv -ac 2 -ar $AUDIO_RATE \<br />
-vcodec libx264 -g $GOP -keyint_min $GOPMIN -b $CBR -minrate $CBR -maxrate $CBR -pix_fmt yuv420p\<br />
-s $OUTRES -preset $QUALITY -tune film -acodec libmp3lame -threads $THREADS -strict normal \<br />
-bufsize $CBR "rtmp://$SERVER.twitch.tv/app/$STREAM_KEY"<br />
<br />
}<br />
<br />
{| class="wikitable"<br />
|+ '''Ffmpeg Parameter breakdown'''<br />
! Parameter !! Description<br />
|-<br />
| ffmpeg || The converter<br />
|-<br />
| -f x11grab || -f forces input to be from x11grab<br />
|-<br />
| -s "$INRES" || -s sets a specific image size, relying on the variable $INRES<br />
|-<br />
| -r "$FPS" || -r sets framerate to be the value equal to $FPS<br />
|-<br />
| -i :0.0 || -i gets input, in this case its pulling in screen :0.0 from x11. Can be adjusted, e.g. -i :0.0+500,100 to start at screenpos 500/100<br />
|-<br />
| -ab 96k || -ab sets audio bitrate to 96k. '''-b:a''' is the alternate form of this command<br />
|-<br />
| -f alsa || forces input(?) to be from alsa<br />
|-<br />
| -ac 2 || sets audio channels to 2<br />
|-<br />
| -i pulse || gets input from pulse<br />
|-<br />
| -vcodec libx264 || sets video codec to libx264<br />
|-<br />
| -crf 23 || sets the ffmpeg constant rate factor to 23<br />
|-<br />
| -preset "$QUAL" || sets the preset compression quality and speed<br />
|-<br />
| -s "1280x720" || specifies size of image to be 720p<br />
|-<br />
| -acodec libmp3lame || sets audio codec to use libmp3lame<br />
|-<br />
| -ar 44100 || sets audio rate to 44100 hz<br />
|-<br />
| -threads 0 || sets cpu threads to start, 0 autostarts threads based on cpu cores<br />
|-<br />
| -pix_fmt yuv420p || sets pixel format to Y'UV420p. Otherwise by default Y'UV444 is used and is incompatible with twitch<br />
|-<br />
| -f flv "$URL" || forces format to flv, and outputs to the twitch RTMP url<br />
|}</div>Zorfmorfhttps://wiki.archlinux.org/index.php?title=Streaming_to_twitch.tv&diff=310904Streaming to twitch.tv2014-04-19T13:12:50Z<p>Zorfmorf: Updated bashscript to support CBR as requested by twitch</p>
<hr />
<div>[[Category:Streaming]]<br />
Twitch.tv is one of the more popular [https://en.wikipedia.org/wiki/Real_Time_Messaging_Protocol RTMP] based streaming services offered. As [[Steam]] has a Linux client available, some people may be in search of solutions to stream their games or Linux desktop. As there are no well known Linux broadcasting programs just yet, most solutions at this point are CLI based. The info included here should serve as a list of such solutions. <br />
<br />
==Twitch streaming Guidelines==<br />
''From'' [http://help.twitch.tv/customer/portal/articles/1253460-broadcast-requirements Twitch.tv support]: <br />
<br />
'''Video Requirements'''<br />
* Codec: H.264 (x264)<br />
* Mode: Strict CBR<br />
* Keyframe Interval: 2 seconds<br />
<br />
'''Audio Requirements'''<br />
* Codec: AAC-LC or MP3, Stereo or Mono<br />
* Maximum bit rate: 160 kbps (AAC), 128 kbps (MP3)<br />
* Sampling frequency: any (AAC), 44.1 KHz (MP3)<br />
<br />
'''Other Requirements'''<br />
<br />
Not listed on their page is a requirement of the [https://en.wikipedia.org/wiki/YUV#Y.27UV420p_.28and_Y.27V12_or_YV12.29_to_RGB888_conversion Y'UV420p pixel format], as Y'UV444 is not widely supported just yet. <br />
<br />
==GUI solutions==<br />
[https://aur.archlinux.org/packages/castawesome/ Castawesome] is a Gtk3 frontend for ffmpeg streaming with builtin Twitch.tv support.<br />
<br />
==Ffmpeg solutions==<br />
These solutions revolve around making use of the [[FFmpeg]] package:<br />
===.bashrc script method===<br />
One method of streaming to twitch using FFMPEG makes use of a simple script that is placed in a user's ~/.bashrc file. this script supports streaming of both desktop and OpenGL elements. <br />
* Depending on your internet upload speed, you may need to modify the Ffmpeg parameters. use the breakdown list for reference.<br />
<br />
<br />
The script can be used by typing <br />
streaming streamkeyhere<br />
into a terminal. sound sources can be manipulated by using pavucontrol.<br />
The .bashrc script is as follows:<br />
<br />
<br />
streaming() {<br />
INRES="1920x1080" # input resolution<br />
OUTRES="1920x1080" # output resolution<br />
FPS="15" # target FPS<br />
GOP="30" # FPS x2, i-frame interval<br />
GOPMIN="15" # should be equal to fps, min i-frame interval<br />
THREADS="2" # max 6<br />
CBR="1000k" # constant bitrate (should be between 1000k - 3000k)<br />
QUALITY="ultrafast" # one of the many FFMPEG preset<br />
AUDIO_RATE="44100"<br />
STREAM_KEY="$1" # use the terminal command Streaming streamkeyhere to stream your video to twitch or justin<br />
SERVER="live-fra" # twitch server in frankfurt, see http://bashtech.net/twitch/ingest.php for list<br />
<br />
ffmpeg -f x11grab -s "$INRES" -r "$FPS" -i :0.0 -f alsa -i pulse -f flv -ac 2 -ar $AUDIO_RATE \<br />
-vcodec libx264 -g $GOP -keyint_min $GOPMIN -b $CBR -minrate $CBR -maxrate $CBR -pix_fmt yuv420p\<br />
-s $OUTRES -preset $QUALITY -tune film -acodec libmp3lame -threads $THREADS -strict normal \<br />
-bufsize $CBR "rtmp://$SERVER.twitch.tv/app/$STREAM_KEY"<br />
<br />
}<br />
<br />
{| class="wikitable"<br />
|+ '''Ffmpeg Parameter breakdown'''<br />
! Parameter !! Description<br />
|-<br />
| ffmpeg || The converter<br />
|-<br />
| -f x11grab || -f forces input to be from x11grab<br />
|-<br />
| -s "$INRES" || -s sets a specific image size, relying on the variable $INRES<br />
|-<br />
| -r "$FPS" || -r sets framerate to be the value equal to $FPS<br />
|-<br />
| -i :0.0 || -i gets input, in this case its pulling in screen :0.0 from x11. Can be adjusted, e.g. -i :0.0+500,100 to start at screenpos 500/100<br />
|-<br />
| -ab 96k || -ab sets audio bitrate to 96k. '''-b:a''' is the alternate form of this command<br />
|-<br />
| -f alsa || forces input(?) to be from alsa<br />
|-<br />
| -ac 2 || sets audio channels to 2<br />
|-<br />
| -i pulse || gets input from pulse<br />
|-<br />
| -vcodec libx264 || sets video codec to libx264<br />
|-<br />
| -crf 23 || sets the ffmpeg constant rate factor to 23<br />
|-<br />
| -preset "$QUAL" || sets the preset compression quality and speed<br />
|-<br />
| -s "1280x720" || specifies size of image to be 720p<br />
|-<br />
| -acodec libmp3lame || sets audio codec to use libmp3lame<br />
|-<br />
| -ar 44100 || sets audio rate to 44100 hz<br />
|-<br />
| -threads 0 || sets cpu threads to start, 0 autostarts threads based on cpu cores<br />
|-<br />
| -pix_fmt yuv420p || sets pixel format to Y'UV420p. Otherwise by default Y'UV444 is used and is incompatible with twitch<br />
|-<br />
| -f flv "$URL" || forces format to flv, and outputs to the twitch RTMP url<br />
|}</div>Zorfmorf