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.
You can get directly to the SWF by changing 'watch?v=' with 'v/', for example:
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):
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,
&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
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
Media handlers known to work are:
- ffmpeg- version ?
- = 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.
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 was high CPU usage at *end* of video
Broken video control widgets
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.
An error occurred. Try again later.
This message appears when gnash fails to send an appropriate cookie together with the request for the FLV to play. As a consequence for the missing/wrong cookie the server responds with a 430 status (forbidden).
Now, if you refuse to accept cookies from youtube.com this will be resolved as for some reason the server won't care anymore.
Another alternative is to use a browser with an NPAPI interface that supports querying cookies, thus allowing gnash to send them over. This is implemented in Gnash starting with release 0.8.8.
Browsers supporting read of cookies trough NPAPI:
See also: http://gnashdev.org/?q=node/77
Tips and tricks
- Feb 25 2010, http://turanct.wordpress.com/2010/02/25/gnash-youtube/