i have an activity where i display a video in Video view,Video view takes half of my screen, and i want in the other half to display frame by frame images(thumbnails) and to be able to trim the video in 10-15 seconds.
I have done a lot of research on google but i can't find a solution, please help it is very important ! where can i get a tutorial about this ?
this is how i show video on activity:
video_holder = (VideoView)findViewById(R.id.display_video);
Intent intent = getIntent();
String ur = intent.getStringExtra("videocrop");
Uri vid_uri = Uri.parse(ur);
video_holder.setVideoURI(vid_uri);
video_holder.start();
Try mp4parser library and you see ringdroid for audio
Related
So I am displaying video files from specific folder when the folder is selected but in the video list I am showing file name with the video thumbnail and that's where the problem starts i am using this way to get the thumb
Bitmap bmThumbnail = ThumbnailUtils.
extractThumbnail(ThumbnailUtils.createVideoThumbnail(info.getFilename(),
MediaStore.Video.Thumbnails.MINI_KIND), 60, 60);
if(bmThumbnail != null) {
imageView.setImageBitmap(bmThumbnail);}
and even if I don't set the bitmap or not the process is taking way too much time to open the new fragment whereas just displaying the name is smooth if I call the following bitmap it takes around 6-7 sec to display the list. The following thing are happening in the adapter as I test the app in adapter then recycler view
so I would like to know what is the best way to do it .
For using image loader i need the url which is not there as i am getting the album art using the file url but it will not produce the album art url directly.
Dealing with images and videos like that takes time. Particularly when dealing with a large group of them. It's unlikely you can speed up the operation but you can make it so your application doesn't have to wait for it by sending it to the background. I recommend Kotlin coroutines if you are up for converting to Kotlin. Otherwise I recommend making a thumbnail work manager
public class VideoThumbnailWorker extends Worker {
}
On my Android device I can take videos one of 2 ways:
1) I can write a custom class / set of methods that will allow me to utilize the camera and have direct control over the features
or
2) I can use an intent to open the video and take a recording.
This question is with regards to the latter (using an intent). This is the intent code I am using to take a video:
private void takeVideo(Activity activity, Context context){
//Actual intent used to capture the video
Intent takeVideoIntent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
//30 Second time limit (can make it anything, just using 30 here)
takeVideoIntent.putExtra(MediaStore.EXTRA_DURATION_LIMIT, 30);
//Utility method I have for generating a uri to use for the video
android.net.Uri myUri = generateVideoUri(context);
//Uri to use
takeVideoIntent.putExtra(MediaStore.EXTRA_OUTPUT, myUri);
//Cap it at 20mb
takeVideoIntent.putExtra(MediaStore.EXTRA_SIZE_LIMIT, 20000000L);
//HERE IS WHERE MY QUESTION LIES //0 is low, 1 is high
takeVideoIntent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 0);
activity.startActivityForResult(takeVideoIntent, 100);
}
The above code works just fine. My question is surrounding the quality.
If I send in 0 as the quality, it is absolutely horrible quality (IE, 10 seconds of video is about 0.3mb and appears to be the lowest quality the phone can handle). If I send in 1 as the quality, it is ungodly large and unwieldy (IE, 10 seconds of video is about 50mb).
Bearing in mind that some phone makers will ignore the intent extras sent, How do I go about getting medium quality video to use for uploads, messaging, etc?
Do I need to run some sort of compression on the large files?
Can this only be done via a custom video/ camera class?
Is there some other way I am not thinking of?
What would you recommend I do to get a "medium quality" video as opposed to the 2 extremes of way too large or way too small?
Thanks all!
How to have a video Track from an image (Bitmap) on Android?
I need to add an image at end of my video.. for 5 seconds
Thanks
The terminology for what comes after a video is called a "Post Roll" (or before a video, "Pre Roll"). This will help you in future searching.
If you are attempting to use an Image as your Post Roll, this will not work as it says at the very bottom of their GitHub page.
So what can you do?
As they also say on that page, you can "Append Recordings with Same Encode Settings". So you can encode your image as a video with the:
SAME resolutions
SAME frame-rates
as your main video, then they will chain properly.
I am developping an Android application and I encouter problem to get thumbnail of video.
My question is simple. I know how to get thumbnail for Youtube or Dailymotion but is there a way to do the same for a video like this one : http://download.wavetlan.com/SVV/Media/HTTP/MP4/ConvertedFiles/MediaCoder/MediaCoder_test3_1m10s_MPEG4SP_VBR_516kbps_320x240_25fps_MPEG1Layer3_CBR_320kbps_Stereo_44100Hz.mp4
I want to get a frame at time T for every video.
I tried this :
Bitmap thumb = ThumbnailUtils.createVideoThumbnail(m_Video.getM_Urlvideo(),
MediaStore.Images.Thumbnails.MINI_KIND);
m_Video.getM_Urlvideo() is returning my video url..
It doesn't work, anyone has an idea ?
Thank you
I am trying to create a video thumbnail for a file :
1- the file is located on YouTube.
2- I would start an implicit intent for Andriod OS to play this file using:
Intent intent= new Intent(Intent.ACTION_VIEW, Uri.parse(youTubeVideoWebPath));
startActivity(intent);
where
String youTubeVideoWebPath = "http://www.youtube.com/watch?feature=player_detailpage&v=OZJalBmtGnQ";
after searching some posts on the forum, I found it could be either:
1- VideoView and set its background with the Thumbnail that I will extract from the video Or
2- ImageView which sets its source/background with the extracted Thumbnail
when an item (whether VideoView or ImageView) is clicked, I will send the previous mentioned intent.
since I am not going to control playing the video by my application, I guess that it is better to use ImageView, right?
Secondly,
I would like to create a video Thumbnail for that remote file so what is the best/easiest way to do that?
For me, after doing more search on the forum, I found the following method:
Bitmap thumbAsBitmap = ThumbnailUtils.createVideoThumbnail(filePath, MediaStore.Video.Thumbnails.MINI_KIND);
But it always returns null, I dont know why although that I passed it:
filePath: the web path of the file mentioned above
second argument: not sure whether it should be MediaStore.Video.Thumbnails.MINI_KIND or
MediaStore.Images.Thumbnails.MINI_KIND?
I can only find posts related to extracting VideoThumbnail from files saved in internal/external memory, nothing related to remote files such as my case.
Why not fetch YouTube thumbnail? It looks quite simple. Once you got video URL, like this:
https://www.youtube.com/watch?v=dRpFF5Dm-k0
you extract video ID (which in this case is dRpFF5Dm-k0) and your thumbnail is at:
http://i1.ytimg.com/vi/<VIDEOID>/default.jpg
so in this case:
http://i1.ytimg.com/vi/dRpFF5Dm-k0/default.jpg
Not sure if that works for any video (I just found that out to answer your question), but at least it is a good start :)