What are the types of video encoding/resolution available?

Put your problem here if it does not fit any of the other categories.

What are the types of video encoding/resolution available?

Postby imso » Tue Apr 19, 2011 3:50 pm

Could someone name me the various types of video encoding/resolution type available for encoding/resolution video recording purposes in android? Like mp4, etc...

Now that i think of it is it possible for me to retrieve my phone's camera resolution for user to use for preferences purposes? Does it have to do with flatten something thingy, i'm not quite sure what its called..

If so how should i retrieve a particular phone's resolution for ListPreference?? Can someone guide me on this?

This is the java file that performs the recording process
Code: Select all
public class ServiceRecording extends Service {

   @Override
   public IBinder onBind(Intent intent) {
      // TODO Auto-generated method stub
      return null;
   }
   
   private SurfaceView surfaceView;
   private SurfaceHolder surfaceHolder;
   public static Camera ServiceCamera;
   public static boolean recordingStatus;
   
    @Override
    public void onCreate() {
       super.onCreate();
       
       recordingStatus = false;
       ServiceCamera = CameraTest.MainCamera;
       surfaceView = CameraTest.surfaceView;
       surfaceHolder = CameraTest.surfaceHolder;
    }
   
    @Override
    public int onStartCommand(Intent intent, int flags, int startId) {
       super.onStartCommand(intent, flags, startId);
       if (recordingStatus == false)
          startRecording();
   
       return START_STICKY;
    }
   
    @Override
    public void onDestroy() {
       super.onDestroy();
   
       stopRecording();
       //camera.stopPreview();
       recordingStatus = false;
       //camera.release();
    }   
   
   private MediaRecorder mediaRecorder;
    private final int maxDurationInMs = 20000;
   
    private static final String TAG = "Exception";
   
    public boolean startRecording(){
       try {
             Toast.makeText(getBaseContext(), "Recording Started", Toast.LENGTH_SHORT).show();
             try{
                ServiceCamera.reconnect();
                ServiceCamera.unlock();
             }
             catch(Exception e){
                
                   
             }
             
             mediaRecorder = new MediaRecorder();
             
             mediaRecorder.setCamera(ServiceCamera);
             
             mediaRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
   
             mediaRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
   
             mediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.DEFAULT);
                
             mediaRecorder.setMaxDuration(maxDurationInMs);
                             
                mediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.DEFAULT);
                
                mediaRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.DEFAULT);
                
                //mediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.DEFAULT);
                SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH_mm_ss");
                Date date = new Date();
                File dirlist = new File(Environment.getExternalStorageDirectory() + "/VideoList");
                
                if(!(dirlist.exists()))
                   dirlist.mkdir();
                   
                File TempFile = new File(Environment.getExternalStorageDirectory() + "/VideoList", dateFormat.format(date) + ".3gp");
                mediaRecorder.setOutputFile(TempFile.getPath());
                
                mediaRecorder.setVideoSize(surfaceView.getWidth(),surfaceView.getHeight());
                
                //mediaRecorder.setVideoFrameRate(videoFramesPerSecond);
                
                mediaRecorder.setPreviewDisplay(surfaceHolder.getSurface());
                         
                mediaRecorder.prepare();
                mediaRecorder.start();   
                
                recordingStatus = true;
                
                return true;                  
       }
       
       catch (IllegalStateException e) {
          Log.d(TAG,e.getMessage());
          e.printStackTrace();
          return false;
       }
       catch (IOException e) {
          Log.d(TAG,e.getMessage());
          e.printStackTrace();
          return false;
       }
    }
   
    public void stopRecording() {
       Toast.makeText(getBaseContext(), "Recording Stopped", Toast.LENGTH_SHORT).show();   
       
       mediaRecorder.reset();
       mediaRecorder.release();
       
       recordingStatus = false;
    }
}

My Tab1Activity.java file which initialized the preference but how am i going to allow the storage of user data for
configuring the camera setting
Code: Select all
public class Tab1Activity extends PreferenceActivity {
   
   @Override
   public void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);   
       addPreferencesFromResource(R.xml.tab1);
       
   }
}

This is the xml file which uses preferences but i'm kinna face with the problem on how am i going to retrieve the available phone resolution to allow the user to configure at the ListPreference area..
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
   <PreferenceCategory
                android:title="Video">
                <CheckBoxPreference
                        android:title="Audio"
                        android:defaultValue="True"
                        android:summary="Select w/o Audio"
                        android:key="AudioPref" />
                <ListPreference
                        android:title="Video Encoder"
                        android:summary="Select the video encoding type"
                        android:key="EncodingPref"
                        android:defaultValue="3gp"
                        android:entries="@array/EncodingType"
                        android:entryValues="@array/updateEncodingType" />
                <ListPreference
                        android:title="Video Resolution"
                        android:summary="Select the video resolution"
                        android:key="ResolutionPref"
                        android:defaultValue="1"
                        android:entries="@array/VideoResolution"
                        android:entryValues="@array/updateVideoResolution" />
        </PreferenceCategory>       
</PreferenceScreen>
imso
Developer
Developer
 
Posts: 49
Joined: Mon Mar 21, 2011 10:47 am

Top

Re: What are the types of video encoding/resolution availabl

Postby imso » Wed Apr 20, 2011 8:19 am

can someone reply and answer my question?
imso
Developer
Developer
 
Posts: 49
Joined: Mon Mar 21, 2011 10:47 am

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 12 guests