VideoHelp Forum




+ Reply to Thread
Results 1 to 13 of 13
  1. Hello group!
    I have been lurking on this site for months, trying to educate myself. Time to join and post.
    I have been in the process of moving cell phone videos (all of them are .mp4 from different android phones) to the computer. Here is what I have learned (or think I have learned)…
    When the phone records the video it names it based on the date and local time (military) that it began recording the video (which is a GOOD thing I think).
    On my Galaxy S1 the format is “video-yyyy-mm-dd-hh-mm-ss.mp4”
    On my Galaxy S2 and S4 the format is “yyyymmdd_hhmmss.mp4”
    The beautiful thing about this is I know exactly when the video was recorded, it’s right in the name! (Of course this assumes that the time & date are correct on the phone, but they always seem to be)
    On the S2 and S4 it also sets the “Encoded date” and “Tagged date” (I believe these are called flags) inside the file, based on the date and UTC time that it stopped recording. As near as I can tell the “Encoded Date” is most similar to the “Date Taken” flag on a .jpg. For my purposes I think I only need the Encoded Date. (The S1 does not seem to have put these fields/flags in at all, we’ll address that a bit later).
    The format is “UTC yyyy-mm-dd hh:mm:ss”
    Okay, so that is my understanding of how my phones recorded the videos.

    Now, let’s throw NTFS into the mix;
    https://whereismydata.wordpress.com/2009/02/14/dates-ntfs-created-modified-accessed-written/
    So, it would seem that when I copy/move files from the phone, the Windows operating system adds a little more information. (Let us NOT have a debate about how wonderful or crappy Windows is. It is what my laptop came with. It is what I am familiar with). Of the initial 4 fields (attributes) written (from the link above) I believe that “File Created” is the most important. I am using Windows Photo Gallery to store and view my photos and videos. It seems to sort them chronologically using the “File Created” date stored in each file. So the first big problem is that the File Created date can be (and usually is) wrong on my mp4’s
    I have read this thread about 20 times;
    https://forum.videohelp.com/threads/361679-Please-Help!-Date-and-Time-issues-mp4-Encoded-vs-Created
    Using the “ChangeDateTime.bat” file that Budman so graciously gave us, it seems to solve the “File Created attribute” problem IF (and that’s a big if) the encoded date is correct!!! (It says it also corrects for UTC, I live in the Mountain Time Zone so somebody could double check that for me). But, what if I don’t have an “Encoded Date” flag in the file? I need a batch utility which can change/create the Encoded Date flag using the file name as the source (it would need to adjust for UTC because the phone already set the filename to local). I have used and am comfortable with renaming utilities, so I could change the filenames from the S1 to be the same as the S2/S4 (unless it’s just as easy for somebody to make me two batch files, one for each name format). All of my mp4’s are in folders (directories) based on what phone they came from. So the batch file I need does not really need to check sub-directories, ‘cause there aren’t any, it just needs to process all the files in a given folder. I have read about ffmpeg, I think it will do it, but I lack the knowledge to make it work. I could be barking up the wrong tree on that one…
    Quote Quote  
  2. I'm a MEGA Super Moderator Baldrick's Avatar
    Join Date
    Aug 2000
    Location
    Sweden
    Search Comp PM
    Try first this this ffmpeg command on one mp4 and see if sets the encoded date correctly.

    Code:
    c:\ffmpeg\ffmpeg.exe -i c:\video\input.mp4 -c copy -map 0 -metadata creation_time="2015-06-01 12:00:00" c:\video\output.mp4
    I think then it shouldn't be that complex to batch convert all with the date from the filename and add in the creation_time.
    Quote Quote  
  3. Originally Posted by Pumbaa View Post
    On my Galaxy S1 the format is “video-yyyy-mm-dd-hh-mm-ss.mp4”
    That should please you.
    Code:
    @echo off
    :label2
    set id=
    for %%f in ("%~dp1*.mp4") do set file=%%f
    echo.%file%
    set file=%file:.mp4=%
    echo.%file%>>file.txt
    for /f "tokens=1,2,3,4,5,6,7 delims=-" %%a in (file.txt) do (
    set id=%%a
    set year=%%b
    set month=%%c
    set day=%%d
    set hour=%%e
    set minute=%%f
    set second=%%g
    )
    if [%id%]==[] goto label1
    del file.txt
    mp4box.exe -new -add "%file%.mp4" -itags created="UTC %year%-%month%-%day% %hour%:%minute%:%second%" "%file%_1.mp4"
    xcopy /Q /V %file%_1.mp4 out\%file%.mp4
    del %file%.mp4,%file%_1.mp4
    if [%id%]==[video] goto label2
    :label1
    pause
    Quote Quote  
  4. Okay,
    Finally got around to testing this.
    It does add three new tags to the video
    "Recorded" "Encoded" and "Tagged"
    the Recorded tag is correct
    BUT, the Encoded and Tagged tags are showing today's date.
    Also, it adds the tags to the first file, then it asks if the second file is a file or directory. Not sure what that means.
    Any Thoughts???
    Quote Quote  
  5. How it looks (photo) and how this will be done (picture)?
    Quote Quote  
  6. Here is a screenshot using Mediainfo before running the batchClick image for larger version

Name:	Screenshot 2015-08-11 12.15.42.png
Views:	473
Size:	222.2 KB
ID:	33107
    Last edited by Pumbaa; 11th Aug 2015 at 13:17.
    Quote Quote  
  7. Here is screenshot of bat file where it asks a questionClick image for larger version

Name:	Screenshot 2015-08-11 11.59.39.png
Views:	549
Size:	1.33 MB
ID:	33104
    Quote Quote  
  8. I selected F for file, here is a screenshot of the new file using Mediainfo. The Recorded date is correct, the other two show todays dateClick image for larger version

Name:	Screenshot 2015-08-11 12.00.49.png
Views:	435
Size:	170.9 KB
ID:	33105
    Quote Quote  
  9. Nearly good, but something is wrong.
    MediaInfo settings should be "Options -> Preferences -> Output format" Text "'
    Then copy the "Text" directly to the forum.

    Opsss ... my mistake. It should work. Press F and changed files are in a directory MP4 "OUT".
    Code:
    @echo off
    :label2
    set file=
    for %%f in ("%~dp1*.mp4") do set file=%%f
    echo.%file%
    set file=%file:.mp4=%
    echo.%file%>>file.txt
    for /f "tokens=1,2,3,4,5,6,7 delims=-" %%a in (file.txt) do (
    set id=%%a
    set year=%%b
    set month=%%c
    set day=%%d
    set hour=%%e
    set minute=%%f
    set second=%%g
    )
    if [%file%]==[] goto label1
    echo %id%
    del file.txt
    mp4box.exe -new -add "%file%.mp4" -itags created="UTC %year%-%month%-%day% %hour%:%minute%:%second%" "%file%_1.mp4"
    xcopy /Q /V %file%_1.mp4 out\%file%.mp4
    del %file%.mp4,%file%_1.mp4
    if [%id%]==[video] goto label2
    :label1
    pause
    Metadata with contaneir MP4.
    Code:
    Recorded date                            : UTC XXXX-XX-XX XX:XX:XX
    Quote Quote  
  10. Okay,
    This fixed the batch file errors. BUT, the Encoded Date and Tagged Date are still using today's date.Click image for larger version

Name:	Screenshot 2015-08-20 11.56.26.png
Views:	438
Size:	117.7 KB
ID:	33236Click image for larger version

Name:	Screenshot 2015-08-20 11.56.30.png
Views:	423
Size:	120.1 KB
ID:	33237
    Quote Quote  
  11. Encoded Date/Time
    https://forum.videohelp.com/threads/361679-Please-Help!-Date-and-Time-issues-mp4-Encoded-vs-Created
    You can use function: mp4box -keep-utc (originaly date encoded)
    Quote Quote  
  12. Jamaika,
    The batch file you created for me works on the files in the format of “video-yyyy-mm-dd-hh-mm-ss.mp4”
    Could you please modify it to work on files in the format of “yyyymmdd_hhmmss.mp4”
    Thanks
    Craig
    Quote Quote  
  13. Hi Pumbaa,
    Code:
    @echo off
    :label2
    set file=
    for %%f in ("%~dp1*.mp4") do set file=%%f
    echo.%file%
    set file=%file:.mp4=%
    echo.%file%>>file.txt
    set file=video_%file%
    for /f "tokens=1,2,3 delims=_" %%a in (file.txt) do (
    set id=%%a
    set yyyymmdd=%%b
    set hhmmss=%%c
    )
    set year=%yyyymmdd:~-4,4%
    set month=%yyyymmdd:~4,2%
    set day=%yyyymmdd:~6,2%
    set hour=%hhmmss:~-4,2%
    set minute=%hhmmss:~2,2%
    set second=%hhmmss:~4,2%
    if [%file%]==[] goto label1
    echo %id%
    del file.txt
    mp4box.exe -new -add "%file%.mp4" -itags created="UTC %year%-%month%-%day% %hour%:%minute%:%second%" "%file%_1.mp4"
    xcopy /Q /V %file%_1.mp4 out\%file%.mp4
    del %file%.mp4,%file%_1.mp4
    if [%id%]==[video] goto label2
    :label1
    pause
    PS I didn't check.
    Quote Quote  



Similar Threads

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