<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>gj |</title>
	<atom:link href="https://blog.gaiterjones.com/category/streaming/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.gaiterjones.com/category/streaming/</link>
	<description>gaiterjones</description>
	<lastBuildDate>Mon, 20 Aug 2018 09:10:54 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.4.3</generator>
	<item>
		<title>Twitch Live Streaming with the Packet c2.medium.x86 AMD EPYC</title>
		<link>https://blog.gaiterjones.com/twitch-live-streaming-with-the-packet-c2-medium-x86/</link>
					<comments>https://blog.gaiterjones.com/twitch-live-streaming-with-the-packet-c2-medium-x86/#respond</comments>
		
		<dc:creator><![CDATA[PAJ]]></dc:creator>
		<pubDate>Thu, 05 Jul 2018 13:22:01 +0000</pubDate>
				<category><![CDATA[FFMPEG]]></category>
		<category><![CDATA[FFMPEG Video]]></category>
		<category><![CDATA[Packet]]></category>
		<category><![CDATA[Streaming]]></category>
		<category><![CDATA[Twitch]]></category>
		<category><![CDATA[AMD EPYC]]></category>
		<category><![CDATA[bare metal]]></category>
		<category><![CDATA[ffmpeg]]></category>
		<category><![CDATA[live stream]]></category>
		<category><![CDATA[packet]]></category>
		<category><![CDATA[twitch]]></category>
		<category><![CDATA[vps]]></category>
		<guid isPermaLink="false">http://blog.gaiterjones.com/?p=1941</guid>

					<description><![CDATA[Twitch is a live streaming platform which started life in 2011 as justin.tv and is now owned by Twitch Interactive, a subsidiary of Amazon. The site primarily focuses on video game live...<a class="more-link" href="https://blog.gaiterjones.com/twitch-live-streaming-with-the-packet-c2-medium-x86/" title="Continue reading">Continue reading</a>]]></description>
										<content:encoded><![CDATA[<p><a href="https://twitch.tv">Twitch</a> is a live streaming platform which started life in 2011 as <em>justin.tv</em> and is now owned by Twitch Interactive, a subsidiary of Amazon. The site primarily focuses on video game live streaming but can be used to stream just about anything (within the Twitch terms and conditions) including creative content, &#8220;in real life&#8221; streams, and more recently music broadcasts. Twitch offers successful streamers the means to monetize their streams via two levels of partnership as well as adverts and donations. There are many full time professional game streamers earning a substantial income from Twitch live streaming.</p>
<h1>About a Stream</h1>
<p>Alas &#8211; I am not really a gamer, I played Doom in the 90&#8217;s and that&#8217;s about it. As a hobby music producer and wannabe superstar DJ the live music broadcasts on Twitch were of much more interest to me, and as a web developer, programmer, the technology behind the live streams also interested me.</p>
<p>Most game streamers on Twitch require at least two fairly high powered Windows PC&#8217;s to stream their content live to Twitch, one PC for game play and one PC to capture the game play video content and encode it into a format supported by the Twitch ingest media servers. OBS Studio is a popular f<span>ree and open source software for video recording and live streaming and most of the top streamers have created a <a href="https://www.twitch.tv/directory/game/PLAYERUNKNOWN'S%20BATTLEGROUNDS">very professional looking stream</a> with OBS using overlay graphics and dynamic alerts to provide interaction between the streamer and the viewers. Top streamers regularly attract viewing audiences in the 10s of thousands.</span></p>
<p>Using OBS Studio on my trusty old Macbook Pro I was able to live stream my latest DJ set using a couple of webcams, some audio visualisation graphics and <em>moi</em> the superstar DJ on the decks! After playing for a few hours I had attracted a grand total of 1 viewer and his dog &#8211; but hey it was a <em>lot</em> of fun.</p>
<p>A few weeks later a friend of mine said to me &#8220;<em>man you just don&#8217;t stream enough</em>&#8221; and it was clear that to attract viewers and followers I would have to put in a lot of streaming hours which I just didn&#8217;t have time for.  I thought that some kinda 24/7 automated stream would be cool &#8211; I could stream all day long! I wasn&#8217;t about to go out and buy a new Mac (or god forbid a gaming PC) and attempt to stream 24/7 from my home so I started thinking about other ways to develop a streaming platform that would run (<em>economically</em>) on a hosted unix server.</p>
<h1>ffmpeg</h1>
<p>I&#8217;ve been involved with media streaming projects in the past and was familiar with <a href="https://www.ffmpeg.org/">FFMPEG</a> &#8220;A complete, cross-platform solution to record, convert and stream audio and video&#8221; A quick Google for &#8220;<a href="https://trac.ffmpeg.org/wiki/StreamingGuide"><em>ffmpeg twitch</em></a>&#8221; revealed that FFMPEG can also stream it&#8217;s output to Twitch (and other live stream services &#8211; YouTube, Facebook etc.) and after a few test streams I set about developing my own streaming platform using Docker service containers.</p>
<p>In November 2017 I started streaming <a href="https://twitch.tv/medazzaland">Techno DJ sets 24/7</a>. My goal was to create an interactive Twitch music channel (mostly playing <em>Techno</em> DJ sets) where viewers could interact with the channel by &#8220;<em>liking</em>&#8221; the DJ that was playing and change what was playing by making requests. Other DJ&#8217;s could upload their own sets which would then be reviewed and added to a dynamically changing daily playlist. I wanted the channel to be visually interesting with constantly changing and <em>interesting</em> visuals and dynamic overlays showing what was currently playing and how viewers had recently interacted with the channel. I also wanted to be able to feed audio into the stream relatively dynamically either from static local media files, live feeds &#8211; i.e. me on the sofa or from online sources such as Soundcloud and YouTube.</p>
<p>My Docker live stream environment looks a bit like this:</p>
<figure id="attachment_1946" aria-describedby="caption-attachment-1946" style="width: 714px" class="wp-caption aligncenter"><img fetchpriority="high" decoding="async" src="https://blog.gaiterjones.com/wp-content/uploads/2018/07/livestream-network.png" alt="Livestream Container Diagram" width="714" height="499" class=" wp-image-1946" /><figcaption id="caption-attachment-1946" class="wp-caption-text">Livestream Container Diagram</figcaption></figure>
<p>The media servers create the main audio and background video streams. The stream manager creates dynamic graphic and text overlays based on what is playing, viewer stats, ticker tape messages etc. It also monitors the encoder log files for errors and can restart encoders when required. Similarly the chat bot server interacts with viewers on Twitch accepting commands from the Twitch stream chat IRC channel allowing viewers to see what&#8217;s playing, &#8220;<em>like</em>&#8221; the current DJ or make requests. All the stream data required by the manager and chat bot is either stored in an SQL database or cached using memcached. The encoders &#8211; running ffmpeg in small debian Docker containers &#8211; encode all the stream data &#8211; audio, video, graphic and text overlays into a format accepted by the streaming service provider, i.e. Twitch.</p>
<p>I started developing the docker images and code for my live streaming platform on a VMWare Ubuntu server with access to a fairly good Intel processor. The most processor intensive containers are the media encoders running FFMPEG. Without a dedicated graphics GPU all the rendering needs to be done by the main processor/s. As the quality and frame rate of the stream increase so does the processing power required to encode the stream fast enough to satisfy the streaming service provider. For example YouTube expects a 720p HD stream to have a resolution of 1280&#215;720 and a video bitrate range of  1,500 &#8211; 4,000 Kbps. As my content was relatively static &#8211; no high frame rate game action &#8211; I was able to lower my frames per second to 15 and still produce an acceptable looking 720p HD stream and with some other FFMPEG tweaks I was ready to move the stream to a live server.</p>
<h1>Going Live</h1>
<p>My live server is an 8GB VPS with 4 CPU cores. As soon as I started up the streaming containers everything else running on the server ground to a halt and it was pretty clear that I would need a dedicated server for live streaming.</p>
<p>With RAM and bandwidth not a real issue the VPS just needed enough CPU power to run at least 1 encoder. It took a few upgrades before I found a VPS that could handle the stream without completely maxing out the available processing power and that came within my monthly budget. The live server has been running one Twitch stream for over 6 months without any real problems. Occasionally the CPU maxes out causing the encoder threads to fail usually resulting in a stream &#8220;hang&#8221; or crash &#8211; this is no big problem Docker restarts the crashed server instantly and the stream manager will restart the encoder when errors in the logs are detected.</p>
<p>As I developed the stream I started added more overlays, more graphics and shiny knobs. All things that require more encoder power until I was at a point where I knew I would need to consider a new VPS, especially if I wanted to simultaneously stream to other services such as YouTube.</p>
<figure id="attachment_1955" aria-describedby="caption-attachment-1955" style="width: 1280px" class="wp-caption aligncenter"><a href="https://blog.gaiterjones.com/wp-content/uploads/2018/07/ffmpeg.overlays2.png"><img decoding="async" src="https://blog.gaiterjones.com/wp-content/uploads/2018/07/ffmpeg.overlays2.png" alt="ffmpeg overlays and the ffmpeg command that encodes the live stream" width="1280" height="720" class="wp-image-1955 size-full" /></a><figcaption id="caption-attachment-1955" class="wp-caption-text">ffmpeg overlays and the ffmpeg command that encodes the live stream</figcaption></figure>
<p><iframe width="620" height="378" align="center" src="https://player.twitch.tv/?channel=medazzaland" frameborder="0" allowfullscreen="allowfullscreen" scrolling="no"><span data-mce-type="bookmark" style="display: inline-block; width: 0px; overflow: hidden; line-height: 0;" class="mce_SELRES_start">﻿</span><span data-mce-type="bookmark" style="display: inline-block; width: 0px; overflow: hidden; line-height: 0;" class="mce_SELRES_start">﻿</span></iframe><br />
<em>The Live Stream on Twitch @ 720p HD (15fps)</em></p>
<h1>Introducing the Packet c2.medium.x86</h1>
<p>About this time the nice people at <a href="https://www.packet.net">Packet</a> sent me an email inviting users to test their new <a href="https://www.packet.net/hardware/amd/">AMD EPYC c2.medium.x86</a> bare metal servers and I jumped at the opportunity of trying out my streaming platform on a <em>big beast</em> of a server.</p>
<p>Installing my streaming environment on the c2.medium.x86 was a real breeze. The Packet c2.medium.x86 Ubuntu server deployed in Amsterdam in just a few minutes. I installed Docker and transferred all my data via a remote tar over ssh from my live streaming server to the c2.medium.x86. All my Docker containers built in a few minutes and then it was simply a case of stopping my live stream containers in London and starting the c2.medium.x86 containers in Amsterdam. <em>Et Voila</em>  &#8211; I was streaming from Amsterdam!</p>
<figure id="attachment_1949" aria-describedby="caption-attachment-1949" style="width: 916px" class="wp-caption aligncenter"><img loading="lazy" decoding="async" src="https://blog.gaiterjones.com/wp-content/uploads/2018/07/portainer-screenshot.png" alt="Docker Containers" width="916" height="541" class=" wp-image-1949" /><figcaption id="caption-attachment-1949" class="wp-caption-text">Docker Containers</figcaption></figure>
<p>The c2.medium.x86 really puts the <em><strong>BEAR</strong> </em>into bare metal server &#8211; because it is a beast of a machine with 24 physical cores / 48 hyperthreaded cores at a 2.0 Ghz base clock speed (3.0 Ghz max with turbo). With one encoder running my live Twitch stream the processor overall load was about 1%. You can see ffmpeg using 76% of one hyperthreaded  core below.</p>
<figure id="attachment_1948" aria-describedby="caption-attachment-1948" style="width: 553px" class="wp-caption aligncenter"><img loading="lazy" decoding="async" src="https://blog.gaiterjones.com/wp-content/uploads/2018/07/ffmpeg-1-encoder.png" alt="1 ffmpeg encoder on Packet c2.medium.x86" width="553" height="262" class=" wp-image-1948" /><figcaption id="caption-attachment-1948" class="wp-caption-text">1 ffmpeg encoder on Packet c2.medium.x86</figcaption></figure>
<p>I asked a few questions in the Packet slack community about processor usage and the opinion was that I could probably run another 47 encoders before I maxed out the AMD EPYC processor. That would be 48 unique streams! To test this theory I created another three ffmpeg encoders to give me four concurrent live streams encoding on the AMD EPYC &#8211; 2 on Twitch, 1 on YouTube, 1 on Facebook. With all four encoders running processor utilisation was around 4%. Unfortunately I didn&#8217;t have any more YouTube, Facebook or Twitch accounts to stress the CPU with!</p>
<p>FFMPEG uses multi threading to take advantage of multi core processors, with 4 encoders running you can see lots of ffmpeg processes nicely spread across AMD EPYC hyperthreaded cores.</p>
<figure style="width: 800px" class="wp-caption aligncenter"><img loading="lazy" decoding="async" src="https://blog.gaiterjones.com/dropbox/a-gifs/htop-packet-stream-test.gif" width="800" height="600" alt="HTOP 4 Concurrent Live Streams" class="size-large" /><figcaption class="wp-caption-text">HTOP 4 Concurrent Live Streams on Packet c2.medium.x86 (up 3 days, 2:03, 1 user, load average: 0.39, 0.79, 1.26)</figcaption></figure>
<figure id="attachment_1950" aria-describedby="caption-attachment-1950" style="width: 889px" class="wp-caption aligncenter"><img loading="lazy" decoding="async" src="https://blog.gaiterjones.com/wp-content/uploads/2018/07/4-concurrent-streams.png" alt="4 Concurrent Live Streams" width="889" height="720" class="size-full wp-image-1950" /><figcaption id="caption-attachment-1950" class="wp-caption-text">4 Concurrent Live Streams &#8211; 10% cpu</figcaption></figure>
<h1>Conclusions</h1>
<p>I am no expert when it comes to understanding the architecture of modern servers and processors but I do know that the AMD EPYC running in the <strong>Packet c2.medium.x86</strong> was perfect for live stream encoding with ffmpeg.</p>
<p>Live streaming is becoming very popular across many social media platforms and whilst there are online services available that will multicast your live stream to multiple services there is no reason why you cannot create your own on demand streams broadcasting live content to various platforms either for a live event or for a one time marketing project.</p>
<p>Simply spin up a c2.medium.x86 and let it fly.</p>
<p>I want to thank Packet for giving me the opportunity of testing the c2.medium.x86 Server as part of their <a href="https://www.packet.net/hardware/amd/">AMD EPYC challenge</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.gaiterjones.com/twitch-live-streaming-with-the-packet-c2-medium-x86/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Installing Shoutcast for Ubuntu Linux 12.04 LTS</title>
		<link>https://blog.gaiterjones.com/installing-shoutcast-for-ubuntu/</link>
					<comments>https://blog.gaiterjones.com/installing-shoutcast-for-ubuntu/#comments</comments>
		
		<dc:creator><![CDATA[PAJ]]></dc:creator>
		<pubDate>Fri, 07 Sep 2012 09:29:53 +0000</pubDate>
				<category><![CDATA[Shoutcast]]></category>
		<category><![CDATA[Streaming]]></category>
		<guid isPermaLink="false">http://blog.gaiterjones.com/?p=783</guid>

					<description><![CDATA[I am a great fan of Apples open source streaming server Darwin, however for live streaming I also like to use Shoutcast and Icecast streaming servers as they support many...<a class="more-link" href="https://blog.gaiterjones.com/installing-shoutcast-for-ubuntu/" title="Continue reading">Continue reading</a>]]></description>
										<content:encoded><![CDATA[<p>I am a great fan of Apples open source streaming server <a title="Apple Darwin Streaming Server Compilation &amp; Installation for Linux" href="https://blog.gaiterjones.com/how-to-install-apple-darwin-streaming-server/" target="_blank">Darwin</a>, however for live streaming I also like to use Shoutcast and Icecast streaming servers as they support many more streaming source clients.</p>
<p>With Shoutcast you can create live broadcasts very quickly and reach large audiences cost effectively. I wanted to implement a new Amazon AWS server running Ubuntu 12.04 for a live streaming event and thought I would document the Shoutcast install process as I went along.</p>
<p>The commands below were executed as root, if you do not have root access use the sudo prefix to execute them with superuser privileges.</p>
<h1><strong>DOWNLOAD SHOUTCAST</strong></h1>
<p>Shoutcast does not come already packaged as an installer for Ubuntu so first we want to download the correct version of Shoutcast for our server.</p>
<p>goto <a href="http://www.shoutcast.com/broadcast-tools" target="_blank">http://www.shoutcast.com/broadcast-tools</a> and download the version you require, I need the 64bit version for my 64bit Ubuntu 12.04 Amazon AWS server. The current version at time of writing is SHOUTcast Server v2.0.0.29/posix(linux x64)</p>
<p>Create an application directory for Shoutcast</p>
<p>/home/apps/shoutcast</p>
<p>get the shoutcast package</p>
<p>wget http://download.nullsoft.com/shoutcast/tools/sc_serv2_linux_x64_07_31_2011.tar.gz</p>
<h1>Extract the package</h1>
<p>gzip -d sc_serv2_linux_x64_07_31_2011.tar.gz<br />
tar -xvf sc_serv2_linux_x64_07_31_2011.tar</p>
<p>This will extract the Shoutcast files, you will see the main binary sc_serv, some example config files and folders for logs and documentation.</p>
<p>If you want to start Shoutcast now, simple type ./sc_serv and you will be prompted to choose one of the detected config files. Choose 0 for the basic config file and check if the Shoutcast daemon starts without errors. The most likely startup error will be that it cannot bind the default TCP port as it is already in use, by default shoutcast will use TCP8000.</p>
<h1>CREATE STARTUP SERVICE</h1>
<p>We want to run Shoutcast as a background service that can easily be stopped and started. Use the bash script below and paste it into a new file called shoutcast in /etc/init.d</p>
<p>Modify the script with the correct locations of your sc_serv binary and the configuration file you want to use.</p>
<p>Make the script executable and give it full permissions</p>
<p>chmod +x /etc/init.d/shoutcast<br />
chmod 755 /etc/init.d/shoutcast</p>
<p>Then install shoutcast as a service with</p>
<p>root@ubuntu:/etc/init.d# update-rc.d shoutcast defaults<br />
Adding system startup for /etc/init.d/shoutcast &#8230;<br />
/etc/rc0.d/K20shoutcast -&gt; ../init.d/shoutcast<br />
/etc/rc1.d/K20shoutcast -&gt; ../init.d/shoutcast<br />
/etc/rc6.d/K20shoutcast -&gt; ../init.d/shoutcast<br />
/etc/rc2.d/S20shoutcast -&gt; ../init.d/shoutcast<br />
/etc/rc3.d/S20shoutcast -&gt; ../init.d/shoutcast<br />
/etc/rc4.d/S20shoutcast -&gt; ../init.d/shoutcast<br />
/etc/rc5.d/S20shoutcast -&gt; ../init.d/shoutcast</p>
<h1>Start service</h1>
<p>Check if shoutcast will start and stop using</p>
<p>/etc/init.d/start shoutcast or service shoutcast start</p>
<p>You can confirm shoutcast is running by searching for it&#8217;s running process</p>
<p>ps -ef | grep sc_serv</p>
<p>You can also confirm the server is running by connecting to shoutcast with your browser using</p>
<p>http://server.address:8000/index.html</p>
<figure id="attachment_786" aria-describedby="caption-attachment-786" style="width: 440px" class="wp-caption alignnone"><a href="https://blog.gaiterjones.com/wp-content/uploads/2012/09/screenshot_04.jpg"><img loading="lazy" decoding="async" class="size-medium wp-image-786" title="Shoutcast Admin Page" src="https://blog.gaiterjones.com/wp-content/uploads/2012/09/screenshot_04-440x200.jpg" alt="" width="440" height="200" srcset="https://blog.gaiterjones.com/wp-content/uploads/2012/09/screenshot_04-440x200.jpg 440w, https://blog.gaiterjones.com/wp-content/uploads/2012/09/screenshot_04-620x283.jpg 620w, https://blog.gaiterjones.com/wp-content/uploads/2012/09/screenshot_04.jpg 942w" sizes="(max-width: 440px) 100vw, 440px" /></a><figcaption id="caption-attachment-786" class="wp-caption-text">Shoutcast server admin page</figcaption></figure>
<p>&nbsp;</p>
<p>TCP 8000 is the default listener port used by Shoutcast, note, if your server is already using TCP8000 select another port for Shoutcast and configure it in your config file with e.g. portbase=8010</p>
<p>Restart shoutcast and connect using http://server.address:8010/index.html</p>
<p>Ensure that you change the default changeme admin  passwords in the configuration file.</p>
<p>To configure your streaming mount points simply create configuration entries for each live stream you require</p>
<p>streamid_1=1<br />
streampath_1=/livestream1<br />
streampassword_1=password<br />
streamid_2=2<br />
streampath_2=/livestream2<br />
streampassword_2=password</p>
<h1>Test streaming</h1>
<p>Assuming Shoutcast now starts correctly with your configuration file and you can connect to the admin page with your browser you should configure your streaming client to connect to the server.</p>
<p>The client will normally specify the server type as shoutcast, and then will require the server address and password for the mountpoint. In some cases you may need to specify the mount point in the client too as configured.</p>
<p>Here is a server config example from Nicecast connecting on TCP8002.</p>
<figure id="attachment_784" aria-describedby="caption-attachment-784" style="width: 440px" class="wp-caption alignnone"><a href="https://blog.gaiterjones.com/wp-content/uploads/2012/09/screenshot_01.jpg"><img loading="lazy" decoding="async" class="size-medium wp-image-784" title="Shoutcast Streaming with Nicecast" src="https://blog.gaiterjones.com/wp-content/uploads/2012/09/screenshot_01-440x366.jpg" alt="" width="440" height="366" srcset="https://blog.gaiterjones.com/wp-content/uploads/2012/09/screenshot_01-440x366.jpg 440w, https://blog.gaiterjones.com/wp-content/uploads/2012/09/screenshot_01.jpg 500w" sizes="(max-width: 440px) 100vw, 440px" /></a><figcaption id="caption-attachment-784" class="wp-caption-text">Nicecast server config for Shoutcast</figcaption></figure>
<p>&nbsp;</p>
<p>With your streaming client source connected, you can then publish the stream address as http://server.address:8010/mountpointname</p>
<figure id="attachment_790" aria-describedby="caption-attachment-790" style="width: 440px" class="wp-caption alignnone"><a href="https://blog.gaiterjones.com/wp-content/uploads/2012/09/screenshot_05.jpg"><img loading="lazy" decoding="async" class="size-medium wp-image-790" title="Live Broadcast with Nicecast" src="https://blog.gaiterjones.com/wp-content/uploads/2012/09/screenshot_05-440x195.jpg" alt="" width="440" height="195" srcset="https://blog.gaiterjones.com/wp-content/uploads/2012/09/screenshot_05-440x195.jpg 440w, https://blog.gaiterjones.com/wp-content/uploads/2012/09/screenshot_05.jpg 500w" sizes="(max-width: 440px) 100vw, 440px" /></a><figcaption id="caption-attachment-790" class="wp-caption-text">Broadcasting to Shoutcast using the Nicecast client</figcaption></figure>
<p>&nbsp;</p>
<p>Test you are now streaming live by connecting any media player to the stream url.</p>
<figure id="attachment_791" aria-describedby="caption-attachment-791" style="width: 440px" class="wp-caption alignnone"><a href="https://blog.gaiterjones.com/wp-content/uploads/2012/09/screenshot_06.jpg"><img loading="lazy" decoding="async" class="size-medium wp-image-791" title="Listening to the Live Stream with the VLC Player" src="https://blog.gaiterjones.com/wp-content/uploads/2012/09/screenshot_06-440x225.jpg" alt="" width="440" height="225" srcset="https://blog.gaiterjones.com/wp-content/uploads/2012/09/screenshot_06-440x225.jpg 440w, https://blog.gaiterjones.com/wp-content/uploads/2012/09/screenshot_06.jpg 604w" sizes="(max-width: 440px) 100vw, 440px" /></a><figcaption id="caption-attachment-791" class="wp-caption-text">Listening to the Live Stream with the VLC Player</figcaption></figure>
<p>&nbsp;</p>
<p>Note be sure to configure the stream meta information in your client, shoutcast will reject the streaming client connection if the source URL meta tag is left blank.</p>
<p>&nbsp;</p>
<h1>Startup script</h1>
<p>&nbsp;</p>
<pre class="brush:shell">#!/bin/sh

### BEGIN INIT INFO
# Provides:          Shoutcast application instance
# Required-Start:    $all
# Required-Stop:     $all
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: starts instance of Shoutcast
# Description:       starts instance of Shoutcast using start-stop-daemon
### END INIT INFO#

############################################################################
##  CHANGE THESE VALUES to match your setup
## CONFIG is the fully qualified location of your config file
## DAEMON is the fully qualified location of the sc_serv binary
############################################################################

CONFIG="/home/apps/shoutcast/sc_serv_basic.conf"
DAEMON="/home/apps/shoutcast/sc_serv"

# Check for SHOUTcast binary
test -f $DAEMON || exit 0

# The init commands
case "$1" in
        start)
                echo "Starting SHOUTcast server..."
                $DAEMON $CONFIG  &gt; /dev/null 2&gt;&amp;1 &amp;
                ;;
        stop)
                echo "Stopping SHOUTcast server..."
                kill -9 `ps -C sc_serv -o pid --no-headers`
                ;;
        restart)
                echo "Stopping SHOUTcast server..."
                kill -9 `ps -C sc_serv -o pid --no-headers`
                echo "Starting SHOUTcast server..."
                $DAEMON $CONFIG  &gt; /dev/null 2&gt;&amp;1 &amp;
                ;;
        *)
                echo "usage: /etc/init.d/shoutcast"
                echo "$0 {start | stop | restart}"
                exit 1
                ;;
esac</pre>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.gaiterjones.com/installing-shoutcast-for-ubuntu/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>Facebook fan page video and audio media sharing application demo</title>
		<link>https://blog.gaiterjones.com/facebook-video-audio-media-sharing-application-demo/</link>
					<comments>https://blog.gaiterjones.com/facebook-video-audio-media-sharing-application-demo/#respond</comments>
		
		<dc:creator><![CDATA[PAJ]]></dc:creator>
		<pubDate>Wed, 20 Jun 2012 15:38:10 +0000</pubDate>
				<category><![CDATA[Facebook]]></category>
		<category><![CDATA[Facebook Like Button]]></category>
		<category><![CDATA[Streaming]]></category>
		<guid isPermaLink="false">http://blog.gaiterjones.com/?p=733</guid>

					<description><![CDATA[I wanted to integrate my favourite jQuery based media player into a Facebook application as a way to share audio and video media to promote a Facebook fan page. The...<a class="more-link" href="https://blog.gaiterjones.com/facebook-video-audio-media-sharing-application-demo/" title="Continue reading">Continue reading</a>]]></description>
										<content:encoded><![CDATA[<p><a href="https://blog.gaiterjones.com/wp-content/uploads/2012/06/headphones_icon.jpg"><img loading="lazy" decoding="async" class="hang-2-column     alignnone" title="headphones_icon" src="https://blog.gaiterjones.com/wp-content/uploads/2012/06/headphones_icon-440x340.jpg" alt="" width="185" height="143" /></a>I wanted to integrate my favourite jQuery based media player into a Facebook application as a way to share audio and video media to promote a Facebook fan page.</p>
<p>The deal was to offer audio or video media in return for Liking a Facebook page (although this is optional). I also wanted a rating system for the media which could be used later together with the Social information harvested from users as a marketing opportunity.</p>
<p>A working demonstration is available <a href="https://www.facebook.com/pages/gaiterjones/243428839036258?sk=app_438703899484355" target="_blank">here</a> your comments are very welcome. You will need to connect with the app and like the Facebook page before the media will stream.</p>
<p>The app is written in PHP with a MySQL database, using a few jQuery plugins including jPlayer for the media player and jRating integrated with jPlayer and the database for the rating system.</p>
<p>Media and user information are stored in the database.</p>
<figure id="attachment_734" aria-describedby="caption-attachment-734" style="width: 620px" class="wp-caption alignnone"><a href="https://blog.gaiterjones.com/wp-content/uploads/2012/06/Image1.jpg"><img loading="lazy" decoding="async" class="size-large wp-image-734" title="Facebook audio video media streaming application demo" src="https://blog.gaiterjones.com/wp-content/uploads/2012/06/Image1-620x570.jpg" alt="Facebook audio video media streaming application demo" width="620" height="570" srcset="https://blog.gaiterjones.com/wp-content/uploads/2012/06/Image1-620x570.jpg 620w, https://blog.gaiterjones.com/wp-content/uploads/2012/06/Image1-440x404.jpg 440w, https://blog.gaiterjones.com/wp-content/uploads/2012/06/Image1.jpg 649w" sizes="(max-width: 620px) 100vw, 620px" /></a><figcaption id="caption-attachment-734" class="wp-caption-text">Facebook audio video media streaming application demo</figcaption></figure>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.gaiterjones.com/facebook-video-audio-media-sharing-application-demo/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>FFmpeg Video HOW TO &#8211; How to do everything you want with FFmpeg</title>
		<link>https://blog.gaiterjones.com/ffmpeg-video-how-to/</link>
					<comments>https://blog.gaiterjones.com/ffmpeg-video-how-to/#comments</comments>
		
		<dc:creator><![CDATA[PAJ]]></dc:creator>
		<pubDate>Thu, 19 Jan 2012 14:43:31 +0000</pubDate>
				<category><![CDATA[Darwin Streaming Server]]></category>
		<category><![CDATA[FFMPEG Video]]></category>
		<category><![CDATA[Streaming]]></category>
		<category><![CDATA[ffmpeg]]></category>
		<guid isPermaLink="false">http://blog.gaiterjones.com/?p=651</guid>

					<description><![CDATA[If you want to work with ffmpeg video and audio files forget about buying any cheap commercial convertors (which are probably using FFmpeg anyway) and just take the plunge into...<a class="more-link" href="https://blog.gaiterjones.com/ffmpeg-video-how-to/" title="Continue reading">Continue reading</a>]]></description>
										<content:encoded><![CDATA[<p>If you want to work with <strong>ffmpeg video</strong> and audio files forget about buying any cheap commercial convertors (which are probably using FFmpeg anyway) and just take the plunge into the world of <a href="http://ffmpeg.org/index.html">FFmpeg</a>. It might seem a bit scary at first working just from a command line but there is nothing this impressive &#8220;Swiss Army Knife&#8221; media manipulation application cannot do.</p>
<h1>What is FFMPEG, video and audio</h1>
<p>What is FFmpeg? Simply put, <a href="http://en.wikipedia.org/wiki/FFmpeg">FFmpeg </a>is a Hyper fast <strong>Audio</strong> and <strong>Video</strong> encoder. It is a free software project that &#8220;produces libraries and programs for handling multimedia data. The name of the project comes from the MPEG video standards group, together with &#8220;FF&#8221; for &#8220;<em>fast</em> <em>forward</em>&#8220;.&#8221;</p>
<p>FFmpeg <em>will</em> do everything you want with audio and video but installing it and getting to grips with the command line options can be daunting. Here I will create a very simple list of the most common tasks you will want to do with <strong>FFmpeg video</strong> including command line options showing how to do it.</p>
<h2>Installing ffMPEG  MAC OSX, Linux FOR USE WITH VIDEO AND AUDIO</h2>
<p>The FFmpeg source code compiles and runs on all platforms, but getting the latest build with all the latest codecs and libraries compiled for your operating system can be troublesome. I am working mostly with Linux (Ubuntu) and OSX and found the easiest way to install the latest version of FFmpeg and libraries was to compile the source code myself.</p>
<h2>FFMPEG INSTALL FOR  UBUNTU</h2>
<p>For Ubuntu (10.10, 11.04, 11.10, 12.04) by far the best guide to do this comes from the Ubuntu forums, so I will not document everything use this <a href="https://ffmpeg.org/trac/ffmpeg/wiki/UbuntuCompilationGuide">LINK</a> for the complete guide.</p>
<p>Follow these steps for the Ubuntu install.</p>
<p><strong>Install the Dependencies</strong></p>
<pre class="brush:shell">sudo apt-get remove ffmpeg x264 libx264-dev
sudo apt-get update
sudo apt-get install build-essential checkinstall git libfaac-dev libjack-jackd2-dev \
  libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libsdl1.2-dev libtheora-dev \
  libva-dev libvdpau-dev libvorbis-dev libx11-dev libxfixes-dev texi2html yasm zlib1g-dev</pre>
<p><strong>Install x264</strong></p>
<pre class="brush:shell">cd
git clone git://git.videolan.org/x264
cd x264
./configure --enable-static
make
sudo checkinstall --pkgname=x264 --pkgversion="3:$(./version.sh | \
    awk -F'[" ]' '/POINT/{print $4"+git"$5}')" --backup=no --deldoc=yes \
    --fstrans=no --default</pre>
<p><strong>Install FFmpeg</strong></p>
<pre class="brush:shell">cd
git clone --depth 1 git://source.ffmpeg.org/ffmpeg
cd ffmpeg
./configure --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb \
    --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libx264 \
    --enable-nonfree --enable-postproc --enable-version3 --enable-x11grab
make
sudo checkinstall --pkgname=ffmpeg --pkgversion="5:$(date +%Y%m%d%H%M)-git" --backup=no \
  --deldoc=yes --fstrans=no --default
hash x264 ffmpeg ffplay ffprobe</pre>
<p>&nbsp;</p>
<p>Ignore all the compilation warnings, they are very boring. I first compiled FFMpeg on an Amazon EC2 Micro instance and the compilation took well over an hour. On my 512 Linode it took about 10 mins. Note that the compilation process is processor intensive, if you are doing this on a live server do it out of hours so as not to affect other applications.</p>
<p>The newest source code for FFmpeg is always here</p>
<pre dir="ltr">git clone --depth 1 git://source.ffmpeg.org/ffmpeg</pre>
<h1>FFMPEG MAC OSX LION 10.7.2</h1>
<p>UPDATE &#8211; if you are using Mountain Lion OS X 10.8<a title="FFMPEG does not run under Mountain Lion, X11 and XCode update required" href="https://blog.gaiterjones.com/ffmpeg-does-not-run-under-mountain-lion-x11-and-xcode-update-required/"> check this post</a> out for extra steps required.</p>
<p>For OSX use the <a href="http://mxcl.github.com/homebrew/">Homebrew </a>package manager to compile and install the latest version of FFmpeg. If you need to<a href="https://github.com/mxcl/homebrew/wiki/installation"> install Homebrew </a>run the following from a terminal command line</p>
<pre class="brush:shell">/usr/bin/ruby -e "$(curl -fsSL https://raw.github.com/gist/323731)"</pre>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>==&gt; This script will install:<br />
/usr/local/bin/brew<br />
/usr/local/Library/Formula/&#8230;<br />
/usr/local/Library/Homebrew/&#8230;<br />
==&gt; The following directories will be made group writable:<br />
/usr/local/.<br />
==&gt; The following directories will have their group set to admin:<br />
/usr/local/.</p>
<p>Press enter to continue<br />
==&gt; /usr/bin/sudo /bin/chmod g+rwx /usr/local/.<br />
==&gt; /usr/bin/sudo /usr/bin/chgrp admin /usr/local/.<br />
==&gt; Downloading and Installing Homebrew&#8230;<br />
Warning: Now install Xcode: <a href="http://developer.apple.com/technologies/xcode.html">http://developer.apple.com/technologies/xcode.html<br />
</a>==&gt; Installation successful!</p>
<p>Now type: brew help</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>Homebrew is dependent on XCode, the Apple development application, before you can install any packages with Homebrew install the free XCode app from the Appstore. It is a big application and around a 2GB download so <a href="http://itunes.apple.com/us/app/xcode/id448457090?mt=12">visit the Apps Store</a> and go for a coffee.</p>
<p>With XCode installed you can <a href="https://github.com/mxcl/homebrew/issues/8815">install FFmpeg using brew on OSX 10.7.2</a> with the following command line</p>
<pre>brew install ffmpeg --use-clang</pre>
<h1>MP4Box for MAC and LINUX</h1>
<p>If you will be streaming video using the <a href="http://dss.macosforge.org/">Apple Darwin Streaming Server</a> you will need to hint your video files, install the gpac package using Homebrew (OSX) or apt-get (Linux) to obtain the MP4Box utility for hinting video files.</p>
<p><em>brew install gpac</em></p>
<p><em>apt-get install gpac</em></p>
<p>Remember the MP4Box command is<em> case sensitive</em>, it&#8217;s <strong>MP4Box</strong> not mp4box.</p>
<h1>TEST FFMPEG</h1>
<p>All being well type <em>ffmpeg</em> from your command line and check that the software has installed sucessfully.</p>
<p><em>ffmpeg version git-2012-01-19-1ce8377 Copyright (c) 2000-2012 the FFmpeg developers</em><br />
<em> built on Jan 19 2012 10:42:18 with gcc 4.6.1</em></p>
<h2>HOW TO &#8211; How to do what you want with FFmpeg</h2>
<p>&nbsp;</p>
<h1>Extract Audio from a Video using FFMPEG</h1>
<p>This will extract the audio from a video file &#8211; myvideo.mp4 and create a new 44Khz 2 channel stereo 128Kbps MP3 file.</p>
<pre class="brush:applescript">ffmpeg -i myvideo.mp4 -vn -ar 44100 -ac 2 -ab 128k -f mp3 myvideoaudio.mp3</pre>
<h1>CREATE A Video from an Image file using FFMPEG</h1>
<p>You see this a lot on YouTube and Facebook, people actually want to share audio so they create a video that consists of one still image for the duration of the song. I have done this before with full blown video apps and its a long process for a relatively simple requirement. With FFmpeg its done ultra fast with a simple command line, an image file and an audio file:</p>
<p>Create a 720&#215;576 (PAL) MP4 x264 video myvideo.mp4 from the image myimage.jpg and the audiofile myaudio.mp3</p>
<pre class="brush:shell">ffmpeg -s 720x576 -r 25 -loop 1 -shortest -y -i  myimage.jpg -i  myaudio.mp3 -acodec libfaac -ac 2 -ar 44100 -ab 128k -async 1 -vcodec libx264 -level 1.3 myvideo.mp4</pre>
<p>Here is an example from Uncle Iggy</p>
<p>i-wanna-be-your-dog.jpg =&gt; i-wanna-be-your-dog-mp3 =&gt; myvideo.mp4</p>
<p>Note that I made the image 720&#215;576 pixels to match the encode settings. 25fps is probably overkill here and results in a larger video file.</p>
<pre class="brush:shell">ffmpeg -s 720x576 -r 25 -loop 1 -shortest -y -i  i-wanna-be-your-dog.jpg -i I-Wanna-Be-Your-Dog.mp3 -acodec libfdk_aac -ac 2 -b:a 128k -async 1 -vcodec libx264 myvideo.mp4</pre>
<figure id="attachment_658" aria-describedby="caption-attachment-658" style="width: 440px" class="wp-caption alignnone"><a href="https://blog.gaiterjones.com/wp-content/uploads/2012/01/i-wanna-be-your-dog1.jpg"><img loading="lazy" decoding="async" class="size-medium wp-image-658" title="I Wanna Be Your Dog image 720x576" src="https://blog.gaiterjones.com/wp-content/uploads/2012/01/i-wanna-be-your-dog1-440x330.jpg" alt="" width="440" height="330" srcset="https://blog.gaiterjones.com/wp-content/uploads/2012/01/i-wanna-be-your-dog1-440x330.jpg 440w, https://blog.gaiterjones.com/wp-content/uploads/2012/01/i-wanna-be-your-dog1-620x465.jpg 620w, https://blog.gaiterjones.com/wp-content/uploads/2012/01/i-wanna-be-your-dog1.jpg 768w" sizes="(max-width: 440px) 100vw, 440px" /></a><figcaption id="caption-attachment-658" class="wp-caption-text">I Wanna Be Your Dog jpg image 720&#215;576</figcaption></figure>
<p>I am going to hint this too so I can add it to my Quicktime server and RTSP stream it (click the image for a demo).</p>
<p><em>MP4Box -hint myvideo.mp4</em></p>
<figure id="attachment_659" aria-describedby="caption-attachment-659" style="width: 440px" class="wp-caption alignnone"><a href="/video/myvideo.mp4" target="_blank"><img loading="lazy" decoding="async" class="wp-image-659 size-medium" title="I Wanna Be Your Dog Single Image Video" src="https://blog.gaiterjones.com/wp-content/uploads/2012/01/i-wanna-be-your-dog-video-440x326.jpg" alt="" width="440" height="326" srcset="https://blog.gaiterjones.com/wp-content/uploads/2012/01/i-wanna-be-your-dog-video-440x326.jpg 440w, https://blog.gaiterjones.com/wp-content/uploads/2012/01/i-wanna-be-your-dog-video-620x460.jpg 620w, https://blog.gaiterjones.com/wp-content/uploads/2012/01/i-wanna-be-your-dog-video.jpg 1127w" sizes="(max-width: 440px) 100vw, 440px" /></a><figcaption id="caption-attachment-659" class="wp-caption-text">I Wanna Be Your Dog Single Image Video &#8211; click to view</figcaption></figure>
<p>(Image source &#8211; google images, music from <a href="http://www.google.co.uk/url?sa=t&amp;rct=j&amp;q=iggy%20and%20the%20stooges&amp;source=web&amp;cd=2&amp;ved=0CDsQFjAB&amp;url=http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FThe_Stooges&amp;ei=skYYT5XyMYjHtAbDpM3pDQ&amp;usg=AFQjCNGB_T_Lh440nx_giFFQdjE-IO2t2g&amp;sig2=ZugqHXb8ld8pDSpKs3NKKw">Iggy and the Stooges</a>.)</p>
<p>Now lets add a series of images to the video to make it slightly more interesting. This is a very quick method for creating a slide show type video from a series of images.</p>
<p>We do this by specifying the input parameter with the % wildcard, i.e. image-%3d.jpg where %3d indicates our image will be named image-XXX.jpg, i.e. image001.jpg, image002.jpg, image003.jpg etc.</p>
<p>Forcing FFmpeg to use a framerate of 1 frame per second (-force_fps), our images are shown with a 1 second delay between them and our resulting video at 1fps is relatively small, 4Mb or so, not much larger than the MP3 file.</p>
<p>For a longer delay use two images that are identical together which  would create a 2 second gap, 4 images a 4 second gap etc.</p>
<pre class="brush:shell">ffmpeg -s 720x576 -r 1 -force_fps -loop 1 -shortest -y -i  image%3d.jpg -i I-Wanna-Be-Your-Dog.mp3 -acodec libfdk_aac -ac 2 -b:a 128k -async 1 -vcodec libx264 myvideo.mp4</pre>
<figure id="attachment_666" aria-describedby="caption-attachment-666" style="width: 440px" class="wp-caption alignnone"><a href="/video/myvideo2.mp4"><img loading="lazy" decoding="async" class="size-medium wp-image-666 " title="I Wanna Be Your Dog Video with Multiple Images" src="https://blog.gaiterjones.com/wp-content/uploads/2012/01/i-wanna-be-your-dog-video2-440x322.jpg" alt="" width="440" height="322" srcset="https://blog.gaiterjones.com/wp-content/uploads/2012/01/i-wanna-be-your-dog-video2-440x322.jpg 440w, https://blog.gaiterjones.com/wp-content/uploads/2012/01/i-wanna-be-your-dog-video2-620x454.jpg 620w, https://blog.gaiterjones.com/wp-content/uploads/2012/01/i-wanna-be-your-dog-video2.jpg 1127w" sizes="(max-width: 440px) 100vw, 440px" /></a><figcaption id="caption-attachment-666" class="wp-caption-text">ffmpeg video &#8211; I Wanna Be Your Dog Video with Multiple Images &#8211; click to view</figcaption></figure>
<h1></h1>
<h1>CREATE An FFMPEG VIDEO FROM A PHOTOSHOP IMAGE SEQUENCE</h1>
<p>Photoshop is great for creating titles quickly using the video timeline to render text and images into 25fps image sequence frames that we can quickly convert into video using ffmpeg. To add audio to your clip trim the audio to the length of your video.</p>
<p>Use this command to create the video, you can see the results by clicking the image below.</p>
<pre class="brush:shell">ffmpeg -s 720x576 -r 25 -i  photoshop0%3d.jpg -i sample.mp3 -acodec libfdk_aac -ac 2 -b:a 128k -async 1 -vcodec libx264 myvideo.mp4</pre>
<figure id="attachment_815" aria-describedby="caption-attachment-815" style="width: 440px" class="wp-caption alignnone"><a href="/video/imagesequencevideo.mp4" target="_blank"><img loading="lazy" decoding="async" class="size-medium wp-image-815  " title="Create a video from a photoshop image sequence" src="https://blog.gaiterjones.com/wp-content/uploads/2012/01/screenshot_01-440x326.jpg" alt="" width="440" height="326" srcset="https://blog.gaiterjones.com/wp-content/uploads/2012/01/screenshot_01-440x326.jpg 440w, https://blog.gaiterjones.com/wp-content/uploads/2012/01/screenshot_01-620x460.jpg 620w, https://blog.gaiterjones.com/wp-content/uploads/2012/01/screenshot_01.jpg 854w" sizes="(max-width: 440px) 100vw, 440px" /></a><figcaption id="caption-attachment-815" class="wp-caption-text">Example of a photoshop image sequence video &#8211; click to view</figcaption></figure>
<h1></h1>
<h1>EXTRACT A SINGLE IMAGE FROM A VIDEO USING FFMPEG</h1>
<p>If we want to extract a single frame image file from a video, for example to use as a movie <a title="How to Embed Quicktime Video Correctly in a Web Page" href="https://blog.gaiterjones.com/how-to-embed-quicktime-video-correctly-in-a-web-page/">poster image</a>  use the following command line &#8211;</p>
<p><em>ffmpeg -i myvideo.mp4 -vframes 1 -ss 00:00:05 -f image2 image-%3d.jpg</em></p>
<p>This will extract 1 frame from myvideo.mp4 starting at the fifth second of the video creating the image file image-XXX.jpg.</p>
<h1>BATCH CONVERT video for DARWIN RTSP streaming with ffmpeg</h1>
<p>We want to convert existing media files to stream live with Apples Darwin media server. For a live stream everything in Darwin must be encoded with the same parameters. The best way to do this is to batch convert all your media with FFmpeg. I am going to create a bash script on my Mac to use FFmpeg to encode all MP4 files in a folder to a new MP4 folder. I will encode them to 720&#215;576 (pal) 25fps with 2 channel stereo AAC audio at 128kbps and H.264 video at 768Kbps.</p>
<p>touch a new file mp4768 and make it executable, chmod +x mp4768</p>
<p>Edit the file and paste the following</p>
<pre class="brush:shell">#===================================
#the directory mp4 must be present in the current directory
for f in *.mp4;
do
ffmpeg  -i  "$f" -s 720x576 -r 25 -acodec libfdk_aac -ac 2 -b:a 128k -async 1 -vcodec libx264 -level 1.3 -b:v 768k -bt 768k "mp4/${f%.mp4}.mp4"; done #====================================</pre>
<p>Now copy the files you want to convert into a folder, and create a subfolder called mp4. Run the bash script to convert all the files i.e. /bin/mp4768</p>
<p>Don&#8217;t forget to hint the files afterward for RTSP streaming with Apples Darwin Streaming media server.</p>
<p>This also gives us the interesting option of combining what we have learnt creating videos from image files, to create on the fly content for live Darwin streams using PHP and FFmpeg &#8211; more on that in another post!</p>
<p>If you have more cool <strong>FFmpeg video</strong> usage examples to add to this post please let me know!</p>
<p>&nbsp;</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.gaiterjones.com/ffmpeg-video-how-to/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>How to Embed Quicktime Video Correctly in a Web Page</title>
		<link>https://blog.gaiterjones.com/how-to-embed-quicktime-video-correctly-in-a-web-page/</link>
					<comments>https://blog.gaiterjones.com/how-to-embed-quicktime-video-correctly-in-a-web-page/#comments</comments>
		
		<dc:creator><![CDATA[PAJ]]></dc:creator>
		<pubDate>Mon, 09 Jan 2012 12:49:18 +0000</pubDate>
				<category><![CDATA[Darwin Streaming Server]]></category>
		<category><![CDATA[Quicktime Video]]></category>
		<category><![CDATA[Streaming]]></category>
		<category><![CDATA[darwin streaming server]]></category>
		<category><![CDATA[Quicktime Embed Code]]></category>
		<category><![CDATA[RTSP]]></category>
		<guid isPermaLink="false">http://blog.gaiterjones.com/?p=638</guid>

					<description><![CDATA[As a HUGE David Bowie fan, I like to celebrate his birthday (he was 65 yesterday) with lots of Bowie videos and music. I like to share the videos with...<a class="more-link" href="https://blog.gaiterjones.com/how-to-embed-quicktime-video-correctly-in-a-web-page/" title="Continue reading">Continue reading</a>]]></description>
										<content:encoded><![CDATA[<p><img loading="lazy" decoding="async" class="hang-2-column     alignnone" title="How to embed quicktime video" src="http://images.apple.com/downloads/images/essentials_quicktime20070611.png" alt="" width="120" height="120" />As a <em>HUGE</em> <a href="http://www.davidbowie.com">David Bowie</a> fan, I like to celebrate his birthday (he was 65 yesterday) with lots of Bowie videos and music. I like to share the videos with friends using Apples Darwin streaming server to create a live streaming playlist..Each year I do this I forget how to correctly embed the Quicktime video in html. So after searching around a lot for the best multi browser compatible way to do this here is the <em>correct</em> way to embed Quicktime video into your web site.</p>
<p>My example will embed the video using Apples recommended multi browser html and javascript code,  reference movie file and a poster image.</p>
<p>First, the reference movie file. If you use Quicktime Pro you can get the software to generate a reference file when you encode your movies for the web. The reference file has a .mov file extension but is not a media file instead it passes information to Quicktime to help it determine the best media to play for the client, i.e. low bandwidth version, iPhone version etc. In my case I am streaming all my media through a <a title="Apple Darwin Streaming Server Compilation &amp; Installation for Linux" href="https://blog.gaiterjones.com/how-to-install-apple-darwin-streaming-server/">Darwin Streaming Server </a>using RTSP and will create a reference file that points to the videos on my Darwin server.</p>
<p>The media reference file is accessed from Quicktime via HTTP so needs to be saved on in a publicly accessible area of your site.</p>
<p>In my example I am going to embed Bowies Lets Dance video. The video is saved in my Darwin media folder<em> /home/media/video</em> and is called <strong>davidbowie-lets-dance.mp4.</strong></p>
<p>In my website folder I create a reference file called <strong>davidbowie-lets-dance.mov</strong> and paste the following text into it.</p>
<p><em><strong>RTSPtextRTSP://medazzaland.co.uk:554/video/davidbowie-lets-dance.mp4</strong></em></p>
<p>We need a &#8220;poster&#8221; image to represent the video, this will be shown on the embed page before the video plays, so we simply take a frame from the video and save it in a publicly accessible folder, in this example its called <strong>davidbowie-lets-dance.png</strong></p>
<p>Now the HTML code to embed the video. In the head section we need to include Apples javascript and some styling that is used for the Click Here link on the embedded video.</p>
<pre class="brush:xml">&lt;script src="http://www.apple.com/library/quicktime/scripts/ac_quicktime.js" language="JavaScript" type="text/javascript"&gt;&lt;/script&gt;
&lt;script src="http://www.apple.com/library/quicktime/scripts/qtp_library.js" language="JavaScript" type="text/javascript"&gt;&lt;/script&gt;
&lt;link href="http://www.apple.com/library/quicktime/stylesheets/qtp_library.css" rel="StyleSheet" type="text/css" /&gt;</pre>
<p>And now for the embed code which should go between the body tags of your html</p>
<pre class="brush:xml">	&lt;div id="quicktimevideo"&gt;
		&lt;script type="text/javascript"&gt;&lt;!--
		QT_WritePoster_XHTML('Click to Play - David Bowie - Lets Dance', 'images/davidbowie-lets-dance.png',
			'http://my.medazzaland.co.uk/reference/davidbowie-lets-dance.mov',
			'720', '576', '',
			'controller', 'true',
			'autoplay', 'true',
			'bgcolor', 'black',
			'scale', 'aspect');
	//--&gt;
	&lt;/script&gt;
	&lt;noscript&gt;
	&lt;object width="720" height="576" classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab"&gt;
		&lt;param name="src" value="images/davidbowie-lets-dance.png" /&gt;
		&lt;param name="href" value="http://my.medazzaland.co.uk/reference/davidbowie-lets-dance.mov" /&gt;
		&lt;param name="target" value="myself" /&gt;
		&lt;param name="controller" value="false" /&gt;
		&lt;param name="autoplay" value="false" /&gt;
		&lt;param name="scale" value="aspect" /&gt;
		&lt;embed width="720" height="576" type="video/quicktime" pluginspage="http://www.apple.com/quicktime/download/"
			src="images/davidbowie-lets-dance.png"
			href="http://my.medazzaland.co.uk/reference/davidbowie-lets-dance.mov"
			target="myself"
			controller="false"
			autoplay="false"
			scale="aspect"&gt;
		&lt;/embed&gt;
	&lt;/object&gt;
	&lt;/noscript&gt;

	&lt;/div&gt;</pre>
<p>This code should work across all browsers and will embed the video using the poster image as a link as show below.</p>
<figure id="attachment_639" aria-describedby="caption-attachment-639" style="width: 372px" class="wp-caption alignnone"><a href="http://tv.medazzaland.co.uk/?play=davidbowie-lets-dance"><img loading="lazy" decoding="async" class=" wp-image-639   " title="Embedded Quicktime Video Example" src="https://blog.gaiterjones.com/wp-content/uploads/2012/01/Image1-620x485.jpg" alt="Embedded Quicktime Video Example" width="372" height="291" srcset="https://blog.gaiterjones.com/wp-content/uploads/2012/01/Image1-620x485.jpg 620w, https://blog.gaiterjones.com/wp-content/uploads/2012/01/Image1-440x344.jpg 440w, https://blog.gaiterjones.com/wp-content/uploads/2012/01/Image1.jpg 671w" sizes="(max-width: 372px) 100vw, 372px" /></a><figcaption id="caption-attachment-639" class="wp-caption-text">Embedded Quicktime Video Example</figcaption></figure>
<p>&nbsp;</p>
<p>Notice that the embed code points to the reference .mov file with an http link, the reference file then redirects Quicktime to the correct RTSP link for the video.</p>
<p>If you want to serve up a lot of videos in this way, you can create the reference file on the fly with PHP as I have done with this example &#8211; click the photo above to goto a demo page. The video information, name, title, size etc. are all stored in a database, the PHP script pulls out the video info from the database and creates the reference files and html on the fly.</p>
<p>As a side note, I was unable to compile Darwin from source under the latest version of Ubuntu Server 11.10, I had to use previously compiled files from another Ubuntu server running Ubuntu 8.x for the install.</p>
<p>I am still looking at perfecting the MP4 encoding for Darwin streaming, so more on that another time and Happy Birthday David Bowie!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.gaiterjones.com/how-to-embed-quicktime-video-correctly-in-a-web-page/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		<enclosure url="http://my.medazzaland.co.uk/reference/davidbowie-lets-dance.mov" length="69" type="video/quicktime" />

			</item>
		<item>
		<title>Apple Darwin Streaming Server Compilation &#038; Installation for Linux</title>
		<link>https://blog.gaiterjones.com/how-to-install-apple-darwin-streaming-server/</link>
					<comments>https://blog.gaiterjones.com/how-to-install-apple-darwin-streaming-server/#comments</comments>
		
		<dc:creator><![CDATA[PAJ]]></dc:creator>
		<pubDate>Wed, 07 Sep 2011 11:56:57 +0000</pubDate>
				<category><![CDATA[Darwin Streaming Server]]></category>
		<category><![CDATA[Streaming]]></category>
		<category><![CDATA[darwin streaming server]]></category>
		<category><![CDATA[streaming]]></category>
		<guid isPermaLink="false">http://blog.gaiterjones.com/?p=530</guid>

					<description><![CDATA[DSS no longer compiles and runs new Ubuntu versions. If you want to use Darwin Streaming Server run it as a docker container using my DSS image. If you want...<a class="more-link" href="https://blog.gaiterjones.com/how-to-install-apple-darwin-streaming-server/" title="Continue reading">Continue reading</a>]]></description>
										<content:encoded><![CDATA[<p><img loading="lazy" decoding="async" class="hang-2-column alignnone" title="Half Eaten Fruit" alt="" src="https://blog.gaiterjones.com/wp-content/uploads/2011/09/apple-logo.png" width="150" height="181" /></p>
<p><strong>DSS no longer compiles and runs new Ubuntu versions. If you want to use Darwin Streaming Server run it as a <a href="https://hub.docker.com/r/gaiterjones/darwin-streaming/">docker container using my DSS image</a>.</strong></p>
<p>If you want to know how I compiled DSS 6.0.3 on Ubuntu <em>PRECISE</em> back in the stone age &#8211; read on&#8230;</p>
<p>Over the last few years I have been involved with some projects that required streaming audio and video solutions and I have been working with the Open Source Darwin Streaming Server from Apple running mainly on the Linux platform. DSS will run under Windows but I wouldn&#8217;t recommend it.</p>
<p>The Darwin Streaming Server (DSS) is the open source version of Apples quicktime server technology which is built into Apples OS X Server. DSS can run under Mac OSX, Windows and Linux. The streaming server supports QuickTime Movie (MOV),  MPEG-4 (MP4), and 3GPP (3GP) &#8220;hinted&#8221; files. Support resources for DSS are quite limited so I will start to post information here to document some of the work I have done with DSS, including installation, configuration, use etc.</p>
<p>This first post will document the compilation, installation and testing of the current version of DSS, v6.0.3 under Linux.</p>
<p>The commands below assume you have superuser rights.</p>
<h1>Compilation</h1>
<p>To compile DSS we first need to make sure we have the required packages for the download and compile utilities.</p>
<p>Execute the following as a superuser, or use the sudo prefix command.</p>
<p><em>apt-get install build-essential wget</em></p>
<pre>Need to get 19.6MB of archives.
After this operation, 66.8MB of additional disk space will be used.
Do you want to continue [Y/n]?</pre>
<p>Hit <strong>Y</strong> to download and install the required packages.</p>
<p>Change to a working directory for the download and compilation i.e. /home/DSS and download the DSS 6.0.3 source (31MB) tar file directly to your working folder using wget:</p>
<p><em>wget http://static.macosforge.org/dss/downloads/DarwinStreamingSrvr6.0.3-Source.tar</em></p>
<p>Uncompress the tar file</p>
<p><em>tar -xvf DarwinStreamingSrvr6.0.3-Source.tar</em></p>
<p>Rename the source file directory to allow us to create a patch directory. The patches are required to compile DSS under a 64bit OS, but there is also no harm in applying them if you are using a 32bit OS.</p>
<p><em>mv DarwinStreamingSrvr6.0.3-Source DarwinStreamingSrvr6.0.3-Source.orig</em></p>
<p>Download the first patch file</p>
<p><em>wget http://dss.macosforge.org/trac/raw-attachment/ticket/6/dss-6.0.3.patch</em></p>
<p>Apply the patch</p>
<p><em>patch -p0 &lt; dss-6.0.3.patch</em></p>
<p>Move the source file directory back</p>
<p><em>mv DarwinStreamingSrvr6.0.3-Source.orig DarwinStreamingSrvr6.0.3-Source</em></p>
<p>Download the second patch file</p>
<p>wget http://dss.macosforge.org/trac/raw-attachment/ticket/6/dss-hh-20080728-1.patch</p>
<p>Apply the patch</p>
<p><em>patch -p0 &lt; dss-hh-20080728-1.patch</em></p>
<p>Change into the DSS source file directory</p>
<p><em>cd DarwinStreamingSrvr6.0.3-Source</em></p>
<p>Rename the source install file</p>
<p><em>mv Install Install.orig</em></p>
<p>Get the latest install file</p>
<p><em>wget http://dss.macosforge.org/trac/raw-attachment/ticket/6/Install</em></p>
<p>Set execute permissions on the install file</p>
<p><em>chmod +x Install</em></p>
<p>Compile the source code (dot slash Buildit)</p>
<p><em>./Buildit</em></p>
<pre>-----------------------
Configuring for the Linux i686 platform
Building for Linux.i686 with gcc</pre>
<p>Now is a good time to grab a coffee as the build process could take a few minutes. The various warning messages you will see can be safely ignored and unless you experience another serious error the compilation is completed when the command prompt returns.</p>
<h1>Installation</h1>
<p>First create the qtss user and group required by DSS</p>
<p><em>addgroup -system qtss</em><br />
<em>adduser -system -no-create-home -ingroup qtss qtss</em></p>
<p>and then run the DSS install script. (dot slash <strong>Install</strong> &#8211; case sensitive!)</p>
<p><em>./Install</em></p>
<p>The install script creates the DSS directory structure and copies files and sample media. When complete you will be prompted to create an administrator username and password. Enter the username and password you will use to administer DSS. Confirm the password.</p>
<pre>Adding userName admin
Setup Complete!</pre>
<p>Check permissions for the DSS configuration file in /etc/streaming, it must be writeable or the changes made in the administration pages will fail.</p>
<p><em>chmod 755 /etc/streaming/streamingserver.xml</em></p>
<p>The DSS installation is now complete, and the server should be started! To manually start the server use</p>
<p lang="en-GB"><em>/usr/local/sbin/streamingadminserver.pl</em></p>
<p>If the server is already running you will see</p>
<pre>Failed to start Streaming Admin Server.
Port 1220 is in use by another process.
The Streaming Admin Server may already be running.</pre>
<p>We can also configure DSS to auto start automatically on boot up, to do this download the following script</p>
<p><em>wget http://dss.macosforge.org/trac/raw-attachment/ticket/6/darwin-streaming-server</em></p>
<p>make it executable</p>
<p><em>chmod +x darwin-streaming-server</em></p>
<p>Move the script into /etc/init.d</p>
<p><em>mv darwin-streaming-server /etc/init.d/darwin-streaming-server</em></p>
<p><em></em>and update rc.d to so that it can auto start and respond to start/stop commands.</p>
<p><em>update-rc.d darwin-streaming-server defaults</em></p>
<p>The server can now be started and stopped with</p>
<p>/etc/init.d/darwin-streaming-server stop</p>
<p>/etc/init.d/darwin-streaming-server start</p>
<h1>Configuration</h1>
<p>The administration web service for DSS runs on TCP port 1220, to login to the server start a browser session and navigate to</p>
<p>http://servername-or-ip-address:1220</p>
<p>You will see the DSS login page, login with the username and password you created during the installation and click the Log In button.</p>
<figure id="attachment_531" aria-describedby="caption-attachment-531" style="width: 575px" class="wp-caption alignnone"><a href="https://blog.gaiterjones.com/wp-content/uploads/2011/09/DSS-Image1.jpg"><img loading="lazy" decoding="async" class="size-full wp-image-531" title="Darwin Streaming Server 6.0.3 login page" alt="Darwin Streaming Server 6.0.3 login page" src="https://blog.gaiterjones.com/wp-content/uploads/2011/09/DSS-Image1.jpg" width="575" height="345" srcset="https://blog.gaiterjones.com/wp-content/uploads/2011/09/DSS-Image1.jpg 575w, https://blog.gaiterjones.com/wp-content/uploads/2011/09/DSS-Image1-440x264.jpg 440w" sizes="(max-width: 575px) 100vw, 575px" /></a><figcaption id="caption-attachment-531" class="wp-caption-text">Darwin Streaming Server 6.0.3 login page</figcaption></figure>
<p>&nbsp;</p>
<p>The setup assistant will ask you for a MP3 broadcast password &#8220;The MP3 Broadcast password is required in order to receive MP3 broadcast streams.&#8221;</p>
<p>Enter the MP3 broadcast password you wish to use and click next to continue.</p>
<p>The setup assistant will ask you if you want to enable SSL for admin. &#8220;This will enable encryption between the administration server and the web client. This feature requires that you have a valid streaming server SSL certificate installed.&#8221;</p>
<p>Click the Next button to continue.</p>
<p>The setup assistant will ask you to confirm the Media folder for DSS &#8220;This is the folder or directory in which your media is stored.&#8221; To accept the default media folder (/usr/local/movies/) click the Next button, or enter the path to a new media folder. If you change the media folder make sure you set ownership of the new folder to the qtss user</p>
<p><em>chown -R qtss.root /home/mymediafolder</em></p>
<p>The setup assistant will ask you if you want to use Port 80 for streaming &#8220;This allows you to stream through firewalls.&#8221; Streaming on TCP port 80 instead of default RTSP ports will ensure that streaming clients behind most firewalls that might have none standard ports, such as RTSP blocked, will be able to access the streaming server via TCP Port 80 which is commonly used for HTTP access and is more likely to be permitted through firewalls. I recommend considering this later as you need to be sure that any existing services running on Port 80, i.e. Apache have been modified or stopped before you try and use DSS streaming on Port 80.</p>
<p>Click the Finish button to continue.</p>
<p>The main DSS administration screen will appear and the DSS installation and basic configuration is complete.</p>
<figure id="attachment_532" aria-describedby="caption-attachment-532" style="width: 440px" class="wp-caption alignnone"><a href="https://blog.gaiterjones.com/wp-content/uploads/2011/09/DSS-Image2.jpg"><img loading="lazy" decoding="async" class="size-medium wp-image-532" title="Darwin Server 6.0.3 Main Administrator Screen" alt="Darwin Server 6.0.3 Main Administrator Screen" src="https://blog.gaiterjones.com/wp-content/uploads/2011/09/DSS-Image2-440x360.jpg" width="440" height="360" srcset="https://blog.gaiterjones.com/wp-content/uploads/2011/09/DSS-Image2-440x360.jpg 440w, https://blog.gaiterjones.com/wp-content/uploads/2011/09/DSS-Image2-620x507.jpg 620w, https://blog.gaiterjones.com/wp-content/uploads/2011/09/DSS-Image2.jpg 651w" sizes="(max-width: 440px) 100vw, 440px" /></a><figcaption id="caption-attachment-532" class="wp-caption-text">Darwin Streaming Server 6.0.3 Main Administration Screen</figcaption></figure>
<p>&nbsp;</p>
<p>Make a tarball of your install directory and save it somewhere for future use!</p>
<h1>Testing</h1>
<p>If you look in the default media directory (/usr/local/movies) you will see some test audio and video media files.</p>
<p>i.e. /usr/local/movies/sample_h264_300kbit.mp4</p>
<p>To test your installation and stream one of the example media files open a media player capable of RTSP streaming, i.e. Apple Quicktime Player, VLC and open a new network stream in the player with the address</p>
<p>rtsp://servername-or-ip-address/sample_h264_300kbit.mp4</p>
<p>The 300Kbit h264 sample MP4 file will stream from your server and should play in your media player.</p>
<figure id="attachment_533" aria-describedby="caption-attachment-533" style="width: 252px" class="wp-caption alignnone"><img loading="lazy" decoding="async" title="Streaming a sample media file" alt="Streaming a sample media file" src="https://blog.gaiterjones.com/wp-content/uploads/2011/09/DSS-Image3-315x440.jpg" width="252" height="352" /><figcaption id="caption-attachment-533" class="wp-caption-text">Streaming a sample media file with VLC Player</figcaption></figure>
<p>&nbsp;</p>
<p>DSS Uses the following default directories for config, playlists, logs etc.</p>
<p>/usr/local/sbin/Darwin Streaming Server &#8212;- Server Software<br />
/usr/local/sbin/streamingadminserver.pl &#8212;- Web Frontend<br />
/etc/streaming &#8212;- Configuration Directory<br />
/etc/streaming/streamingserver.xml &#8212;- Configuration File<br />
/var/streaming/logs &#8212;- Logs<br />
/usr/local/movies &#8212;- Default media directory</p>
<p>I will look at configuring the server further and preparing media for streaming in another blog post.</p>
<h1></h1>
<h1>Further Resources</h1>
<p>&nbsp;</p>
<p>Looking for a media player for darwin mp3 streams &#8211; check out the facebook darwin media tab demo on my <a href="http://www.facebook.com/pages/gaiterjones/243428839036258" target="_blank" rel="noopener">facebook</a> page.</p>
<p><a href="http://dss.macosforge.org/">http://dss.macosforge.org/</a></p>
<p><a href="http://ubuntuforums.org/archive/index.php/t-651556.html">http://ubuntuforums.org/archive/index.php/t-651556.html</a></p>
<p><a href="http://lists.apple.com/mailman/listinfo2/streaming-server-users">http://lists.apple.com/mailman/listinfo2/streaming-server-users</a></p>
<p><a href="http://dss.macosforge.org/post/40/">http://dss.macosforge.org/post/40/</a></p>
<p><a href="http://soundscreen.com/streaming/">http://soundscreen.com/streaming/</a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.gaiterjones.com/how-to-install-apple-darwin-streaming-server/feed/</wfw:commentRss>
			<slash:comments>9</slash:comments>
		
		
			</item>
	</channel>
</rss>
