Hi All,
I am trying to solve the problem of Flash video playback on the SunRay1[1], and so far I have had maybe 60% success, but it’s still not good enough.
My biggest problem is that if you Google for “flash video stuttering” or similar then you will get thousands of hits about using faster computers, using a faster network, changing your codecs, etc – but none of that is applicable to a thin client, or my situation.
So here’s the problem:
* YouTube videos play very acceptably on a SunRay1
* Even if I replicate the codecs, bitrate, and everything else I can find out about YouTube’s media, FFmpeg-encoded flash videos played on a SunRay1, using JWplayer, stutter badly and are unwatchable.
For those who speak FFmpeg, here’s how I am generating the FLV videos:
ffmpeg -i video.avi -vcodec flv -b 240k -s 320×240 -g 300 -ab 64k -ac 1 -ar 22050 -y video-low1.flv
…using code (FFmpeg version SVN-r15488) and libraries that I pulled and freshly built this week.
I am also using the latest JWplayer for Flash.
I encoded the above by copying everything that I can learn about YouTube formats:
* the audio is downsampled to 22kHz and mixed into mono LAME MP3 at 64kbits
* the video is Flash 7 format (Sorenson) and set to 240kbits, scaled during encoding to 320×240 and then played back at whatever 4:3 ratio size it is meant to be, in this case 480×360.
* the native frame rate is 25fps, and the FLV file inherits that; since YouTube videos play at 29fps, I am pretty sure that’s not the problem
* also I experimented with encoding with framerates as low as 8fps and found it didn’t help.
The SunRay server is a mostly-idle twin-core Opteron running at 2.4GHz, and as I say it does a fine job of playing back real YouTube videos, with audio, on the SunRay1 thin client. The webserver is on the local network, so there is no delay waiting for data – the 50Mb file is downloaded in seconds.
When playing the FLV file using JWplayer in Firefox, the video stutters, you can watch it refreshing the playback area, and the audio stops and starts, and the video stops and starts in sync; it was worse before I added “-g 300” to increase the keyframe interval, but raising it any higher yields no benefits.
I have the following suspicions:
* Maybe the audio settings also need poking to have increased packet sizes, or something; I do get the impression that JWplayer is working hard to keep audio and video in sync, rather than just streaming the media in a laissez-faire way?
* Maybe the YouTube player has some special magic in it? Certainly it seems to look less pixelated than the JWplayer videos – a sort of “impressionistic” approach to colour?
* Maybe there are some non-obvious FFmpeg settings I need, like how to handle dropped frames on the server, and stuff like that?
In short, I am stuck, and I am pretty sure there aren’t many people who work in this space.
I am kinda hoping that it reaches one of them. Can anyone help?
[1] A SunRay is a networked thin-client device from Sun Microsystems; http://en.wikipedia.org/wiki/Sun_Ray for details; if you aren’t familiar with thin clients then you can probably think of them as “hardware devices that do VNC of another machine”, but they are actually a lot better than that.
[2] I am using a SunRay1 which is the oldest and slowest of the machines; apparently there will be some improvements to its firmware soon to enhance video playback, but I want to get this working *now* …
Leave a Reply