2016-07-28 2 views
2

私は、メタデータからビデオ作成日時を取得するためのコードを書いていますを与え、私はそれが完璧に動作しますアンドロイドMediaMetadataRetriever.METADATA_KEY_DATEが銀河のビデオの日付のみS7

MediaMetadataRetriever retriever = new MediaMetadataRetriever(); 
retriever.setDataSource(path_to_video); 
String date = retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DATE); 

作成日を取得するには、次のコードを使用していますサムスンギャラクシーS7を除くすべてのデバイスは、 "YYYY MM DD"形式の日付のみを返します。タイムスタンプはありません。日付とタイムスタンプの両方が必要です。

この点に関するお手伝いが大変ありがとうございます。ビデオFFMPEGのメタデータ情報を印刷するための

答えて

1

ffmpeg -i input_video -f ffmetadata metadata.txt 

このコマンドは、必要な情報を得るために私を助けて、使用するのに最適な選択肢です。

0

私は同様の問題に直面しました。私は両方の日付フォーマットを以下のように扱いました:

//pass date fetched from MetadataRetriever class to below method. 

    public static String formatMediaDate(String date){ 
      String formattedDate = ""; 
      try { 
       Date inputDate = new SimpleDateFormat("yyyyMMdd'T'HHmmss", Locale.getDefault()).parse(date); 
       formattedDate = new SimpleDateFormat("dd MMMM yyyy", Locale.getDefault()).format(inputDate); 
      } 
      catch (Exception e){ 
       Log.w(TAG, "error parsing date: ", e); 
       try { 
        Date inputDate = new SimpleDateFormat("yyyy MM dd", Locale.getDefault()).parse(date); 
        formattedDate = new SimpleDateFormat("dd MMMM yyyy", Locale.getDefault()).format(inputDate); 
       } catch (Exception ex) { 
        Log.e(TAG, "error parsing date: ", ex); 
       } 
      } 
      return formattedDate; 
     } 
関連する問題