How to upload and stream flash videos using java? - java

I want to create a html page that can be used to upload videos and also able to playback the videos. I am totally new to this. 2 weeks before only i learnt uploading and processing images. So, i need some guidelines like
How to upload video?
what concepts i have to learn?
what are all the libraries i may require?
How to convert it into flash format?
How to stream it back to user?
I am using Java in server side!
And i also want to know that Is there any way to do them all with AJAX?
Any suggestions or advices or links or anything that can help me would be more appreciative!!!
Thanks in Advance!

Hmmm... seems interesting..
How to upload video?
Well it depends.
If you are using a thick client (aka swing or swt) then you can use Apache Commons File Uplaod API.
For JSP http://www.roseindia.net/jsp/file_upload/index.shtml
With JSF - (http://balusc.blogspot.com/2008/02/uploading-files-with-jsf.html and http://onjava.com/pub/a/onjava/2005/07/13/jsfupload.html)
With AJAX - http://www.openjs.com/articles/ajax/ajax_file_upload/ (basic example but enough to guide in right direction :))
what concepts i have to learn?
As a library integrator you will need to know about the front end technology you are going to use (JSF, JSP or PHP etc)
You should know about basic of multimedia handling in java (sometimes help in debugging)
Basic of flash video (specially how streaming works in internet video http://blog.xuggle.com/2009/01/23/overly-simplistic-guide-to-internet-video/ )
Assuming you already know about servlets etc.
Have a look at HTML5. It has some great offerings like video playback etc.
what are all the libraries i may
require?
Again depends
IF choosing javascript for front end + AJAX in mind http://jqueryui.com/ or http://jquery.com/
IF JSF is the choice for front end - http://www.jboss.org/richfaces or http://www.primefaces.org/ along with JSTL etc
You will need a library like http://www.xuggle.com/xuggler/
Xuggler is the easy way to uncompress,
modify, and re-compress any media file
(or stream) from Java. Xuggler is
available under the GNU Lesser General
Public License.
Most of the Flash video sites either use xuggler or FFMpeg for conversion and playback.
How to convert it into flash format?
Use Xuggler http://www.xuggle.com/xuggler/. It uses the FFMpeg http://www.ffmpeg.org/. Though you have to use at server side for conversion (As of now you can not use it in applet). Refer to http://wiki.xuggle.com/Tutorials for more information.
How to stream it back to user?
I normally do it in this fasion.
<embed height="385" width="640" type="application/x-shockwave-flash" src="http://s.ytimg.com/yt/swf/watch_as3-vflofTU0v.swf" id="movie_player" flashvars="rv.7.length_seconds=107&rv.2.thumbnailUrl=http%3A%2F%2Fi4....." allowscriptaccess="always" allowfullscreen="true" bgcolor="#000000">
I hope it will help you :)

Related

Webcam live streaming in a Java webapp

Ok, I know this is probably not so easy but I have this requirement. Basically the webapp will have a simple jsp with a live streaming webcam. How can I get the stream and embed it in the application?
I've read about RTPS and Red5 and stuff like that but seems not so easy to find a simple and clear tutorial on how to do this!
Btw I'm open to evrything else (like http streaming? flash?). The simpler, the better!
Thanks in advance!

How can I stream video to a browser using Java/Spring?

We a have jboss server running and have a basic web setup using Spring but now I would like to stream video into the browser. I am trying to use xuggle but then I read on their website that you can't put it into an Applet or use it with java webstart, so I'm assuming that means I can stream to a browser, is this assumption correct? If so does anyone else know any libraries or how I should go about doing this? If you need any more info or have questions I'll be happy to answer although I'm very new to streaming video and relatively knew to Spring.
UPDATE: So I'm able to generate a video using xuggle, and then I can embed that video in my html code... but I can't generate and stream at the same time. Does anyone have any ideas how to make xuggle push date out to my tomcat server?
You may want to look at Red5 media server.
Since you are doing jsp, just have your code write out the HTML 5 video element. That will provide basic video functionality. This will work in all HTML 5 compliant browsers as well as all mobile devices.

Is it possible to create a photo filter program like Instagram using java?

Is it possible to create a photo filter program like Instagram using java? It doesnt have to be a mobile application with all the bells and whistles of geotagging, uploads, commenting and other social media functions. Im just interested in the photo filtering capabilities of Java.
If so a code snippet or a link to the tutorial would be greatly appreciated.
Thanks in advance guys.
Yes, Java has built-in libraries necessary to do arbitrary image analysis and processing such as that required for effects like Instagram, etc.
There are tons of resources on the web discussing the possibilities and technical approaches; try searching keywords such as "java image processing". This website (Jerry's Java Image Processing Pages) has lots of ideas.

How to make Tomcat stream media?

I am entirely new to streaming implementation. I have developed some RESTful web services using Jersey/Tomcat. There are few cases where I need to send audio/video files to the clients, which uptil now I have been sending as a file fr download - now I want to stream these files.
Do I need to write some code for this ? Or I need some third party solutions ...I have heard about Wowza / Darwin / Red5...But I dont know if they can be integrated with Tomcat and my existing services. Any third party solutions need to be free / opensource, and they should support both audio and video streaming. In the near future I need to add transcoding support too..for which I am planning to use Xuggler. So it would be good if the server is having such support.
Any pointers would be appreciated. Thanks !!
Red5 is essentially Tomcat with added features. I don't know how far back in time the fork was made but the basic functionality is all there.
Also - Red5 and xuggler play nicely together.
You'd still need to code up the client side of the streaming portion though. Its possible that HTML 5 will give you this for cheap.

Can I convert a .swf file to an image format?

I need to take a .swf Flash file, ideally from a URL (but I can read the file from disk also) and create an image preview of it (png, gif or jpeg is fine).
I am using Adobe Coldfusion 8 so I'm looking for a Java solution. I need to get the first frame of the Flash movie only.
Many thanks in advance.
EDIT: I need to do this on the server in Java/CF at runtime - it's got to be automatic - I'm not looking for screen-grab software! :)
Is this running in a web browser? Or standalone - actually, either works. Simply get it to the point you want, and take a screenshot (Print Screen). That'll giev you an image you can paste into your image app of choice.
IF however you're wanting to code it, you'll need to probably want to try this freeware toolkit:
http://bytescout.com/swftoimage_swf_to_jpg.html
which allows you to take a flash file and convert the first frame to your image type of choice :)
Try swftools. It has utility called swfrender which can export frames into images. And it is open source :).
I'm not an expert but I think you can't without some tricky tools because SWF is a compiled flash program.
UPD: but there are some swf2flv converters, maybe u can use them. It is easier to make a preview from flv format.
UPD 2: I see several answers that recommends you to open it in a browser and make a print screen. If you really want to do this, look at JxBrowser.
AS3 has the capability to store the pixels that represent the entire screen into a BitmapData object, pass that to a JPG/PNG encoder, and post it to the server. There is a document on Adobe's devnet here that explains how the ActionScript works and what is needed with regard to PHP, shouldn't be hard to translate to CF.
here's an .net article:
http://www.codegod.de/WebAppCodeGod/screenshot-of-webpage-with-aspnet-AID398.aspx
basically you create a webpage showing the .swf flash file.
remember to call iecapt.exe including the command line argument --delay=10000 to give the ie activex control 10sec to load the .swf
Probably not what you're looking for but... Alt+Print Screen would work.. :)
More seriously.. find something that can render flash (IE ActiveX control?) and capture the buffer it renders.

Categories

Resources