[MOD] Nexus 7 720p Video Recording

Search This thread

fattire

Inactive Recognized Developer
Oct 11, 2010
2,281
6,473
www.eff.org
For anyone who is trying to build using my CM10 build instructions, you may have noticed the camera launcher for nexus 7 doesn't work with this error:

E/AndroidRuntime(12801): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.modaco.cameralauncher/com.modaco.cameralauncherActivity}: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.google.android.gallery3d/com.android.camera.Camera}; have you declared this activity in your AndroidManifest.xml?

I believe this is because CM10 is replacing the google (gapps) gallery with Gallery2.

CM10 users. Try this from adb shell:

$ am start -n com.android.gallery3d/com.android.camera

(don't type the $)

720p camera launches for me. If anyone knows modaco, tell them to check if com.google.android.gallery3d is installed, and if not, use com.android.gallery3d instead!

Or maybe I could just write it and we could put it in the cm10 grouper device. Should be pretty easy.

Anyway, the 720p camera seems to work for me too on cm10. Nice job.
 
Last edited:

hillbeast

Inactive Recognized Developer
Feb 9, 2011
2,719
6,790
Dunedin
For anyone who is trying to build using my CM10 build instructions, you may have noticed the camera launcher for nexus 7 doesn't work with this error:

E/AndroidRuntime(12801): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.modaco.cameralauncher/com.modaco.cameralauncherActivity}: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.google.android.gallery3d/com.android.camera.Camera}; have you declared this activity in your AndroidManifest.xml?

I believe this is because CM10 is replacing the google (gapps) gallery with Gallery2.

CM10 users. Try this from adb shell:

$ am start -n com.android.gallery3d/com.android.camera

(don't type the $)

720p camera launches for me. If anyone knows modaco, tell them to check if com.google.android.gallery3d is installed, and if not, use com.android.gallery3d instead!

Or maybe I could just write it and we could put it in the cm10 grouper device. Should be pretty easy.

Anyway, the 720p camera seems to work for me too on cm10. Nice job.

I think there is something defined in the framework somewhere that will detect whether to show the camera shortcut or not. I'd first check the gallery application itself and if not it'll be in the framework. I looked all through the device project for grouper there is no mention anywhere for it. Maybe it detects if its a front camera only?

Sent from my Nexus 7 using xda app-developers app
 

fattire

Inactive Recognized Developer
Oct 11, 2010
2,281
6,473
www.eff.org
I think there is something defined in the framework somewhere that will detect whether to show the camera shortcut or not. I'd first check the gallery application itself and if not it'll be in the framework. I looked all through the device project for grouper there is no mention anywhere for it. Maybe it detects if its a front camera only?

I don't see anything in the Gallery2 source -- or in the config.xml in frameworks... but I'll keep looking and maybe ask someone if I can't find it (and you don't beat me to it). I'm assuming it's unrelated to the USE_CAMERA_STUB set in the BoardConfig which apparently gets overridden by the existence of the props... I wish I were more familiar with how Android enables/disables icons... I'll ask around.

Update:

adb shell
$ su
# pm enable com.android.gallery3d/com.android.camera.CameraLauncher
Component {com.android.gallery3d/com.android.camera.CameraLauncher} new state: enabled


We just need to make this the default config. Thanks to intervigil for the tip.
 
Last edited:

fattire

Inactive Recognized Developer
Oct 11, 2010
2,281
6,473
www.eff.org
Hmmm....

in packages/apps/Camera/src/com/android/camera/DisableCameraReceiver.java:

-----

// We want to disable camera-related activities if there is no camera. This
// receiver runs when BOOT_COMPLETED intent is received. After running once
// this receiver will be disabled, so it will not run again.
public class DisableCameraReceiver extends BroadcastReceiver {
private static final String TAG = "DisableCameraReceiver";
private static final boolean CHECK_BACK_CAMERA_ONLY = false;
private static final String ACTIVITIES[] = {
"com.android.camera.CameraLauncher",
};

@Override
public void onReceive(Context context, Intent intent) {
// Disable camera-related activities if there is no camera.
boolean needCameraActivity = CHECK_BACK_CAMERA_ONLY
? hasBackCamera()
: hasCamera();

if (!needCameraActivity) {
Log.i(TAG, "No sensors detected and so, disable all camera activities/CameraLauncher");
for (int i = 0; i < ACTIVITIES.length; i++) {
disableComponent(context, ACTIVITIES);
}
}


I think that's the problem. N7 has a front camera but no back camera.
 
Last edited:

hillbeast

Inactive Recognized Developer
Feb 9, 2011
2,719
6,790
Dunedin
Hmmm....

in packages/apps/Camera/src/com/android/camera/DisableCameraReceiver.java:

-----

// We want to disable camera-related activities if there is no camera. This
// receiver runs when BOOT_COMPLETED intent is received. After running once
// this receiver will be disabled, so it will not run again.
public class DisableCameraReceiver extends BroadcastReceiver {
private static final String TAG = "DisableCameraReceiver";
private static final boolean CHECK_BACK_CAMERA_ONLY = false;
private static final String ACTIVITIES[] = {
"com.android.camera.CameraLauncher",
};

@Override
public void onReceive(Context context, Intent intent) {
// Disable camera-related activities if there is no camera.
boolean needCameraActivity = CHECK_BACK_CAMERA_ONLY
? hasBackCamera()
: hasCamera();

if (!needCameraActivity) {
Log.i(TAG, "No sensors detected and so, disable all camera activities/CameraLauncher");
for (int i = 0; i < ACTIVITIES.length; i++) {
disableComponent(context, ACTIVITIES);
}
}


I think that's the problem. N7 has a front camera but no back camera.


I think add a define in the BoardConfig.mk, something like FORCE_CAMERA_SHORTCUT=y, and do

Code:
#ifndef FORCE_CAMERA_SHORTCUT
        if (!needCameraActivity) {
            Log.i(TAG, "No sensors detected and so, disable all camera activities/CameraLauncher");
            for (int i = 0; i < ACTIVITIES.length; i++) {
                disableComponent(context, ACTIVITIES[i]);
            }
        }
#endif

Or however that code would work in Java. I don't know anything about Java so I'm just going by how I'd do it in C.
 

thoughtlesskyle

Inactive Recognized Developer
Nov 26, 2008
6,388
4,407
Outside of Philadelphia
is there anyway you could upload the camera APK from your rom, i want to make a flashable zip for this

Edit: Actually I am using cm10 so I shouldn't need the apk then should I?
 
Last edited:

hillbeast

Inactive Recognized Developer
Feb 9, 2011
2,719
6,790
Dunedin
is there anyway you could upload the camera APK from your rom, i want to make a flashable zip for this

Edit: Actually I am using cm10 so I shouldn't need the apk then should I?

There is no more Camera apk in JB. The file that needs to be changed is specified in the OP. Please read the OP.

Sent from my GT-I9100 using xda app-developers app
 

maverik410

Senior Member
Nov 3, 2008
89
6
hereford
Hi all
i have tried this and got it working then i messed up i deleted the media_profiles.xml by mistake
could some one upload the file for me so i can put it back :crying:

thanks in advance
 

donpippo

Senior Member
Jan 6, 2012
141
20
Last edited:

blownart

Member
Aug 23, 2010
22
1
Works perfectly, and yes people you need to reboot.
However I noticed a bug with this mod today, if you leav quality on 720p and turn time lapse on, the camera app will crash, and you will not be able to select video recording again even if you uninstall the camera app. However I managed t fix it by further editing the media_profiles.xml files.
So here is the fix:
Code:
<EncoderProfile quality="timelapse480p" fileFormat="3gp" duration="30"> 
     <Video codec="h264" 
            bitRate="4000000" 
            width="640" 
            height="480"
             frameRate="30" />
      <!--          
The Audio part of the profile will not be used since time lapse mode 
         does not capture audio  
    -->    
  <Audio codec="aac" 
            bitRate="96000" 
            sampleRate="44100" 
            channels="1" /> 
   </EncoderProfile>

+   <EncoderProfile quality="timelapse720p" fileFormat="3gp" duration="30"> 
+   <Video codec="h264" 
+                 bitRate="16000000"
+                 width="1280"           
+                 height="720" 
+                 frameRate="30" />
+   <!--          The Audio part of the profile will not be used since time lapse mode
+         does not capture audio  
+    -->    
+  <Audio codec="aac"  
+          bitRate="96000" 
+          sampleRate="44100"
+             channels="1" />
+    </EncoderProfile>
 
  • Like
Reactions: ogdobber

cyr0s

Senior Member
Apr 28, 2012
84
88
Thanks for this, it looks really nice. I'll be updating n7ui tomorrow to automate this patch.
 

hillbeast

Inactive Recognized Developer
Feb 9, 2011
2,719
6,790
Dunedin
Works perfectly, and yes people you need to reboot.
However I noticed a bug with this mod today, if you leav quality on 720p and turn time lapse on, the camera app will crash, and you will not be able to select video recording again even if you uninstall the camera app. However I managed t fix it by further editing the media_profiles.xml files.
So here is the fix:
Code:
<EncoderProfile quality="timelapse480p" fileFormat="3gp" duration="30"> 
     <Video codec="h264" 
            bitRate="4000000" 
            width="640" 
            height="480"
             frameRate="30" />
      <!--          
The Audio part of the profile will not be used since time lapse mode 
         does not capture audio  
    -->    
  <Audio codec="aac" 
            bitRate="96000" 
            sampleRate="44100" 
            channels="1" /> 
   </EncoderProfile>

+   <EncoderProfile quality="timelapse720p" fileFormat="3gp" duration="30"> 
+   <Video codec="h264" 
+                 bitRate="16000000"
+                 width="1280"           
+                 height="720" 
+                 frameRate="30" />
+   <!--          The Audio part of the profile will not be used since time lapse mode
+         does not capture audio  
+    -->    
+  <Audio codec="aac"  
+          bitRate="96000" 
+          sampleRate="44100"
+             channels="1" />
+    </EncoderProfile>

Yes I'm aware of this. This fix was submitted when I committed to CM. Still waiting for it to be merged.

Sent from my GT-I9100 using xda app-developers app
 

zaclimon

Inactive Recognized Contributor
Aug 14, 2011
4,365
7,292
Montréal
Hi I want to know if this is applicable to any device with a decent camera (I want to use 720p recording to the samsung YP-G1)

Thanks.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 149
    So I just got 720p video recording working on my Nexus 7 and felt you guys should know about this too. It's a simple fix as it's not a limitation of hardware or a kernel function or anything, rather it's just Google didn't add the media profile for 720p to tell it how to use 720p.

    What firmware does this need?

    It doesn't matter. If you're on the original N7 firmware or the latest builds from Google, it still works just fine. I'm now on JOP40C and it works just fine. One update.zip fits all. I do suggest keeping your original file as a backup though as it plays up with OTA updates if you have this mod installed.

    You don't need to install this if you are running a CM based firmware (CM10, etc) as I have pushed the patch to the CM repositories and it will be preloaded on your Nexus 7. And no, it's not them stealing credit, I pushed the patch to them.


    Download Link

    Update.zip: http://d-h.st/8Cw

    Video For Your Delectation

    16
    media_profiles.xml got updated with JOP40C. hillbeast will have to update the OP with new files. ;) :good:
    No need. Works fine. Tested it myself and it works fine with no negative ramifications.


    Here is what changed between JZO54K and JOP40C. Just 3 lines with a higher min framerate for the video codecs. Nothing extreme I guess, but could improve the encoding quality just slightly.

    Attached are recovery flashable zips of your patched xml altered to reflect the JOP40C changes, and the Undo to revert back to 4.2 stock. JOP40D, JDQ39, and JWR66V are still exactly the same as this.

    Edit: All stock KitKat builds also still have the same codec file as JOP40D.

    [ Attachments removed since all custom ROMs now contain these fixes ]
    7
    I have paranoid rom installed and there is 720p recording and it works out of the box, is this same like that or this is maybe better.
    Sent from my Nexus 7 using xda app-developers app

    The 720p recording in all the ROMs now is because I submitted this page to CM. Any CM ROM has this mod now.

    Sent from my Galaxy S2
    6
    Nexus 7 720p Camera Instructions - no PC needed (rooted users only)

    So I just got 720p video recording working on my Nexus 7 and felt you guys should know about this too.

    720p video picture

    Here are my instructions to do this without using a PC(for rooted users):
    I used ES File Expolorer (nice program available in the play store)
    1- Open ES File Explorer and head to /system/etc/
    2- Find the file media_profiles.xml and copy it (long press the file and select copy from the menu)
    3- Go into any other directory and paste it there (temporarily)
    4- Go back to the /system/etc/ directory again and rename the media_profiles.xml to media_profiles.xml.old and save it (long press the file and select rename from the menu
    5- Now go back to the directory you copied the file to and long press it. When the menu comes up select cut and go to the /system/etc directory and hit paste up at the top
    6- Now just click on the file you just pasted and a list of editors will pop up.
    7- Select ES Note Editor (it comes with ES File Explorer) and locate the section in the file where it says
    Code:
        <EncoderProfile quality="480p" fileFormat="3gp" duration="30">
          <Video codec="h264"
                 bitRate="4000000"
                 width="640"
                 height="480"
                 frameRate="30" />
    
          <Audio codec="aac"
                 bitRate="96000"
                 sampleRate="44100"
                 channels="1" />
        </EncoderProfile>

    8- Add this code right after
    Code:
        <EncoderProfile quality="720p" fileFormat="3gp" duration="30">
          <Video codec="h264"
                 bitRate="16000000"
                 width="1280"
                 height="720"
                 frameRate="30" />
    
          <Audio codec="aac"
                 bitRate="128000"
                 sampleRate="48000"
                 channels="1" />
        </EncoderProfile>
    9- Once added click the back button on the bottom and a menu will show up on the bottom that asks you to save click that.
    10- Long press the file you just saved and select Properties at the bottom and make sure you give it the correct permissions (rw-r--r-- or chmod 644) by clicking the change button. There should be 4 check marks on that screen User read, User write, Group read, Other read. Click ok and ok again to save it.
    11- Reboot and enjoy.
    Don't thank me for this - thank hillbeast. If my instructions helped you then thank me too. Lol.



    Thanks hillbeast - I also noticed that you cannot take a screenshot while in the camera program - gives you a sd card storage in use error. So I took this with my SGS2.
    4
    hey hillbeast, post this one, I credited you in the updater-script
    goo.im- http://tinyw.in/udKH
    or from dev-host-http://d-h.st/hmD