El Cauce / Video streaming shenanigans
Ah video streaming. The internet has enabled us all our capacity as content creators and publishers. During this wonderful interesting decade we saw what was once concepts of aftertought grow in to a respectable publishing medium. Any whacko with a camera can record that very instant and publish it immediately. The video revolution first going mainstream with Youtube, then its clones, rising up to the challenge with user created content through Ustream, and justin.tv and finally being perfected in podcasting ventures like TWiT.tv & Revision3, has secured its establishment as a viable publishing platform. But it's not for the bandwidth impaired.
Enter the broadband situation of Puerto Rico
In the west (from here on referring to the U.S. and Puerto Rico) the broadband situation is in a decadent state. For over a few decades, the business models of telecommunications have been the total opposite of what a society with a capitalist economic model requires. In its current form, local governments allow communications franchises to have geographical monopolies. The reasoning behind this model is that if you guarantee the seemingly benevolent corporation to operate without any market competition, the government can demand that there is a guarantee that the telecommunications infrastructure in question (more often than not, cable TV, or phone service) are provided to every citizen within that geographical region. In turn prices are maintained controlled by strict regulation, corporation is happy with a state sponsored monopoly with guaranteed revenue streams and citizens are guaranteed service. This reasoning at one point in history may have made sense (I disagree). Such nice setup in paper has been tarnished as time went by and is causing a dent in our telecommunications infrastructure progress. In practice operators lobby to keep raising prices, governments rarely enforce regulation and people are still not warranted access to the service.
In Puerto Rico we have an even further retarded model mimicking the one in the states. Cable operators like Onelink Communications have an established monopoly in the metro area. I'm unfamiliar with the other regions of the island but there is also Liberty, Centennial, Choice amongst others. These cable operators provide broadband over their cable TV infrastructure. Their only viable competition is the oldest monopoly of the phone company PRTC. The quality of service of each greatly varies within a region and more often than not, its never satisfactory.
The west is known for its abysmal internet communications services compared to the rest of the world. Folks in the U.S. enjoy broadband speeds that vary from 1mbps to 30mbps down and 768kbps to 10mbps for upload. Now for us islanders these are speeds that we cannot even begin to comprehend their majesty. While these can vary from region, they pale in comparison to the normal 60mbps to 100mbps down/up that other European/Asian countries enjoy. The sad part is that in Puerto Rico we lag even further with 6mbps down / 384kbps up being the best case scenario (offered by Onelink in the metro area) and 512kbps down/up for the worst case scenario (offered by PRTC in the whole island but where available). The other cable operators’ speed varies but is also equally bad or worse. Ad-hoc to this situation is the wireless providers that also offer internet service through their 3g infrastructure. Claro PR (the wireless division of PRTC) offers speeds that constantly fluctuate between 512kpbs to 1.5mbps down according to their service page. Upload speeds are not mentioned but may be capped and I hope soon make some tests soon. I can vouch for AT&T in the island to have speeds that fluctuate between 800kpbs to 3.7mbps down depending on time of the day and location. Uploads are severely capped at 300kbps. Preliminary tests showed on the Sprint Network download speeds of 300kbps and upload speeds of 600kbps. I would have liked to also test Centennial but they recently passed on to be part of AT&T and will no longer be further up selling their CDMA network.
What does this mean for streaming?
For us aspiring to publish real time video content, here in the island we are embarrassingly handicapped with a consumer connection. Upload speeds are what will enable us to push all those video bits over the pipe and in that regard from the speeds mentioned earlier, the best scenario over a copper line is a PRTC DSL connection that provides theorical upload speeds of 512kbps. I say theorical because connections have to account for overhead that effectively operates at 80% capacity. Combine that with random luck of having poor DSL reception in your area or as in most cases, crappy DSL infrastructure and you may be looking at half the upload capacity or worse. If you are over a Onelink connection expect to have available about 350kbps for pushing a video/audio stream. Averaging out these scenarios, about 300kbps would allow an aspiring streamer from the island to have a very sad very low quality stream. Granted this doesn’t mean is not possible or unwatchable. I would encourage experimentation regardless. If you are brave and bold and want to stream over a 3g connection then most people would agree that is not possible. Apart from 3g connections having very poor upload speeds, they suffer from being unstable or unable to maintain a continuous TCP connection without dropping and reconnecting. For most internet activities like passive web browsing and im’ing this is bearable but not for stable continuous video streams. A week ago I would have laughed at the idea of attempting to stream over a 3g connection but I was perplexed when running some tests resulted in a watchable stream. This allows us for venturing in to interesting setups that would require streaming with mobility. Continue further along for the setup and some tests.
Cool story bro. How do I stream?
Note that we will be concentrating on streaming a watchable stream. When I talk about watchable stream I’m not referring to streaming your crappy webcam that produces images at the rate of a PowerPoint slideshow (though if you have a webcam with a good frame rate then it becomes acceptable). I’m referring to something comparable to standard definition TV. A watchable stream must have fluid motion (good frame rate) and you must be able to tell things apart in the image (not a garbled mess of pixelated blocks). Also the scope does not concentrate on streaming your face to your Internet boyfriend through an IM application. We will be concentrating on broadcasting to potentially large audiences through services that facilitate such. Onwards!
You will need the following:
* Your PC or Laptop with a good CPU (No Celerons or Atoms please) Multicore preffered.
* Capture card with video inputs / capture device such as cameras / capture driver for capturing desktops (your PC screen).
* Content source for capture (Game console etc…) * Adoble Flash Media Live Encoder (here). Needs an Adobe Online Account.
* A justin.tv, Ustream.tv, or Livestream account.
We will be using justin.tv for our tests. Setup your justin.tv account and fire up your Flash media live encoder. On justin.tv start broadcasting and download the xml file provided when you click on the broadcast button within the page. Load it in FMLE.
Select the capture source from which you will be broadcasting your video. If you have a capture card select it. If you’re going to capture from your screen select the driver. If you’re going to use your camera you will also be able to select it there. They will be found in the Device combo box under Video.

If you’re using a capture card click on the wrench so that the card driver’s control panel appears and lets you select the channel or input source of the card. In this case were going to use S-Video as is the highest quality most capture cards have as a source.

Once you finish you should be able to see the image or channel of the source you want to stream in the input window of Adobe Flash Media Encoder.

The input window is used to show you how the raw video entering from your capture device looks. The output window will be used to show you how the video looks to the people watching the live stream after compression and post processing are applied.
For the settings of the video section the following are suggested:
Format: VP6 - This is the default Flash video codec. You could also use h.264 codec. By clicking on the wrench the VP6 allows you to compromise between framerate or quality. The default which finds a medium between the two is acceptable. Later I hope to test with h.264 which can improve the image quality further.
Framerate: Highest Allowed - The frame rate which your capture card allows is very important since the more frames you can capture the smoother and fluid the video will look. This is necessary for high motion content like video games where there is a lot of fast paced action and you don’t want to miss capturing a frame. When lowering the frame rate, it yields for a lower upload bandwidth requirement. If your content is not fast paced (i.e. your face, desktop) you could lower the frame rate. For fast paced content like games (especially fighting games) you don’t want to lower more than 30. I use 60 frames for all capturing and I recommend using 60 unless your capture card doesn’t allow it or you’re struggling with the upload bandwidth.
Input size: Highest Allowed - The more resolution you capture, the better the video will look. You must capture at the best possible setting so that when you compress the video you’re ensuring to squeeze out all the quality you’re able to before taking a hit during compression. Garbage in garbage out rules applies.
Bitrates: 250 – 400 - The more bits your video has the better it looks. This number is a key factor that will change depending on how much upload bandwidth you have. For 3g connections I found in our tests that 250 was the bare minimum that we could lower the bitrate before it became too pixilated (AT&T with a tethered iPhone 3gs). On a Onelink or PRTC connection you can shoot for a higher setting. Don’t enable the other bitrates checkboxes. This is for when you want to have various streams of different quality but you must have sufficient bandwith to stream all of them at once. That’s not something we can afford here.
Output size: Height – 320 Width – 240 - This is the size and resolution the users will see. If you try to stream the same size as the input you will require more amount of upload bandwidth. If your content is widescreen you may have to play around with these settings to provide the best aspect ratio and not squeeze the image.
Crop: Varies - Used for when you want to crop sections of the image. It is very useful for eliminating black bars around the image.
Deinterlace: Unchecked
Timecode: Unchecked
On the audio section select the source of the audio. You must have the source of the audio connected to the line in port of the soundcard. From FMLE select the port. In case of a camera you will be probably using the microphone port. For a game console connect the stereo audio cables to the soundcard’s input.
Format: MP3
Channels: Stereo or Mono - When using stereo you will need more upload bandwidth but it will sound significantly better.
Sample Rate: 22050 or 11025 - Think of this as the resolution of the audio. The more samples you capture the better the audio sounds and is further distinguishable but more bandwidth is needed. Over a 3g connection most likely 11025 is needed.
Bitrate: Lowest Allowed - As with the video, the more bits the audio has the greater the quality but at the cost of bandwidth. This in particular can be incremented if you have bandwidth to spare as long as you don’t choke the connection causing the video to drop.
When ready click the connect button to start communication with the justin.tv server.

You should see that is connected as it will tell you on the lower left corner of the screen.

Finally by clicking on the start button the compression and streaming of the video should commence. You will notice that the screen will change to show you the connection message logging and statistics about the stream. Make sure it continually shows how much bit rate is being pumped out on the statistics as this is an indicator that the stream is happening.

Go to your justin.tv channel to check its working. Preferably do it from another connection as the one you have active right now is being used for the stream and should not be disturbed with more net activity than it can handle. Congrats! You are now broadcasting to the world.
Enter the broadband situation of Puerto Rico
In the west (from here on referring to the U.S. and Puerto Rico) the broadband situation is in a decadent state. For over a few decades, the business models of telecommunications have been the total opposite of what a society with a capitalist economic model requires. In its current form, local governments allow communications franchises to have geographical monopolies. The reasoning behind this model is that if you guarantee the seemingly benevolent corporation to operate without any market competition, the government can demand that there is a guarantee that the telecommunications infrastructure in question (more often than not, cable TV, or phone service) are provided to every citizen within that geographical region. In turn prices are maintained controlled by strict regulation, corporation is happy with a state sponsored monopoly with guaranteed revenue streams and citizens are guaranteed service. This reasoning at one point in history may have made sense (I disagree). Such nice setup in paper has been tarnished as time went by and is causing a dent in our telecommunications infrastructure progress. In practice operators lobby to keep raising prices, governments rarely enforce regulation and people are still not warranted access to the service.
In Puerto Rico we have an even further retarded model mimicking the one in the states. Cable operators like Onelink Communications have an established monopoly in the metro area. I'm unfamiliar with the other regions of the island but there is also Liberty, Centennial, Choice amongst others. These cable operators provide broadband over their cable TV infrastructure. Their only viable competition is the oldest monopoly of the phone company PRTC. The quality of service of each greatly varies within a region and more often than not, its never satisfactory.
The west is known for its abysmal internet communications services compared to the rest of the world. Folks in the U.S. enjoy broadband speeds that vary from 1mbps to 30mbps down and 768kbps to 10mbps for upload. Now for us islanders these are speeds that we cannot even begin to comprehend their majesty. While these can vary from region, they pale in comparison to the normal 60mbps to 100mbps down/up that other European/Asian countries enjoy. The sad part is that in Puerto Rico we lag even further with 6mbps down / 384kbps up being the best case scenario (offered by Onelink in the metro area) and 512kbps down/up for the worst case scenario (offered by PRTC in the whole island but where available). The other cable operators’ speed varies but is also equally bad or worse. Ad-hoc to this situation is the wireless providers that also offer internet service through their 3g infrastructure. Claro PR (the wireless division of PRTC) offers speeds that constantly fluctuate between 512kpbs to 1.5mbps down according to their service page. Upload speeds are not mentioned but may be capped and I hope soon make some tests soon. I can vouch for AT&T in the island to have speeds that fluctuate between 800kpbs to 3.7mbps down depending on time of the day and location. Uploads are severely capped at 300kbps. Preliminary tests showed on the Sprint Network download speeds of 300kbps and upload speeds of 600kbps. I would have liked to also test Centennial but they recently passed on to be part of AT&T and will no longer be further up selling their CDMA network.
What does this mean for streaming?
For us aspiring to publish real time video content, here in the island we are embarrassingly handicapped with a consumer connection. Upload speeds are what will enable us to push all those video bits over the pipe and in that regard from the speeds mentioned earlier, the best scenario over a copper line is a PRTC DSL connection that provides theorical upload speeds of 512kbps. I say theorical because connections have to account for overhead that effectively operates at 80% capacity. Combine that with random luck of having poor DSL reception in your area or as in most cases, crappy DSL infrastructure and you may be looking at half the upload capacity or worse. If you are over a Onelink connection expect to have available about 350kbps for pushing a video/audio stream. Averaging out these scenarios, about 300kbps would allow an aspiring streamer from the island to have a very sad very low quality stream. Granted this doesn’t mean is not possible or unwatchable. I would encourage experimentation regardless. If you are brave and bold and want to stream over a 3g connection then most people would agree that is not possible. Apart from 3g connections having very poor upload speeds, they suffer from being unstable or unable to maintain a continuous TCP connection without dropping and reconnecting. For most internet activities like passive web browsing and im’ing this is bearable but not for stable continuous video streams. A week ago I would have laughed at the idea of attempting to stream over a 3g connection but I was perplexed when running some tests resulted in a watchable stream. This allows us for venturing in to interesting setups that would require streaming with mobility. Continue further along for the setup and some tests.
Cool story bro. How do I stream?
Note that we will be concentrating on streaming a watchable stream. When I talk about watchable stream I’m not referring to streaming your crappy webcam that produces images at the rate of a PowerPoint slideshow (though if you have a webcam with a good frame rate then it becomes acceptable). I’m referring to something comparable to standard definition TV. A watchable stream must have fluid motion (good frame rate) and you must be able to tell things apart in the image (not a garbled mess of pixelated blocks). Also the scope does not concentrate on streaming your face to your Internet boyfriend through an IM application. We will be concentrating on broadcasting to potentially large audiences through services that facilitate such. Onwards!
You will need the following:
* Your PC or Laptop with a good CPU (No Celerons or Atoms please) Multicore preffered.
* Capture card with video inputs / capture device such as cameras / capture driver for capturing desktops (your PC screen).
* Content source for capture (Game console etc…) * Adoble Flash Media Live Encoder (here). Needs an Adobe Online Account.
* A justin.tv, Ustream.tv, or Livestream account.
We will be using justin.tv for our tests. Setup your justin.tv account and fire up your Flash media live encoder. On justin.tv start broadcasting and download the xml file provided when you click on the broadcast button within the page. Load it in FMLE.
Select the capture source from which you will be broadcasting your video. If you have a capture card select it. If you’re going to capture from your screen select the driver. If you’re going to use your camera you will also be able to select it there. They will be found in the Device combo box under Video.
If you’re using a capture card click on the wrench so that the card driver’s control panel appears and lets you select the channel or input source of the card. In this case were going to use S-Video as is the highest quality most capture cards have as a source.

Once you finish you should be able to see the image or channel of the source you want to stream in the input window of Adobe Flash Media Encoder.

The input window is used to show you how the raw video entering from your capture device looks. The output window will be used to show you how the video looks to the people watching the live stream after compression and post processing are applied.
For the settings of the video section the following are suggested:
Format: VP6 - This is the default Flash video codec. You could also use h.264 codec. By clicking on the wrench the VP6 allows you to compromise between framerate or quality. The default which finds a medium between the two is acceptable. Later I hope to test with h.264 which can improve the image quality further.
Framerate: Highest Allowed - The frame rate which your capture card allows is very important since the more frames you can capture the smoother and fluid the video will look. This is necessary for high motion content like video games where there is a lot of fast paced action and you don’t want to miss capturing a frame. When lowering the frame rate, it yields for a lower upload bandwidth requirement. If your content is not fast paced (i.e. your face, desktop) you could lower the frame rate. For fast paced content like games (especially fighting games) you don’t want to lower more than 30. I use 60 frames for all capturing and I recommend using 60 unless your capture card doesn’t allow it or you’re struggling with the upload bandwidth.
Input size: Highest Allowed - The more resolution you capture, the better the video will look. You must capture at the best possible setting so that when you compress the video you’re ensuring to squeeze out all the quality you’re able to before taking a hit during compression. Garbage in garbage out rules applies.
Bitrates: 250 – 400 - The more bits your video has the better it looks. This number is a key factor that will change depending on how much upload bandwidth you have. For 3g connections I found in our tests that 250 was the bare minimum that we could lower the bitrate before it became too pixilated (AT&T with a tethered iPhone 3gs). On a Onelink or PRTC connection you can shoot for a higher setting. Don’t enable the other bitrates checkboxes. This is for when you want to have various streams of different quality but you must have sufficient bandwith to stream all of them at once. That’s not something we can afford here.
Output size: Height – 320 Width – 240 - This is the size and resolution the users will see. If you try to stream the same size as the input you will require more amount of upload bandwidth. If your content is widescreen you may have to play around with these settings to provide the best aspect ratio and not squeeze the image.
Crop: Varies - Used for when you want to crop sections of the image. It is very useful for eliminating black bars around the image.
Deinterlace: Unchecked
Timecode: Unchecked
On the audio section select the source of the audio. You must have the source of the audio connected to the line in port of the soundcard. From FMLE select the port. In case of a camera you will be probably using the microphone port. For a game console connect the stereo audio cables to the soundcard’s input.
Format: MP3
Channels: Stereo or Mono - When using stereo you will need more upload bandwidth but it will sound significantly better.
Sample Rate: 22050 or 11025 - Think of this as the resolution of the audio. The more samples you capture the better the audio sounds and is further distinguishable but more bandwidth is needed. Over a 3g connection most likely 11025 is needed.
Bitrate: Lowest Allowed - As with the video, the more bits the audio has the greater the quality but at the cost of bandwidth. This in particular can be incremented if you have bandwidth to spare as long as you don’t choke the connection causing the video to drop.
When ready click the connect button to start communication with the justin.tv server.

You should see that is connected as it will tell you on the lower left corner of the screen.

Finally by clicking on the start button the compression and streaming of the video should commence. You will notice that the screen will change to show you the connection message logging and statistics about the stream. Make sure it continually shows how much bit rate is being pumped out on the statistics as this is an indicator that the stream is happening.

Go to your justin.tv channel to check its working. Preferably do it from another connection as the one you have active right now is being used for the stream and should not be disturbed with more net activity than it can handle. Congrats! You are now broadcasting to the world.
Comments
Post a Comment