VideoHelp Forum

+ Reply to Thread
Results 1 to 5 of 5
Thread
  1. Member
    Join Date
    Aug 2009
    Location
    Israel
    Search Comp PM
    Hello,
    Some times its important to keep timestamp of a video file after its been edited / compressed / changed format etc.
    (Not one file only)
    Looked in settings of programs I have, there is not such an option, so processed files get current timestamp.
    I have that 'add' to 'properties' submenu to change timestamp, but its lot of work and time.
    Any suggestions will be appreciated.
    Thanks
    Motim

    Win 10, 19042.1237 (20H2) x64
    Quote Quote  
  2. There are dedicated programs which allow to set timestamps, the one I use is Attribute Changer (I recently did a complete revision of its french translation by the way).

    I also use another method based on Robocopy (a standard Windows command line utility, it should be available on your system already), which you could use as follows.
    First create an empty copy of the directory where the original files are :
    Code:
    robocopy "E:\path\to\video files" "E:\path\to\video files [C]" /E /B /DCOPY:T /TIMFIX /FFT /DST /XJ /R:0 /W:1 /CREATE
    The most important switch here is /CREATE, which will create an empty copy of each file, meaning a copy with a size of 0 byte, but otherwise preserving all timestamps and attributes (except the "compressed" attribute which Robocopy does not retain, but anyway a 0 byte file doesn't have to be compressed so it's moot here). I add "[C]" to the new directory name to remember that it has been created with Robocopy /CREATE and is therefore expected to contain 0 byte files.
    Then do whatever processing you need to do with those files.
    Then rename the output files exactly as the original files (after moving those in another directory if you want to keep them), or exactly as their empty counterparts in the "[C]" directory (you can also rename the empty files with a batch file renamer prior to performing the next step). If the output files have a different extension (for instance .mkv instead of .mp4) you have to temporarily change the extension to match the original one. (Windows should always be set to display all file extensions.)
    Then re-apply the timestamps from the empty copies to the processed files with a second Robocopy command, switching source and destination paths :
    Code:
    robocopy "E:\path\to\video files [C]" "E:\path\to\video files" /E /B /DCOPY:T /TIMFIX /FFT /DST /XJ /R:0 /W:1 /CREATE
    The /CREATE switch is especially important here, as without it the files with a matching name in the second directory would get replaced by a 0 byte file. With /CREATE, it will only apply the timestamps / attributes, if different. The /TIMFIX switch is supposed to fix timestamps for files which are ignored / filtered, but is not required here (I'm not so sure when it is actually required, I just tested with or without it, with filters or no filters, didn't change anything). With the /E switch, subfolders are processed, which may not be desired in this case (if not, simply remove it). The /B stands for "backup mode", as opposed to "restart mode", I use it out of habit but couldn't say for sure when either of those two options is preferred. The /DCOPY:T switch allows to preserve or apply the timestamps to directories as well, not required here but can be very useful, as very few Windows applications allow to copy / transfer a directory tree and preserve all timestamps incuding those of directories (beside Robocopy I know only two that do : Synchronize It, FastCopy). Then /FFT, /DST, /XJ, /R:0 /W:1 should not be required here but I always keep them in the commands just in case (/FFT accounts for the 2sec. time granularity in FAT32, so it doesn't overwrite files which have a less than 2sec. time discrepancy ; /DST does the same for Daylight Saving Time discrepancies ; /XJ disables junctions, without it Robocopy can get trapped in an endless loop, typically when attempting to copy the Windows "AppData" directory ; /R:0 sets the number of retries to 0 and /W:1 the time between retries to 1sec. the default value for the latter is a whopping 1 million... if there's any SNAFU preventing a file to be copied, retrying 1 million times is not likely to accomplish anything useful ! what were they thinking ?). Other switches are available and may come in handy in other situations (type robocopy /? or search a thorough guide if you need more information).

    The Robocopy method is quicker (especially if there are many files to process) than setting each timestamp for each file in a GUI, and is also more precise, as third party utilities which manipulate timestamps do so through a Microsoft API which apparently only allows a 1sec. precision (for instance timestamps processed with Attribute Changer get rounded to XX,000sec.), whereas Robocopy applies the timestamps with the maximum precision (up to 7 decimal digits which corresponds to a 100 nanoseconds precision).
    Last edited by abolibibelot; 28th Sep 2021 at 18:44.
    Quote Quote  
  3. Member Cornucopia's Avatar
    Join Date
    Oct 2001
    Location
    Deep in the Heart of Texas
    Search PM
    If you edit, composite, process, you are implicitly modifying the content (sometimes even generating "new" content), so in those cases where it MUST re-encode, that re-encode does and should have a different timestamp.

    And there would be no way for an editing app to be able to read your mind either. What would it do if you are editing together 3 different clips, and each one has a different source and different timestamp? Which one would be "correct" for your single output?


    Scott
    Quote Quote  
  4. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    Not sure which date you want to change but i wrote a program to do that.
    https://www.videohelp.com/software/Change-Date-Time-Batch

    Changes metadata encoded/tagged in videos as well as windows created/modified dates. It mainly made to copy metadata to windows dates or windows dates to metadata dates in batch mode but also has a manual mode as well. If you have problems or suggestions let me know.
    Quote Quote  
  5. If you edit, composite, process, you are implicitly modifying the content (sometimes even generating "new" content), so in those cases where it MUST re-encode, that re-encode does and should have a different timestamp.

    And there would be no way for an editing app to be able to read your mind either. What would it do if you are editing together 3 different clips, and each one has a different source and different timestamp? Which one would be "correct" for your single output?
    Don't know about video edititing software, but for picture editing the freeware XnView for instance does allow to preserve the timestamps (at least for basic modifications like resizing or color correction, probably also for more advanced operations like copy-pasting from another picture in which case I would guess that it preserves the timestamps from the file that was opened first).
    For hexadecimal editing, WinHex allows to preserve the timestamps after any possible modification (like completely wiping the file's contents, or adding a chunk from another file at any spot).
    In MOST cases it is not desired, but in SOME cases it can be. If someone takes the time to request HOW to do something, perhaps anybody reading should start from the assumption that there is a good reason WHY, however counter-intuitive it may seem.
    Quote Quote