read / write mp4 metadata on Android

3

I want to read and edit (write) the mp4 metadata. In particular, I want to read / write metadata tags in Android as shown in the following image.

I searched this on the Internet and found mp4Parser, but I do not think you write mp4Parser Keyword Title.

    
asked by 30.04.2016 в 17:37
source

1 answer

0

The Android SDK contains class MediaMetadataRetriever with which we can obtain the metadata within a file, you can read more about the constants that define each metadata here :

  public void readMetaData(){
       File sdcard = Environment.getExternalStorageDirectory();
       File  file = new File(sdcard,"/Android/data/miarchivo.mp4");

        if (file.exists()) {
            Log.i(TAG, "Existe el archivo .mp4");

            //Clase agregada en API 10
            MediaMetadataRetriever retriever = new MediaMetadataRetriever();
            try {
                retriever.setDataSource(file.getAbsolutePath());
                for (int i = 0; i < 1000; i++){
                    if(retriever.extractMetadata(i)!=null) {
                        Log.i(TAG, "Metadata :: " + retriever.extractMetadata(i));
                    }
                }
            }catch (Exception e){
                Log.e(TAG, "Exception : " + e.getMessage());
            }

        }else {
            Log.e(TAG, "NO Existe el archivo .mp4");
        }
    }

To write or edit metada, the android SDK does not have any method, probably for copyright reasons, but you can use options like:

link

link

link

    
answered by 01.05.2016 / 00:15
source