0

I need to exact the creation time of a mp4 in one of my projects and it is completely impossible to transfer a mp4 from my phone to a specific folder of my PC without changing the creation time accidentaly. If anyone knows an easy way pleas tell me, because this is a essential part of my project and the users will have to do it all the time. I have event tried to read the creation time from the metadata, but windows even changes the metadata when you move the video.
I even thought about building an application in c# just for the transfer, but I don't know if the creation time will be changed when I transfer the video into an bit array.
Any help is much appreciated.

Jonathan
  • 1
  • 2
  • File.SetCreationTime? – Jon Skeet May 14 '21 at 17:14
  • Yeah, but where do I get the real creationtime of the video? – Jonathan May 14 '21 at 17:17
  • 1
    *but windows even changes the metadata when you move the video* - really? As in.. if i have some mp4, and i copy it from folder A to B they are no longer binary identical? I'll test this – Caius Jard May 14 '21 at 17:19
  • 1
    I have tested it and reject your assertion – Caius Jard May 14 '21 at 17:20
  • 1
    [File.GetCreationTime](https://learn.microsoft.com/en-us/dotnet/api/system.io.file.getcreationtime?view=net-5.0)? – rene May 14 '21 at 17:21
  • Is your question a duplicate of https://stackoverflow.com/questions/9981599/how-to-set-the-media-created-date-on-an-mpeg-4-file ? Here's the test I did: https://i.stack.imgur.com/kHa2z.png - the file dates changed as one might expect, but the metadata remained the same – Caius Jard May 14 '21 at 17:22
  • okay then my skript to read the metadata was broken. Did you only test it with an image or also an mp4 file? Because I think they use different type of metadata – Jonathan May 14 '21 at 18:51
  • I don't think it is an duplicate of https://stackoverflow.com/questions/9981599/how-to-set-the-media-created-date-on-an-mpeg-4-file , because I know how to set the creation time, but I don't have the right creation time. – Jonathan May 14 '21 at 18:57

2 Answers2

0

As your using Windows (or your users), you can use robocopy with /CopyAll parameter in order to keep all the original file info (Dates, attributes,...). If you want to write a program in c#, you use can the following line :

System.Diagnostics.Process.Start("CMD.exe","/C robocopy  Source-directory Dest-directory YourFileName /COPYALL");
ASM
  • 103
  • 7
0

I found a semi optimal soluion now, because it depends on the device you use if it works. I just noticed that the name of the file contains the creation time, so I can just set the creationtime based on the name, when I add the file to the folder.
Thank you to everyone who gave me tips.

Jonathan
  • 1
  • 2