Wednesday, November 30, 2011

changing the default player on radiosai.org

On the home page of radiosai.org the links to the streams use a flash player from WaveStreaming.com. Trying to substitute it seamlessly using jplayer, found that modifying the size of the player skin requires more CSS skills than I have at the moment. Will think of something later.

Edit: Most problems have a brute-force solution! Resized the images by a factor of half, halved all the pixel values in the css, et voila - a half-sized player! That was too small, so multiplied again by 1.4 to get the size we want.

Wednesday, November 23, 2011

setting up live video streaming - resource usage

This will be a series of posts about setting up video streaming on our new dedicated server from Voxel.

When the Wowza streaming server was serving at around 600 Mbps, that is around a 1000 clients, top reported the following usage of memory and cpu:
  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND           
18825 root    20   0 2009m 1.3g 7892 S  113 17.1   1064:58 java  

Since this is a quad-core machine, probably top reports 100% as maxing out a single core. So, we have plenty of cpu to spare, and could easily max-out the 1 Gbps port. (And that's what we did .... running video at 800 kbps per instance.)

disk full on saiwaves

While uploading files to dl.radiosai.org saiwaves reported disk full - unable to write to disk etc. As given at this post, removed some 3 GB from Trash by doing
rm -Rf ~/.local/share/Trash/*

Later, P removed around 70 GB (!) of old database backups.

Sunday, November 20, 2011

mysql database error

Our schedule page and audio search page stopped working - sometimes the pages would respond with "Could not connect to database" and sometimes they would show 0 records returned. Trying to connect with the phpMyAdmin using Plesk gave the error message
MySQL said: Documentation
#1 - Can\'t create/write to file \'#sql_abc_0.MYD\' (Errcode: 17)

Reported it to nettigritty support, they restarted the service, everything became fine.

Saturday, November 19, 2011

setting up live video streaming - aspect ratio and timezone

This will be a series of posts about setting up video streaming on our new dedicated server from Voxel.

 P wanted the timezone on the server to be set to IST, for ease of recognizing recorded files etc. Did it with dpkg-reconfigure tzdata
which is the Ubuntu way of doing it at present.

Then: the flv video which we saved on the server seemed to have an NTSC flag set somewhere. Probably originating from the Adobe FMLE (Flash Media Live Encoder). So, the video was being seen with a skewed aspect ratio even though it was square pixels 400x224 25 fps. Finally solved it at the client side using stretching:"exactfit" as a parameter for the jwplayer.

setting up live video streaming - recording on the server

This will be a series of posts about setting up video streaming on our new dedicated server from Voxel.


There are different ways of recording.
1. using live-record as stream type in Wowza. This does not give us control over when recording starts - recording starts as soon as the source gets connected.
2. using the LiveStreamRecord addon module, we can choose when to start recording and when to stop.

So, we used the latter, set up a password protected page on our website for the record enable form which is included with the module. We set it up not to overwrite (so it would create a new file like myStream.sdp_2.flv etc increasing the number to _3, _4 etc.) Also set it to start on keyframe and record data. (Metadata, I suppose.)

First we tried setting up http pseudo-streaming with mp4 on Apache. After setting up the module for streaming video the seeking was not working properly for parts of the video which had not yet been downloaded - jwplayer was playing the beginning of the video after the seek.

Then the audio and video were coming out of sync on the recorded mp4 file. It looks like many people have faced this issue.

So we tried recording as flv files instead. With that, the audio-video sync problems were solved. But since the module for flv seek over http uses Lighttpd - setting it up was a bit of a pain - we fell back to providing the video over rtmp using Wowza's vod application. That, of course, worked perfectly.



Friday, November 18, 2011

Argument list too long

Doing ls or mv invariably leads to Argument list too long errors. A nice discussion about ways to get around this:
http://www.linuxjournal.com/article/6060

setting up live video streaming - download links

This will be a series of posts about setting up video streaming on our new dedicated server from Voxel.

Setting up a download link - I tried to do this by adding the .htaccess file like in dl.radiosai.org with the lines


  ForceType application/octet-stream
  Header set Content-Disposition attachment


But this did not work, even when I modified the config file again, as in
https://help.ubuntu.com/community/EnablingUseOfApacheHtaccessFiles
adding the line
AllowOverride All
So, did it by editing the config file:
http://www.jtricks.com/howto/content_disposition/apache2.html

       
                Options FollowSymLinks
                AllowOverride All
               
                    ForceType application/octet-stream
                    Header set Content-Disposition attachment
               

       
 
Then, files can be either copied or linked into the download directory, and accessing them automatically gets the "Save as" dialog box for the user.

Wednesday, November 16, 2011

setting up live video streaming - iPad and iPhone

This will be a series of posts about setting up video streaming on our new dedicated server from Voxel.

After setting up Wowza server as per my earlier post, tried to get the live stream to work on iOS devices - iPad, iPhone, iPod touch etc.

To make the stream work with iphone, the encoder settings have to be tweaked. Format has to be H.264 and AAC audio. Otherwise the device gives the message, "This video cannot be played."

AAC settings should be low complexity - I found 22050 Hz, mono, 32 Kbps to work OK.
H.264 settings have to be Baseline 3.0
(set by clicking on the spanner icon next to Format: H.264 in Adobe Flash Media Live Encoder)

When this is done, the following url works for iOS devices, when entered into Safari on iPhone, for eg.:
http://server1.radiosai.org:1935/live/myStream.sdp/playlist.m3u8
(entering this URL on a normal computer does not work).

In order to make this work with the jwplayer, which we can embed in a page which will work for desktop browsers as well as iOS devices, the player had to be updated to the latest version - 5.8. Then the sample code for embedding worked fine.

local recording along with live streaming

S was looking for solutions for local recording along with live streaming, for upload to vimeo later. He wanted to explore Quicktime broadcaster for this.

There are several possible solutions, which we can try out.

1. Use a DV hub, record DV on another computer, encode offline after the event, then upload. This will result in best quality.

2. Record on DV tape on the DV VCR which you are using as source, capture and encode after the event. The tape has to start before the stream starts, and the tape has to last for the entire event, because stopping the tape causes the stream to restart.

3. Recording on the same machine which is doing the broadcasting - seems to require some funky workaround like
http://forums.adobe.com/thread/657963
but may be possible. To open multiple instances of FMLE you have to use this technique:
http://osxdaily.com/2011/05/11/multiple-instances-application-mac/

4. Using Quicktime broadcaster instead of FMLE is also probably possible, wowza server supports QT broadcaster also as a source. But broadcaster also seems to have the same limitations - setting up the entire chain for it separately seems to be a waste of effort.



(Finally the solution chosen was 1.)

Tuesday, November 15, 2011

setting up live video streaming - C++ RTMP server

This will be a series of posts about setting up video streaming on our new dedicated server from Voxel.

First attempt was to replicate my earlier test, and set up the C++ RTMP server. That involved re-compiling from source, since the binary did not seem to run on the Ubuntu machine.

1. Checking cpu type:
cat /proc/cpuinfo shows it is
Intel(R) Xeon(R) CPU X3330 @ 2.66GHz
2. so trying crtmpserver-690-Ubuntu-10.10-i386.tar.gz
3. Procedure as in my earlier test
4. Gave error "no such file or directory" when tried to run the executable.
ia32-libs recommeded by this launchpad post.
5. apt-get install ia32-libs and then tried. Then the executable runs, but seems to have some error, since the console doesn't come up. Tried with the 64 bit binary also, still no go. So, tried the sources from http://www.rtmpd.com/downloads/

6. For that, while following the instructions to install at the rtmpd site.... had to install lots of stuff.

set CMAKE_CXX_COMPILER to a valid compiler path or name -> apt-get install gcc

and

apt-get install g++

OPENSSL_INCLUDE_PATH-NOTFOUND -> as per this forum post,
apt-cache search libssl
grep SSL

Then I installed apt-get install libssl-dev

Finally worked. Binary is in /root/crtmpserver-690/builders/cmake/crtmpserver folder.

But....
C++ RTMP server does not have the nifty features of Wowza, does not automatically make the http  pseudo-streaming chunks for streaming to iPad etc. So, decided to go for Wowza server after all.

Monday, November 14, 2011

google analytics code

Upgrading to the new template on blogger had removed the GA code. Added it back today, going to Edit HTML in the template editing section, and adding the code just above the /body end tag.

Actually a related topic, checking if the analytics code is working:
http://www.rachaelarnold.com/dev/archive/how-to-check-if-google-analytics-click-tracking-is-triggered
this method uses  Firebug, with the Net panel enabled. We should be able to see requests starting with _utm.gif? - and the params tab gives the info being sent to Google.

streaming video and quality

Just a small study I did about streaming video and quality.

Ted talk quality, for eg.
www.ted.com/talks/ken_robinson_says_schools_kill_creativity.html

- wireshark clocked it at 0.415 Mbps - let's say 400 kbps.

(Ted uses variable bit rate streaming - bitrate changes with scene as well as with bandwidth availability)

Youtube video at 360p -
http://www.youtube.com/watch?v=I1Tbn1GtIGE&feature=grec_index

21.6 MB for 8 minutes 45 sec
21.6 MB/525 seconds
= 0.0411 MB/s
= 0.329 Mbps, close to 300 kbps.

But these are all offline encoded videos. For live encoder, quality will be somewhat lower for the same bitrates.

Saturday, November 12, 2011

TFD internal error

The Thought for the Day page was giving an Internal Server error if the particular day's entry had not been made. And interestingly enough, putting an if statement to check if the record exists was preventing the TFD from being displayed at all, even if it exists. Nz solved the mystery: the text only version, which showed the TFD even though it had the if statement, had some extra type information when the recordset was being declared. Did the same for the former page, and got it to work. The
rsObject.Open strQuery,objConn,adOpenKeyset,adLockOptimistic
The last two, adOpenKeyset,adLockOptimistic were the ones added to the line.

Friday, November 11, 2011

gimp batch process gui

This makeuseof page links to David's Batch Processor.

Allows operations on the entire image, like blur etc. Quite fast, even for large images. Is perhaps faster than doing it in Irfanview - though I did not try a comparison. But not really a replacement for Actions on Photoshop. For that, scripting is required, I suppose. Perl, anyone?

Thursday, November 10, 2011

iPhone 3G jailbreak and unlock

PB got an iPhone 3G for unlocking.

Version : 4.2.1 (8C148)
Modem Firmware:  05.15.04
Carrier : AT&T 9.0
Model : MB702LL
 
Jailbreakme.com does not work with 3G - only with 3GS and above, I think. I gave him a link to pwnagetool, but he did it with redsn0w instead. He noted the following:

1. Could not download - redsn0w 0.9.6b6 managed with redsn0w_win_0.9.6rc16
2. http://www.idownloadblog.com/iphone-downloads/ gave the link to this version of the restore, which was
from apple's site.
3. redsn0w_win_0.9.6rc16 kept crashing. This forum post  helped with the following suggestion, which made it work.


After couple of minutes Redsnow just shuts down (disappears)
what cause this problem ?
first install only cydia. don't tick the update baseband

after jailbreaking then you can fetch baseband tick only update baseband.
4. Could not add source http://repo.ultrasn0w.com to cydia
followed the alternate repository given at  http://nabtron.com/ultrasn0w-repo-sources-for-cydia/3567/
 

Tuesday, November 08, 2011

finding the first played date and displaying it

A small gotcha in implementing the "First broadcast on ...." feature on the radiosai schedule page - our local database has the first played values per bcid. So, the first of all those values has to be selected. After some trial and error with group by - which would fail -

finally used this technique,
SELECT firstplayed FROM play_history_tablename WHERE filename = NameofFile.mp3 order by firstplayed  limit 1

This query conveniently gets the single result which we want, which is the first played date on any stream. Then incorporated this into our csv export script, added an extra field on the web-server's database, and added code to the schedule and search pages over the course of a week. On the search page, sorting by first played adds more functionality. So, added the code for that, and made the table clickable to enable sort by Description field also, using the sorrtable javascript library from kryogenix.

Monday, November 07, 2011

Made search results sortable

Added first played info to our audio search results page.
Changed default to show newest files instead of oldest results.

Made search results sortable using javascript, by using the sorttable javascript library from
http://www.kryogenix.org/code/browser/sorttable

Tuesday, November 01, 2011

email not reaching Google apps mailbox

Our German program producers reported bouncing email from office@radiosai.org:


A message that you sent could not be delivered to one or more of its recipients. This is a permanent error. The following address(es) failed: office@radiosai.org 

SMTP error from remote mail server after RCPT TO:: host aspmx.l.google.com [74.125.39.27]: 550-4.2.1 The user you are trying to contact is receiving mail at a rate that 450-4.2.1 prevents additional messages from being delivered. Please resend your 450-4.2.1 message at a later time. 

If the user is able to receive mail at that 450-4.2.1 time, your message will be delivered. For more information, please 450 4.2.1 visit http://mail.google.com/support/bin/answer.py?answer=6592 q11si2325486fah.22

Replied as follows:

Checking the GA help center as suggested in that page, this page seems to indicate that signing out of the account instead of remaining signed in all the time solves the issue. We'll try doing that.

This could also be an issue with freenet.de - because the other complaints listed on Google's forums are also from freenet.de customers. So if you get a bounce message like that, you could try sending the email from another email id instead of the freenet.de id.