i'm developing android application which used camera feature. it can capture video fragment. But i found some problem with fragments < 1sec and didn't find any information about minimal video duration. Who knows something about it? What's minimal duration for video?
for record video limited video you can use following code, in this case video will recorded of 15 seconds
int VIDEORECORD=1;
int DURATION=15 /* time given IN seconds */
Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_VIDEO_CAPTURE); cameraIntent.putExtra(MediaStore.EXTRA_DURATION_LIMIT,DURATION); startActivityForResult(cameraIntent, VIDEORECORD);
Related
I want to capture the video through my application and also need extra information of captured video like Start time , end time , Quality of the video.
Currently I am using existing camera application to capture the video in my application , with sample code
static final int REQUEST_VIDEO_CAPTURE = 1;
private void dispatchTakeVideoIntent() {
Intent takeVideoIntent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
if (takeVideoIntent.resolveActivity(getPackageManager()) != null) {
startActivityForResult(takeVideoIntent, REQUEST_VIDEO_CAPTURE);
}
}
From above sample code , I am able to capture video and store on device but I am not getting any way to get that extra information?
Is it possible to get that extra info using existing camera application?
If yes then how else is there any other way to do this?
Is it possible to get that extra info using existing camera application?
No.
If yes then how else is there any other way to do this?
You are welcome to use the time that you call startActivityForResult() as the start time, the time you are called with onActivityResult() as the end time, and the quality that you request via EXTRA__VIDEO_QUALITY as the quality.
Or, write your own video recorder, using the camera APIs and MediaRecorder.
I have want to limit user to choose only videos with duration less then 60 seconds.
My code:
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("video/mp4");
intent.addCategory(Intent.CATEGORY_OPENABLE);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
}
I already able to do that during capture video by camera with next code:
Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
intent.putExtra(MediaStore.EXTRA_DURATION_LIMIT, 60);
I have want to limit user to choose only videos with duration less then 60 seconds.
Then you will need to implement your own UI for this, using MediaStore to try to find videos that meet your requirements, then display them for selection in a list or grid or something. ACTION_GET_CONTENT does not support arbitrary filters ("duration less than 60 seconds", "length less than 500MB", "starring Amanda Seyfried", etc.).
I already able to do that during capture video by camera with next code
No, you are able to request this. Camera apps that honor ACTION_VIDEO_CAPTURE should honor EXTRA_DURATION_LIMIT. They do not have to honor EXTRA_DURATION_LIMIT. The video that is recorded may be longer than your requested limit.
Is there a way we can extend the default video recording time on glass. The current recording time is only 10 seconds and we have to extend it manually by pressing the camera key for one second or by tapping and choosing Extend Video option. So i was wondering whether there is a flag that we can set when requesting the camera to start recording which will cause the camera to record an extended video.
I was also wondering how can we set the maximum time limit of video recording and what is the default time limit of video recording in glass ?
I am using the code below for starting the glass camera for video recording
Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
startActivityForResult(intent, CAPTURE_VIDEO_REQUEST_CODE);
Also if there isn't a possible way can anyone guide me on the alternatives. Is there any open source camera available which works for glass or should i have to write my own camera [any links that would help me get started] ?
Hope you get him idea from it:
Intent intent = new Intent(android.provider.MediaStore.ACTION_VIDEO_CAPTURE);
intent.putExtra("android.intent.extra.durationLimit", 60);
startActivityForResult(intent, CAPTURE_VIDEO_REQUEST_CODE);
This above code video duration is one minute,if u want to extend the video time then do it like that,and now the video duration is 2 minutes:
Intent intent = new Intent(android.provider.MediaStore.ACTION_VIDEO_CAPTURE);
intent.putExtra("android.intent.extra.durationLimit", 120);
startActivityForResult(intent, CAPTURE_VIDEO_REQUEST_CODE);
You can access the camera directly and record the video yourself. See the official Android documentation for more information: http://developer.android.com/guide/topics/media/camera.html#capture-video
I use an example of recording video using intent based on
Intent intent = new Intent(android.provider.MediaStore.ACTION_VIDEO_CAPTURE);
startActivityForResult(intent, REQUEST_VIDEO_CAPTURED);
For time limit I have used: intent.putExtra("android.intent.extra.durationLimit", 5);
This records 5 seconds and then stop automatically.
I have used example from URL:
http://android-er.blogspot.cz/2011/04/start-video-recording-using.html
This example is for me interesting because works on all my devices and is easy to implement.
Is it possible to set the path to save recorded video ?
Let's say simple I need video to save to a specified file "myrecordedvideo.mp4" to a specified folder and need video to have exactly 5 seconds. Is it possible to make it easy way with this Intent ?
To set the time limit and set the path to save the video
Intent takeVideoIntent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
takeVideoIntent.putExtra(MediaStore.EXTRA_DURATION_LIMIT, 30);
takeVideoIntent.putExtra(MediaStore.EXTRA_OUTPUT, Environment.getExternalStorageDirectory().getPath()+"videocapture_example.mp4");
startActivityForResult(takeVideoIntent, ACTION_TAKE_VIDEO);
In my application I'm trying to launch the Video with resolution set to minimum.
I'm using the EXTRA_VIDEO_QUALITY intent for that.
Here is the relevant code:
int NEW_VIDEO = 1;
Intent intent = new Intent(android.provider.MediaStore.ACTION_VIDEO_CAPTURE);
intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 0);
intent.putExtra(MediaStore.EXTRA_SIZE_LIMIT, 600000);
startActivityForResult(intent, NEW_VIDEO);
However, when the video camera starts it is set to the resolution that was previously defined in the device and ignores the EXTRA_VIDEO_QUALITY intent.
Does anybody encountered this issue before?
Thanks,
Yair
HTC Desire behaves same way with videos.
It also ignores uri if you want to define where to save the video. Capturing pictures works perfectly. I guess there is some mishap in Sense UI regarding video capture.