YouTube
From Gnash Project Wiki
YouTube player loads FLV movies using NetStream and NetConnection.
Testcases showing that the model itself works can be found in the LoadingFLV page.
Contents |
Testing YouTube
To play a Youtube.com video, Gnash needs proper parameters from youtube.com. For example, if you want gnash to play the following link(RMS singing the Free Software Song):
url=http://youtube.com/watch?v=9sJUDx7iEJw
Those needed parameters for gnash can be recovered using some bash scripts,
url=http://youtube.com/watch?v=9sJUDx7iEJw vars=$(wget --quiet -O - "$url" | grep -F watch_fullscreen | cut -d \? -f 2 | cut -d \" -f1) echo "$vars"
The above scripts recover the parameters as follow,
fs=1&BASE_YT_URL=http%3A%2F%2Fyoutube.com%2F&vq=None&video_id=9sJUDx7iEJw&l=121&sk=TOP9e3eXrfiO6EGdiOU5ygC&fmt_map=
&t=OEgsToPDskIVeeRK-YiUs822hKcHo5-L&hl=en&plid=AARKlFe44tBhwprhAAAAoAAoQAA&title=Richar Stallman Free software Song';
Now, you can supply the parameters to gnash in several ways. To help troubleshooting a Youtube video, you would like to invoke gnash in the verbose mode,
gnash -vv -F 2 -P "FlashVars=$vars" http://youtube.com/player2.swf
or
gnash -vv -F 2 "http://youtube.com/player2.swf?$vars"
If you want you can download player2.swf first and load it from the filesystem, but you'll have to properly set the base url using option -U. For example, the following command should be launched from the folder where you keep your local player2.swf:
gnash -vv -F 2 -U http://www.youtube.com -P "FlashVars=$vars" ./player2.swf
Full off-line testing
- Grab an FLV from youtube (you can see the url adding -v to any of the above calls) and put it in the root directory, giving it the name 'get_video?video_id=undefined&t=undefined'.
- Grab the player2.swf movie (http://youtube.com/player2.swf)
- Call gnash -v player2.swf
Note that load of the FLV from the root dir will likely be forbidden unless you specify your root dir as a local sandbox (for example setting it as the base root).
Safer, and more flexible, would be placing the FLV to your webroot, and use -U to specify it's address:
gnash -U http://localhost:90 player2.swf
You may use this to limit bandwidth using a smart httpd. In this case you just need the FLV to be placed on the web root and named 'get_video'.
Note also that unless you pass a 'l' variable the bottom progress bar doesn't work correctly. The 'l' variable tells the player2.swf movie what's the length of the FLV.. For our testcase (RMS singing) this is 121 (02:01 time), so you'd use:
gnash -P "FlashVars=l=121" -v player2.swf
Finally, if you want to test playing a smaller FLV, you can just cut it at arbitrary sizes. For example, you can use dd for extracting the first MB from it:
dd if=original.flv of=small.flv count=1024 bs=1024
Tested configurations
Media handlers known to work are:
- gstreamer-0.10
- ffmpeg- version ?
Gui/Renderer combinations:
| agg | cairo | opengl | |
| fb | ? | - | - |
| fltk | ? | ? | - |
| gtk | ok | fails | ok |
| kde | - | - | ? |
| sdl | ok | ? | ok |
- = Unsupported combination
YouTube specific problems
- CPU usage.
- Needs sound enabled in order to work (check plugin_sound in gnashrc)
- Video control widgets don't work.
- Resizing the window doesn't correctly replace the widgets.
CPU usage
This section has been currently wiped out due to poor profiling execution. Previously published profiles were with an unoptimized build, good for debugging more then for profiling. In particular the code was built with inlines disabled and optimization turned off.
Standard optimization (-O2) and inlining showed NO big CPU problems with AGG. Highest CPU usage has been 70%, with an average of 60%. This is while video is still being downloaded. When video buffer is full (finished downloading) CPU usage gets to an average of 30%.
Speed might still be an issue on older computers, but this is likely not something we should be tracking down before release 0.8.0.
A separate issue, is high CPU usage at *end* of video. See http://savannah.gnu.org/bugs/index.php?19811
Broken video control widgets
- Seeking doesn't work. See http://savannah.gnu.org/bugs/?19781
- Muting/unmuting doesn't work
- Play/Pause doesn't work. See http://savannah.gnu.org/bugs/?19797
Widgets replacement
Calling gnash with the -s flag (scale) works fine (TIP: and is helpful to reduce CPU usage). Anyway, once the standalone player starts, if you resize the window the control widgets don't get placed in the correct place.
Actually, I think that the problem here is with the *video* not resizing at all, and the resize itself not working in both directions.

