<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.xiph.org/index.php?action=history&amp;feed=atom&amp;title=Icecast_Server%2FStreaming_WebM_to_Icecast_with_FFmpeg</id>
	<title>Icecast Server/Streaming WebM to Icecast with FFmpeg - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.xiph.org/index.php?action=history&amp;feed=atom&amp;title=Icecast_Server%2FStreaming_WebM_to_Icecast_with_FFmpeg"/>
	<link rel="alternate" type="text/html" href="https://wiki.xiph.org/index.php?title=Icecast_Server/Streaming_WebM_to_Icecast_with_FFmpeg&amp;action=history"/>
	<updated>2026-05-03T12:38:30Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.1</generator>
	<entry>
		<id>https://wiki.xiph.org/index.php?title=Icecast_Server/Streaming_WebM_to_Icecast_with_FFmpeg&amp;diff=16154&amp;oldid=prev</id>
		<title>Remjey at 20:52, 12 November 2015</title>
		<link rel="alternate" type="text/html" href="https://wiki.xiph.org/index.php?title=Icecast_Server/Streaming_WebM_to_Icecast_with_FFmpeg&amp;diff=16154&amp;oldid=prev"/>
		<updated>2015-11-12T20:52:07Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 20:52, 12 November 2015&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l23&quot;&gt;Line 23:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 23:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=== Choosing a value for -g ===&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=== Choosing a value for -g ===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The value of the &amp;lt;code&amp;gt;-g&amp;lt;/code&amp;gt; parameter &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;is &lt;/del&gt;a compromise between latency and bandwidth. A higher value will save bandwidth and increase latency. However, a &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;huge &lt;/del&gt;value will have little benefits for the bandwidth while causing very high latency. It is advised to use a 5 to 10 seconds GOP period. The &amp;lt;code&amp;gt;-g&amp;lt;/code&amp;gt; parameters takes a number of frames as &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;his &lt;/del&gt;value, so if you have a framerate of 30 want a GOP period of 5 seconds, you can set &amp;lt;code&amp;gt;-g&amp;lt;/code&amp;gt; to 150 (which is 5 × 30). Don’t forget to update &amp;lt;code&amp;gt;-cluster_time_limit&amp;lt;/code&amp;gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The value of the &amp;lt;code&amp;gt;-g&amp;lt;/code&amp;gt; parameter &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;sets the maximum period betwoon two key frames. Its value should be &lt;/ins&gt;a compromise between latency and bandwidth&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;, because key frames occupy more space whilst being of lower quality because they don’t use the previous images as reference. However periodic key frames are necessary to bootstrap the video decoder when a client connects to the stream after the beginning&lt;/ins&gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;A higher value &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;of the &amp;lt;code&amp;gt;-g&amp;lt;/code&amp;gt; parameter &lt;/ins&gt;will save bandwidth and increase latency. However, a value &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;too high &lt;/ins&gt;will have little benefits for the bandwidth while causing very high latency. It is advised to use a 5 to 10 seconds GOP period. The &amp;lt;code&amp;gt;-g&amp;lt;/code&amp;gt; parameters takes a number of frames as &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;its &lt;/ins&gt;value, so if you have a framerate of 30 &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;and &lt;/ins&gt;want a GOP period of 5 seconds, you can set &amp;lt;code&amp;gt;-g&amp;lt;/code&amp;gt; to 150 (which is 5 × 30). Don’t forget to update &amp;lt;code&amp;gt;-cluster_time_limit&amp;lt;/code&amp;gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== What it takes to make FFmpeg generate a compatible WebM stream ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== What it takes to make FFmpeg generate a compatible WebM stream ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;WebM streams are made of clusters, each one containing a number of frames of every track (video, audio, subtitles…). Icecast will synchronise each clients’ stream with a cluster. As of writing this, Firefox and Chrome will fail to play a stream when the first cluster received after connecting to a stream contains no key frame. FFmpeg creates small clusters by default, so the probability of a cluster containing a key frame is low, thus the browser will often fail to open the stream. One could increase the number of key frames, but that would cause high bandwidth usage and low quality video. The trick is making FFmpeg generate larger clusters with an adequate maximum period between key frames so that each cluster contains at least one key frame.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;WebM streams are made of clusters, each one containing a number of frames of every track (video, audio, subtitles…). Icecast will synchronise each clients’ stream with a cluster. As of writing this, Firefox and Chrome will fail to play a stream when the first cluster received after connecting to a stream contains no key frame. FFmpeg creates small clusters by default, so the probability of a cluster containing a key frame is low, thus the browser will often fail to open the stream. One could increase the number of key frames, but that would cause high bandwidth usage and low quality video. The trick is making FFmpeg generate larger clusters with an adequate maximum period between key frames so that each cluster contains at least one key frame.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key xiphwiki:diff:1.41:old-16153:rev-16154:php=table --&gt;
&lt;/table&gt;</summary>
		<author><name>Remjey</name></author>
	</entry>
	<entry>
		<id>https://wiki.xiph.org/index.php?title=Icecast_Server/Streaming_WebM_to_Icecast_with_FFmpeg&amp;diff=16153&amp;oldid=prev</id>
		<title>Remjey at 20:43, 12 November 2015</title>
		<link rel="alternate" type="text/html" href="https://wiki.xiph.org/index.php?title=Icecast_Server/Streaming_WebM_to_Icecast_with_FFmpeg&amp;diff=16153&amp;oldid=prev"/>
		<updated>2015-11-12T20:43:45Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 20:43, 12 November 2015&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l7&quot;&gt;Line 7:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 7:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Streaming a live webcam with sound ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Streaming a live webcam with sound ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This configuration &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;works for me on &lt;/del&gt;Linux&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;, but &lt;/del&gt;must be adapted &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;to &lt;/del&gt;your hardware and operating system. As explained in next section, &amp;lt;code&amp;gt;-cluster_time_limit&amp;lt;/code&amp;gt; should always have a value (in milliseconds) greater than the value of &amp;lt;code&amp;gt;-g&amp;lt;/code&amp;gt; divided by the framerate. If your framerate is 30 and &amp;lt;code&amp;gt;-g&amp;lt;/code&amp;gt; is 150, then &amp;lt;code&amp;gt;-cluster_time_limit&amp;lt;/code&amp;gt; should be greater than &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;5K&lt;/del&gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This configuration &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;is a &lt;/ins&gt;Linux &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;example and &lt;/ins&gt;must be adapted &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;for &lt;/ins&gt;your hardware and operating system. As explained in next section, &amp;lt;code&amp;gt;-cluster_time_limit&amp;lt;/code&amp;gt; should always have a value (in milliseconds) greater than the value of &amp;lt;code&amp;gt;-g&amp;lt;/code&amp;gt; divided by the framerate &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;times 1000&lt;/ins&gt;. If your framerate is 30 and &amp;lt;code&amp;gt;-g&amp;lt;/code&amp;gt; is 150, then &amp;lt;code&amp;gt;-cluster_time_limit&amp;lt;/code&amp;gt; should be greater than &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;5000 (which is (150 ÷ 30) × 1000 milliseconds)&lt;/ins&gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;ffmpeg \&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;ffmpeg \&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   -f v4l2 -video_size 640x480 -framerate &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;15 &lt;/del&gt;-i /dev/video0 \&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   -f v4l2 -video_size 640x480 -framerate &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;30 &lt;/ins&gt;-i /dev/video0 \&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   -f alsa -i default \&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   -f alsa -i default \&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   -f webm -cluster_size_limit 2M -cluster_time_limit &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;5K &lt;/del&gt;-content_type video/webm \&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   -f webm -cluster_size_limit 2M -cluster_time_limit &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;5100 &lt;/ins&gt;-content_type video/webm \&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   -c:a libvorbis -b:a 96K \&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   -c:a libvorbis -b:a 96K \&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   -c:v libvpx -b:v 1.5M -crf 30 -g &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;70 &lt;/del&gt;-deadline good -threads 4 \&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   -c:v libvpx -b:v 1.5M -crf 30 -g &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;150 &lt;/ins&gt;-deadline good -threads 4 \&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   icecast://user:password@server:port/stream_name&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   icecast://user:password@server:port/stream_name&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;The value of &amp;lt;code&amp;gt;-cluster_size_limit&amp;lt;/code&amp;gt; must be set to a very high value that will never be reached. In this configuration, 5100 milliseconds of throughput at the maximum bandwidth shouldn’t make more than 1MB so 2M is okay.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;=== Choosing a value for -g ===&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;The value of the &amp;lt;code&amp;gt;-g&amp;lt;/code&amp;gt; parameter is a compromise between latency and bandwidth. A higher value will save bandwidth and increase latency. However, a huge value will have little benefits for the bandwidth while causing very high latency. It is advised to use a 5 to 10 seconds GOP period. The &amp;lt;code&amp;gt;-g&amp;lt;/code&amp;gt; parameters takes a number of frames as his value, so if you have a framerate of 30 want a GOP period of 5 seconds, you can set &amp;lt;code&amp;gt;-g&amp;lt;/code&amp;gt; to 150 (which is 5 × 30). Don’t forget to update &amp;lt;code&amp;gt;-cluster_time_limit&amp;lt;/code&amp;gt;.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== What it takes to make FFmpeg generate a compatible WebM stream ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== What it takes to make FFmpeg generate a compatible WebM stream ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;WebM streams are made of clusters, each one containing a number of frames of every track (video, audio, subtitles…). Icecast will synchronise each clients’ stream with a cluster. As of writing this, Firefox and Chrome will fail to play a stream when the first cluster received after connecting to a stream &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;lacks a &lt;/del&gt;key frame. FFmpeg &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;by default &lt;/del&gt;creates small clusters so the probability of a cluster containing a key frame is low. One could increase the number of key frames, but would &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;suffer &lt;/del&gt;high bandwidth usage and low quality. The trick is making FFmpeg generate larger clusters &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;and setting &lt;/del&gt;an adequate maximum period between key frames so that each cluster contains at least one key frame.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;WebM streams are made of clusters, each one containing a number of frames of every track (video, audio, subtitles…). Icecast will synchronise each clients’ stream with a cluster. As of writing this, Firefox and Chrome will fail to play a stream when the first cluster received after connecting to a stream &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;contains no &lt;/ins&gt;key frame. FFmpeg creates small clusters &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;by default, &lt;/ins&gt;so the probability of a cluster containing a key frame is low&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;, thus the browser will often fail to open the stream&lt;/ins&gt;. One could increase the number of key frames, but &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;that &lt;/ins&gt;would &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;cause &lt;/ins&gt;high bandwidth usage and low quality &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;video&lt;/ins&gt;. The trick is making FFmpeg generate larger clusters &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;with &lt;/ins&gt;an adequate maximum period between key frames so that each cluster contains at least one key frame.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key xiphwiki:diff:1.41:old-16148:rev-16153:php=table --&gt;
&lt;/table&gt;</summary>
		<author><name>Remjey</name></author>
	</entry>
	<entry>
		<id>https://wiki.xiph.org/index.php?title=Icecast_Server/Streaming_WebM_to_Icecast_with_FFmpeg&amp;diff=16148&amp;oldid=prev</id>
		<title>Remjey: Created page with &quot;{{IcecastThirdParty}}  == What is FFmpeg? ==  [http://ffmpeg.org/ FFmpeg] is a very versatile command-line tool to decode, capture, encode or modify audio and video media. It...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.xiph.org/index.php?title=Icecast_Server/Streaming_WebM_to_Icecast_with_FFmpeg&amp;diff=16148&amp;oldid=prev"/>
		<updated>2015-11-11T20:02:28Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;{{IcecastThirdParty}}  == What is FFmpeg? ==  [http://ffmpeg.org/ FFmpeg] is a very versatile command-line tool to decode, capture, encode or modify audio and video media. It...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{IcecastThirdParty}}&lt;br /&gt;
&lt;br /&gt;
== What is FFmpeg? ==&lt;br /&gt;
&lt;br /&gt;
[http://ffmpeg.org/ FFmpeg] is a very versatile command-line tool to decode, capture, encode or modify audio and video media. It supports being a source for several streaming servers including Icecast. The resulting stream can be read from a simple [http://www.w3schools.com/TAgs/tag_video.asp HTML5 video tag] in Firefox and Chrome.&lt;br /&gt;
&lt;br /&gt;
== Streaming a live webcam with sound ==&lt;br /&gt;
&lt;br /&gt;
This configuration works for me on Linux, but must be adapted to your hardware and operating system. As explained in next section, &amp;lt;code&amp;gt;-cluster_time_limit&amp;lt;/code&amp;gt; should always have a value (in milliseconds) greater than the value of &amp;lt;code&amp;gt;-g&amp;lt;/code&amp;gt; divided by the framerate. If your framerate is 30 and &amp;lt;code&amp;gt;-g&amp;lt;/code&amp;gt; is 150, then &amp;lt;code&amp;gt;-cluster_time_limit&amp;lt;/code&amp;gt; should be greater than 5K.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ffmpeg \&lt;br /&gt;
  -f v4l2 -video_size 640x480 -framerate 15 -i /dev/video0 \&lt;br /&gt;
  -f alsa -i default \&lt;br /&gt;
  -f webm -cluster_size_limit 2M -cluster_time_limit 5K -content_type video/webm \&lt;br /&gt;
  -c:a libvorbis -b:a 96K \&lt;br /&gt;
  -c:v libvpx -b:v 1.5M -crf 30 -g 70 -deadline good -threads 4 \&lt;br /&gt;
  icecast://user:password@server:port/stream_name&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== What it takes to make FFmpeg generate a compatible WebM stream ==&lt;br /&gt;
&lt;br /&gt;
WebM streams are made of clusters, each one containing a number of frames of every track (video, audio, subtitles…). Icecast will synchronise each clients’ stream with a cluster. As of writing this, Firefox and Chrome will fail to play a stream when the first cluster received after connecting to a stream lacks a key frame. FFmpeg by default creates small clusters so the probability of a cluster containing a key frame is low. One could increase the number of key frames, but would suffer high bandwidth usage and low quality. The trick is making FFmpeg generate larger clusters and setting an adequate maximum period between key frames so that each cluster contains at least one key frame.&lt;/div&gt;</summary>
		<author><name>Remjey</name></author>
	</entry>
</feed>