android视频录制 启动一个包名

来源:互联网 发布:yy上的网络兼职是真的吗 编辑:程序博客网 时间:2024/04/29 14:11

http://blog.csdn.net/nokiaguy/article/details/41626425


大家可以进入shell。或干脆直接用adbshell执行命令。该命令是screenrecord,可以输入screenrecord --help,看看帮助,如下所示。

 

Usage: screenrecord [options] <filename>

Android screenrecord v1.2.  Records the device's display to a .mp4 file.

Options:

 

--size WIDTHxHEIGHT

    Set the videosize, e.g. "1280x720".  Defaultis the device's main

    displayresolution (if supported), 1280x720 if not. For best results,

    use a sizesupported by the AVC encoder.

 

--bit-rate RATE

    Set thevideo bit rate, in bits per second. Value may be specified as

    bits ormegabits, e.g. '4000000' is equivalent to '4M'. Default 4Mbps.

 

--bugreport

 

    Addadditional information, such as a timestamp overlay, that is helpful

    in videoscaptured to illustrate bugs.

 

--time-limit TIME

    Set themaximum recording time, in seconds. Default / maximum is 180. 

--verbose

    Displayinteresting information on stdout.

 

--help

    Show thismessage.

Recording continues until Ctrl-C is hit or the timelimit is reached.

 

     从这些帮助信息可以了解到,screenrecord需要后面跟一个mp4文件名。最简单的形式如下:

screenrecord /sdcard/game.mp4   

但要注意,mp4要写入的目录必须是可写的。

     输入完命令后,直接按回车,命令会被阻塞,默认什么都不会输出,这是正在录制呢。操作手机的所有画面都会被录制下来。如果要输出相应的信息,需要加--verbose命令行参数,加该命令行参数,整个录制过程可能会输出如下类似的信息。

 

Main display is 1080x1920 @60.00fps (orientation=0)

Configuring recorder for 1080x1920 video/avc at4.00Mbps

Content area is 1080x1920 at offset x=0 y=0

 

^CEncoder stopping; recorded 68 frames in 12 seconds

Stopping encoder and muxer

Executing: /system/bin/am broadcast -aandroid.intent.action.MEDIA_SCANNER_SCAN_FILE -d file:///sdcard/test.mp4

Broadcasting: Intent {act=android.intent.action.MEDIA_SCANNER_SCAN_FILE dat=file:///sdcard/test.mp4 }

Broadcast completed: result=0

当然,可以跟很多选项,常用的就是--size(尺寸)、--bit-rate(比特率)和--time-limit(录制最大时间)

 

尺寸默认是当前手机屏幕分辨率、比特率是默认4Mbps、录制时间默认是3分钟(180秒)

screenrecord --time-limit 100    /sdcard/game.mp4

      上面的命令最大可录制100秒的视频。如果想中途停止录制,可按Ctrl C,终止录制,game.mp4仍然会生成,但只会录制从开始录制到按Ctrl-C这段时间的视频。


大家可以进入shell。或干脆直接用adbshell执行命令。该命令是screenrecord,可以输入screenrecord --help,看看帮助,如下所示。

 

Usage: screenrecord [options] <filename>

Android screenrecord v1.2.  Records the device's display to a .mp4 file.

Options:

 

--size WIDTHxHEIGHT

    Set the videosize, e.g. "1280x720".  Defaultis the device's main

    displayresolution (if supported), 1280x720 if not. For best results,

    use a sizesupported by the AVC encoder.

 

--bit-rate RATE

    Set thevideo bit rate, in bits per second. Value may be specified as

    bits ormegabits, e.g. '4000000' is equivalent to '4M'. Default 4Mbps.

 

--bugreport

 

    Addadditional information, such as a timestamp overlay, that is helpful

    in videoscaptured to illustrate bugs.

 

--time-limit TIME

    Set themaximum recording time, in seconds. Default / maximum is 180. 

--verbose

    Displayinteresting information on stdout.

 

--help

    Show thismessage.

Recording continues until Ctrl-C is hit or the timelimit is reached.

 

     从这些帮助信息可以了解到,screenrecord需要后面跟一个mp4文件名。最简单的形式如下:

screenrecord /sdcard/game.mp4   

但要注意,mp4要写入的目录必须是可写的。

     输入完命令后,直接按回车,命令会被阻塞,默认什么都不会输出,这是正在录制呢。操作手机的所有画面都会被录制下来。如果要输出相应的信息,需要加--verbose命令行参数,加该命令行参数,整个录制过程可能会输出如下类似的信息。

 

Main display is 1080x1920 @60.00fps (orientation=0)

Configuring recorder for 1080x1920 video/avc at4.00Mbps

Content area is 1080x1920 at offset x=0 y=0

 

^CEncoder stopping; recorded 68 frames in 12 seconds

Stopping encoder and muxer

Executing: /system/bin/am broadcast -aandroid.intent.action.MEDIA_SCANNER_SCAN_FILE -d file:///sdcard/test.mp4

Broadcasting: Intent {act=android.intent.action.MEDIA_SCANNER_SCAN_FILE dat=file:///sdcard/test.mp4 }

Broadcast completed: result=0

当然,可以跟很多选项,常用的就是--size(尺寸)、--bit-rate(比特率)和--time-limit(录制最大时间)

 

尺寸默认是当前手机屏幕分辨率、比特率是默认4Mbps、录制时间默认是3分钟(180秒)

screenrecord --time-limit 100    /sdcard/game.mp4

      上面的命令最大可录制100秒的视频。如果想中途停止录制,可按Ctrl C,终止录制,game.mp4仍然会生成,但只会录制从开始录制到按Ctrl-C这段时间的视频。







http://blog.csdn.net/chenlang888/article/details/41623241

  1. 你可以试试在cmd下执行下面的命令:  
  2.   
  3. 微信  
  4.   
  5. adb shell "am start -n com.tencent.mm/com.tencent.mm.ui.LauncherUI"  
  6.   
  7. 手机QQ  
  8.   
  9. adb shell "am start -n com.tencent.mobileqq/com.tencent.mobileqq.activity.SplashActivity"  
  10.   
  11. 微博  
  12.   
  13. adb shell "am start -n com.sina.weibo/com.sina.weibo.SplashActivity"  
  14.   
  15. QQ空间  
  16.   
  17. adb shell "am start -n com.qzone/com.tencent.sc.activity.SplashActivity"  
  18.   
  19. 不过如果你可以直接看到程序项目中的AndroidManifest.xml或者可以直接问开发,那这篇文章你就压根不用看了。  
  20.   
  21. DONE!  

0 0