Load thumbnails for video - JavaFx - java

In JavaFx we can load images easily from an external server:
imageView.setImage(new Image("http://...File.png"));
But is there a way to load the thumbnail of videos?
Something like: imageView.setImage(new Image("http://...File.mp4"));
I'm developing something like a "gallery" and would like to load the thumbnails of videos coming straight from my server, is it possible?

An mp3 or mp4 file can have an embedded thumbnail image as part of its metadata. There are third party libraries for reading mp3 / mp4 metadata. For example:
How to retrieve thumbnail picture of an mp3 file using java
App Engine Java - Extract thumbnail from mp4 video
If the file doesn't have a thumbnail, then you could conceivably pick a frame of the video and use it as a thumbnail, but the chances of picking an appropriate frame (i.e. one that is indicative of the movie) without the assistance of a human being are not great. But here is an example:
Extract Thumbnail for specific second from MP4 file in Android
But how do you make a video that is not local without downloading it altogether?
Approach #1: pick a 3rd-party metadata extraction library that can operate in stream mode. The metadata should be at / near the start of the stream.
Approach #2: get the server to do the extraction, and present you with the thumbnail separately from the main video.

Related

Vlcj audio only player

I am creating a chat application where the user can send audio and video files.
For my video files I have successfully created an embedded video player in my app which will play any video.
But for my audio files I don't want to use an embedded video player with options vout=dummy instead I want to be optimized and use an DirectAudioPlayer for my purposes. I took a look at the MediaFactory create but i don't understand how am I suppose to retrieve these parameters for an specific file.
What I want is just one direct audio player in my application which I can reuse for multiple audio files or is this not possible?
You can use a HeadlessMediaPlayer.
This is basically the same as the EmbeddedMediaPlayer that you're already using, but with no API to do with displaying the video.
A word of caution though if you play a video through the HeadlessMediaPlayer, rather than just an audio file, LibVLC will open a native window and play the video - you can suppress this by passing "--no-video" via the MediaPlayerFactory.
The DirectAudioPlayer is used when you want to access the audio buffer in your application - i.e. "direct" access to the native audio buffer. You would then have to use JavaSound or something to actually play the audio. So I don't think this is what you want.

Does opentok provide thumbnails for archives?

I have the opentok-archiving sample application set up. While playing the archives, I need thumbnails for the archive. Does OpenTok provide thumbnails?
Currently, I think the only way is to setup Archiving URL callback, and once the archive status is changed to uploaded, I need to get a thumbnail out of the video on my backend.
Are there any other better ways to go about this?
(Myself: tokbox developer)
No, OpenTok does not provide a thumbnail of the archives. However, you can create the thumbnails yourself very easily with ffmpeg.

Where to store local video for playback in Android Studio

I am making a simple video playback application in Android Studio. The video is approximately 600MB, and has an appropriate title (no spaces etc.). The video will be played back using VideoView.
Where should the video be saved? When it is placed in src/res/raw, (like other files I am using such as .wav for sound effects), it creates resource errors. Do I create a new folder called assets and store the videos there?
Noooo. You will not put that video in your apk. Will your app exceed 600mb size on playstore. See on google documentation.
Google Play currently requires that your APK file be no more than 100MB
Solution:
First try to compress your video, as you don't need high resolution video.
Put video on cloud (like Amazon s3 bucket).
Download this video file at run time in device from Amazon. And then play it anywhere from device storage.

Java: Render video with extra box on it.

I have got a mpg video file from a camera and I'd like to import this file to java application which should do some things on it and save new video file with apply all operation.
What I want to do exactly:
Below is a sample frame from my video.
And after imported video, java app should add some content at the bottom of video(for each frame) like fps, date etc. I know that this information can be extracted by openCv, but it's not my problem. I don't know how to make such a content and add it to a video and render to external mpg file. I prepare a simple demonstration how should look the output video after render by my app.

Getting thumbnails from android gallery - sdcard

I have the absoluite path of an image file name in sdcard. Is there a way to get the thumbnail of it just like the way they show in android gallery? The reason i need is I have few images selected from the android gallery and http post it to a server. If the size of the file is huge, it takes a long time to upload because of slow mobile data. Instead of the file, if i can get the thumbnail of it, it will be easy to upload.
I can work on image resize to resize the image on my own before uploading it. But I would like to explore if there is a easier way?

Categories