Android joins the new video format-Media Library scan

Source: Internet
Author: User

Requirements: Add the. mov suffix format video file to the Mediaprovider database

Be able to use tool Mediainfo_gui_0.7.67_windows.3243836749.exe to view MOV file encoding format type, be able to download to http://download.csdn.net/detail/deng0zhaotai/8767089.


Full Name: D:\ Good song learners together. mov file format: MPEG-4 format Simple Introduction                                     : QuickTime encoding settings id:qt file size                                     : 83.8 MIB Length: 1 min 2 s average mixed bitrate: 11.3 Mbps encoded date : UTC 2015-04-23 06:07:05 Mark Date: UTC 2015-04-23 06:08                                      : 38 Encoding Function library: Apple QUICKTIME㏕IM:00:00:00:00㏕SC                                       : 25㏕sz:1 Video ID                                     : 1 file format: AVC file Format/info: Advanced Video codec Format Brief introduction                           : [email protected] Formatting, CABAC: No format settings, reframes : 2 frames format settings, gop:m=1, n=50 encoding settings ID:AVC1 encoding settings ID/info                                       : Advanced Video Coding Length: 1 min. 2 sec Bit Rate  : 11.2 Mbps Screen width: 1 920 megapixel screen height: 1                                       080 MP Screen ratio: 16:9 frame rate Mode: constant frame rate : 25.000 fps color space: YUV Chroma Sample: 4:2:                 0-bit Depth: 8-bit scanning mode: Progressive scan bits/(pixel*frame) (data density) : 0.216 Size: 82.8 MiB (99%) title: Apple View Frequency Media Processor/Apple alias data processing program language: English Date: UTC 2  015-04-23 06:07:05 Mark Date                                   : UTC 2015-04-23 06:08:38 color primaries: bt.709 transmission characteristics                                       : bt.709 Matrix factor: bt.709 Audio ID : 2 file Format: AAC file Format/info: Advanced Audio codec format simple                                       Description: LC Encoding Set ID:40 length                                       : 1 minutes 2 seconds source_duration/string:1 Minute 2 second code rate mode: CBR bitrate                                       : Rated bitrate:-Kbps channel                                     : 2 channel Channel position: FRONT:L R sample rate: 48.0 khz compression mode                 : lossy compression Size: 909 KiB (1) source_streamsize/string : 909 KiB (1%) Title: Apple Audio Media processing program/Apple alias Data Processor language: ENGL Ish encoded on: UTC 2015-04-23 06:07:05 Date: UTC 2015-0                                     4-23 06:08:38 Other id:3type:time code file formats                      : QuickTime TC Length: 1 min 2 sec timecode_firstframe : 00:00:00:00timecode_settings:striped Title: Time Code Media Handler/Apple alias data processing program language: English Date: UTC 2015 -04-23 06:08:38 Mark Date: UTC 2015-04-23 06:08:38
Be able to see two useful information

File format: MPEG-4
Format brief: QuickTime

Files that need to be changed: Frameworks/base/media/java/android/media/mediafile.java, we are able to participate in the existing video format

Video file types public    static final int file_type_flv     =;    public static final int file_type_mp4     =;    public static final int file_type_m4v     =;    public static final int file_type_3gpp    =;    public static final int file_type_3gpp2   =;    public static final int file_type_wmv     =;    public static final int file_type_asf     =;    public static final int file_type_mkv     =;    public static final int file_type_mp2ts   =;    public static final int File_type_avi     =;    public static final int FILE_TYPE_WEBM    =;    public static final int File_type_mov     =;    private static final int first_video_file_type = file_type_flv;    private static final int last_video_file_type = FILE_TYPE_WEBM;

Join: public static final int file_type_mov = 52; This line

Addfiletype ("MPEG", File_type_mp4, "Video/mpeg", mtpconstants.format_mpeg);        Addfiletype ("MPG", File_type_mp4, "Video/mpeg", mtpconstants.format_mpeg);        Addfiletype ("MP4", File_type_mp4, "Video/mp4", mtpconstants.format_mpeg);        Addfiletype ("MOV", File_type_mov, "Video/quicktime", mtpconstants.format_mpeg);        Addfiletype ("M4V", file_type_m4v, "Video/mp4", mtpconstants.format_mpeg);        Addfiletype ("3GP", FILE_TYPE_3GPP, "VIDEO/3GPP", Mtpconstants.format_3gp_container);        Addfiletype ("3GPP", FILE_TYPE_3GPP, "VIDEO/3GPP", Mtpconstants.format_3gp_container);        Addfiletype ("3g2", File_type_3gpp2, "video/3gpp2", Mtpconstants.format_3gp_container);        Addfiletype ("3GPP2", File_type_3gpp2, "video/3gpp2", Mtpconstants.format_3gp_container);        Addfiletype ("MKV", File_type_mkv, "Video/x-matroska");        Addfiletype ("WEBM", FILE_TYPE_WEBM, "VIDEO/WEBM");        Addfiletype ("TS", File_type_mp2ts, "video/mp2ts"); Addfiletype ("AVI", File_type_avi, "Video/avi"); Addfiletype ("FLV", file_type_flv, "video/flv");
By
File format: MPEG-4
Format brief: QuickTime

The information indicates. Add a line: Addfiletype ("MOV", File_type_mov, "Video/quicktime", mtpconstants.format_mpeg);

You also need to change a function:

public static Boolean isvideofiletype (int fileType) {        return (fileType >= first_video_file_type &&                FileType <= last_video_file_type)            | | (FileType >= first_video_file_type2 &&                fileType <= last_video_file_type2)            | | (FileType = = File_type_mov);    }
Join condition: FileType = = File_type_mov
Ability to delete database: rm-rf/data/data/com.android.providers.media/databases/

Then restart your phone. You can find the. mov videos in the video view

Of course, the above code can be optimized,

public static final int file_type_webm = 30;public static final int file_type_mov = 31;private static final int first_vide O_file_type = file_type_flv;private static final int last_video_file_type = File_type_mov;
Then there's a need to change it later.

//Image file types public static final int file_type_jpeg = 31;    public static final int file_type_gif = 32;    public static final int file_type_png = 33;    public static final int file_type_bmp = 34;    public static final int file_type_wbmp = 35;    public static final int file_type_webp = 36;    private static final int first_image_file_type = File_type_jpeg;    private static final int last_image_file_type = FILE_TYPE_WEBP;    Playlist file types public static final int file_type_m3u = 41;    public static final int file_type_pls = 42;    public static final int file_type_wpl = 43;    public static final int file_type_httplive = 44;    public static final int file_type_dash = 45;    private static final int first_playlist_file_type = file_type_m3u;    private static final int last_playlist_file_type = File_type_dash; DRM file types public static final int file_type_fl = Wuyi; 
Modified file: http://download.csdn.net/detail/deng0zhaotai/8767221

Android joins the new video format-Media Library scan

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.