Xuggler/Java Thumbnail from Video - java

I'm building an app in Grails, but I am well versed in Java also. I need to display thumbnails of video files, and then when the user clicks on a thumbnail, open that video in a player. (Like Youtube).
What I am thinking is, when the user posts the video, I'll use xuggler to grab a thumbnail, and save that along with the video file itself.
Question 1: Is that a good design?
I am not familiar with xuggler.
Question 2: Is there some way to grab a thumbnail from input stream as the user is uploading? Otherwise, I am going to write the file, and then grab the thumbnail from that as described here.

Xuggler seems like the way to go.
I'm doing something similar at the moment. I'm opting to download the entire file payload before attempting to assume I was given a video.
I've built a similar system in PHP and users submitting Windows Movie Maker project files was a real issue.
application/octet-stream was a very common content-type from machines that didn't know file type associations

Related

Video Conversion Automated Application

I am trying to create an application where you are able to convert video's to different formats where the video is saved on a web server so that the user can access it once the conversion is complete. What would you recommend as the best way of approaching this?
Example:
-Download a video from a particular website.
-Be able to convert it to MP4 and save the file on a web server.
-Send a notification to the user with the link of the MP4 video.
-Access and download the MP4 video from the link.
So basically the user downloads a video (in ARF format). My program should take that ARF video and convert it to MP4. Once converted, the mp4 saved on a web server and the user informed (i.e. by email) that the conversion has been completed. The user should then be able to view the link and download the MP4 video. I also want to make sure that the program works on Windows, Linux and Mac.
Users can manually specify the file to be converted. I am most confident with Java so is there a way this can be achieved using some of Java's API Libraries & Web Applications?
I was thinking of using JAVE libraries to do the conversion but am not too sure how to then save the video on a web server.
There are several Java libraries for working with various media formats. A prominent one is JFFMPG:
http://jffmpeg.sourceforge.net/
There is also JAVE, which you may find easier to user, depending on your needs:
http://www.sauronsoftware.it/projects/jave/index.php

How can I get the correct url to the video file from an embedded video?

I want to get the actual Video File Url from an embedded video on any website. It essentially is not YouTube. It can be any website.
I am coding for android on Java.
For Example :
The thing I want to do is same as this IDM button does :
[Actually not the same because the button there captures a network stream when it gets started by the player. But I want to get the file straight from the player.]
Is there a way to attain this? Can Any external Library [e.g. Jsoup] do this?
I am already using Jsoup to get some other contents of the page but I have no idea how to do this.
If your using jsoup you can get the url quite easily. Just use jsoup to select all the possible video tags (<iframe>, <videos>, <embed>, etc). Then get the src attribute and store that where you want it:
Example
//Standard Jsoup search
Elements iframes = body.select("iframe");
/*Gets the src of all the iframes or other tag, and if you have
multiple videos you might have to do this in a for loop.*/
String videoURL = iframes.attr("src");
As you may know that different website have different video downloading strategies, some might give a real url in html file for directly download, others may just return video stream while click button or touch screen.
while so many different strategies on video download its really hard for you to find a universal way to fetch a real url to start a download task. But here I have an idea, not so smart, it can be very dumb:
1.play a video in the background(to let browser download that video in browser cache).
2.find that cache file and extract video file which you want.
for myself, I usually have some videos that I want but can not be downloaded straightly, thus I will use IE to play that video and find that video in IE temporary folder.
wish I could help you!

Streaming video files users have uploaded

We have a java web application where users can upload all kinds of files including any kind of video files. Now we want to allow them to stream these video files they own. So I need to make sure that they are the owner and then stream video. Also possibly stream a preview.
Do I need to convert these video files before streaming and where should I look to get started?
The best video playback/encoding library I have ever seen is ffmpeg. It plays everything you throw at it. (It is used by MPlayer.) It is written in C but I found some Java wrappers.
FFMPEG-Java: A Java wrapper around ffmpeg using JNA.
jffmpeg: This one integrates to JMF.

Playing a sound file on website media player

Hey all, i'm new to web development so i'm really dumb when it comes to tools for working on it. I have .amr files recorded from my BB application that are sent and saved on a server. I want to be able to play these files via a webplayer on a website, I have a couple of questions regarding this:
1) Would it be sound to convert these files to something like mp3 o wav instead of trying to play using the amr format? The sound files are received by a java web service and saved as files on my hard drive with the URL saved on a MySQL database. So if a conversion method is suggested I would prefer it be in Java.
2) What player can I use and how, to play these files? Be it the amr files or converted files
3) How can I create a link that will point to said audio file so people can go to it and hear it? I know this differs a little from my original question line but I have to able to do it as well.
thanks in advance
1) MP3 or wav would be a good idea. You could use something like LAMEonJ (http://openinnowhere.sourceforge.net/lameonj/) for wav -> mp3. And with luck there's something similar for AMR.
2) Is the <audio> tag in HTML5 likely to be an option? The users could then play the file directly in the browser, and you could just render HTML on the website, rather than providing it through a webservice.
I think you are suggesting an applet on a web page, that connects to the server via a webservice, which would certainly be possible but a lot more work.
Otherwise, if you're just serving a music file, you're not going to be able to control what player is used on the client side, once they have your file they can do with it whatever they like.
The only down side of HTML5 is that they'll need a relatively recent browser.
3) If you're using <audio> then this is already taken care of.
If you google for the <audio> tag I think you'll find a lot of information,as well as strategies for providing alternative players to older browsers.

Multiple file uploader with previews

I'm trying to find something that will let users upload multiple files to a website. The requirements are that it let them easily select multiple files (preferably with something like check boxes) and that it displays a preview of the images they select.
I'd prefer to only use Javascript or Flash if possible, but Java is also an option (this needs to work on platforms where Silverlight isn't available).
So far all I've been able to find are things that use the native file selector (which doesn't show previews on Windows, and makes it unclear that you can select multiple by holding ctrl).
I'm not sure if the preview requirement is even possible, but it's the most important.
This is a firefox solution:
It uses the FileReader javascript object to load, display and upload images.
http://hacks.mozilla.org/2011/01/how-to-develop-a-html5-image-uploader/
It still doesnt show previews in the FileSelection dialog but at least allows you to preview the images before uploading.
And here is a ready made java applet solution:
http://jumploader.com/doc_overview.html
To upload multiple files I use RichFaces rich:fileUpload component.
Concerning the preview, I've got the similar problem and the best I found after couple of days of googling is following.
Alfresco has the same problem and resolved it with :
An open office which runs in server mode (socket) and all the office documents are sent by alfresco to open office in order to convert them in PDF
Those PDF are converted to .swf viewer thanks to SWFTOOLS
This .swf is integrated in the HTML
For images, it uses ImageMagick to create small version of the file I suppose
Personnaly, I will try to implement it this way :
Converting office documents to PDF thanks to open office in socket mode
Transform the first page of the PDF into a PNG thanks to JPedal library
Diplay that PNG to the end user
For images I would perhaps use ImageMagick too ... but for now, I'm using Seam Image.scaleToFit API
I am assuming 2 things here:
1) Some kind of client/enduser will be doing the file upload
2) You get some kind of say on what the client installs on their computer to help make this happen.
If this is the case, my first suggestion would be:
Give them FTP or SFTP client software to upload files. The php page you make can have a link to Filezilla, along with instructions on how to use it. ftp and sftp are THE protocols to use for transferring files. HTTP is just not designed(well) for it, nor are browsers.
Once the user has the (S)FTP client software installed, you can give them URL's to upload files to that are specific to their user account, and you can have a backend script process and load/move files that they upload. It's pretty easy to create a local temporary directory using a server side script, have the client upload files via ftp, then go back to the web browser and click a button that says "Done uploading, please process my stuff".
The browser can even give back confirmations on everything that gets uploaded/processed.

Categories