1

is there any way to get the a video's exact recording date in milliseconds? I use this sample code for making the video. How can I capture a video recording on Android?

Is there any way to extract that information? And I'm talking about when the video was started! Not when the file was created... Is there a way to insert the time? The generall idea is that my colleagues can use the video as well, without the need of deserialising some class where the timeinformation is stored.

Edit For example I get the video from a colleague and then want to determinate when the video was recorded.

Bye JackZ

Community
  • 1
  • 1
JackZ
  • 32
  • 1
  • 10

1 Answers1

1

Try this sample here, taken from the thread here:

    Calendar c = Calendar.getInstance();
    System.out.println("Current time => "+c.getTime());

    SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    String formattedDate = df.format(c.getTime());
    // formattedDate have current date/time
    Toast.makeText(this, formattedDate, Toast.LENGTH_SHORT).show();

Also, you can check the SystemClock or you can just:

long timestamp = System.currentTimeMillis();

Call this one wherever you need and record the value.

EDIT

To extract the information from the file itself try this one and more specifically this one.

Community
  • 1
  • 1
g00dy
  • 6,752
  • 2
  • 30
  • 43
  • Sry but I want to extract this Information out of the video not generate it myself... For example I get the video from a colleague and then want to determinate when the video was recorded. – JackZ Jul 01 '13 at 12:59
  • thank you very much! I would like to give you reputation but I'm not allowed to ;( – JackZ Jul 01 '13 at 13:08
  • Don't worry about that, the main thing is that the code snippet did its job ;-) – g00dy Jul 01 '13 at 13:13
  • @JackZ I am using the property MediaMetadataRetriever.METADATA_KEY_DATE to get the timestamp, but this does not give me time precision in milliseconds. which property did you use? – Poorvi Nigotiya Jan 18 '21 at 17:34