VideoHelp Forum
+ Reply to Thread
Results 1 to 6 of 6
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 17: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  
  6. Member
    Join Date
    Apr 2024
    Location
    Sweden
    Search PM
    Hi, I have been struggling with this same issue for years, and finally have a nice solution, thanks to abolibibelot & Robocop

    first let me explain my situation, I have three wildlife / trail cameras in my forest, that create alot of short (25 sec) movies (AVI) and have large filesizes (bad compression). I always converted them to .mkv / H264 to reduce filesize. (20-30% of original filesize).
    But i didn't like that i loose original date/time (Date modified in Windows), because that matched the time of recording, so you could quickly see which is night videos for example and which is not at night..

    But now i have sorted it all out, this is my how-to:

    1) I check all videos with VLC and "open folder" option, so I can quickly go through all videos and delete the empty / boring ones, the most interesting I also rename, for example: DSCF0017.AVI --> DSCF0017_Lynx.AVI etc

    2) Then I use handbrake to convert the complete folder (containing up to hundreds of videos in .AVI) to H264 with same output folder (because I create .mkv from .avi this is no issue) / open source / folder / add all to queue / start queue

    3) In windows I sort all the files on "file type" so i can quickly move all newly created .mkv files to a sub folder called "mkv"
    so now i have a folder called:
    D:\Wildcams\20240415\border_forest
    (original huge .AVI files with correct / original date/timestamps)

    and a subfolder in there with the .mkv output files from handbrake
    D:\Wildcams\20240415\border_forest\mkv

    4) Then I rename all the original files from .AVI to .mkv (so old and new has same filenames and extensions), I do this in the command prompt because of the amount of files. (hundreds)
    Code:
    ren *.AVI *.mkv
    5) Then I let Robocop(y) do his work.. but without the /E switch, so subfolders are NOT processed (because mkv folder is inside), i only want to process the .AVI files)
    Code:
    robocopy "D:\Wildcams\20240415\border_forest" "D:\Wildcams\20240415\border_forest\mkv" /B /DCOPY:T /TIMFIX /FFT /DST /XJ /R:0 /W:1 /CREATE
    note: for robocopy: command prompt as Admin is necessary

    6) Lastly I move the output files from handbrake (in mkv folder) back to original folder and overwrite old files with the new ones, just in windows (cut/paste/replace all) or with the command prompt:
    Code:
    move /Y D:\Wildcams\20240415\border_forest\mkv\* D:\Wildcams\20240415\border_forest\
    (note: /Y switch suppresses prompting to confirm you want to overwrite an existing destination file.)
    and because they both are called .mkv this automatically cleans up the folder with only new files, last thing to do is delete the temporary mkv folder (that should be empty now).

    and done... hundreds of files converted to H264 mkv but with original date/time stamps.

    ps. I write this also for myself, so i can check back my how-to in 4-5 months (next time i empty my wildlife cameras)
    Last edited by Camel8; 30th Apr 2024 at 02:52.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!