#1 2017-01-02 00:16

PnoT
New Member
Registered: 2017-01-02
Posts: 3

Rename Files according to Endoded date

I'm trying to find a solution on how to rename files to the Encoded Date that shows up in mediainfo and other applications when pulling metadata from .mov files.

Here is a sample

General
Complete name                            : TEST.mov
Format                                   : QuickTime
Format/Info                              : Original Apple specifications
File size                                : 14.9 MiB
Duration                                 : 1mn 16s
Overall bit rate                         : 1 632 Kbps
Movie name/More                          : EASTMAN KODAK COMPANY  KODAK C360 ZOOM DIGITAL CAMERA
[b]Encoded date                             : UTC 2006-01-01 08:02:35[/b]
Tagged date                              : UTC 2006-01-01 08:02:35
Origin                                   : Digital Camera

Video
ID                                       : 1
Format                                   : MPEG-4 Visual
Format profile                           : Simple@L1
Format settings, BVOP                    : Yes
Format settings, QPel                    : No
Format settings, GMC                     : No warppoints
Format settings, Matrix                  : Default (H.263)
Codec ID                                 : 20
Duration                                 : 1mn 16s
Bit rate                                 : 1 502 Kbps
Width                                    : 640 pixels
Height                                   : 480 pixels
Display aspect ratio                     : 4:3
Frame rate mode                          : Constant
Frame rate                               : 24.056 fps
Color space                              : YUV
Bit depth                                : 8 bits
Scan type                                : Progressive
Compression mode                         : Lossy
Bits/(Pixel*Frame)                       : 0.203
Stream size                              : 13.7 MiB (92%)
Language                                 : English
[b]Encoded date                             : UTC 2006-01-01 08:02:35[/b]
Tagged date                              : UTC 2006-01-01 08:02:35
Transfer characteristics                 : BT.601
Matrix coefficients                      : BT.601

Audio
ID                                       : 2
Format                                   : ADPCM
Format profile                           : U-Law
Codec ID                                 : ulaw
Duration                                 : 1mn 16s
Source duration                          : 1mn 16s
Bit rate mode                            : Constant
Bit rate                                 : 128 Kbps
Channel(s)                               : 1 channel
Sampling rate                            : 16.0 KHz
Bit depth                                : 16 bits
Stream size                              : 1.17 MiB (8%)
Source stream size                       : 1.17 MiB (8%)
Language                                 : English
[b]Encoded date                             : UTC 2006-01-01 08:02:35[/b]
Tagged date                              : UTC 2006-01-01 08:02:35

MediaInfo has three areas where the endoded date is but I only need the one for the video.  I've tried to write a script to incorporate mediainfo from some examples but to no avail.  I also did not find anything mentioned in the forums on this. 

A bonus would be to modify the UTC time as well even thou there is another script out there for that I'm not sure if it would have to be combined into a single script or not.

Offline

#2 2017-01-03 10:53

TGB
Member
Registered: 2016-06-12
Posts: 14

Re: Rename Files according to Endoded date

Isn`t the encode date same as create/modified date?
When you encode a VHS into AVI file, the encode date should be the same as the file creation date.

Offline

#3 2017-01-03 14:57

PnoT
New Member
Registered: 2017-01-02
Posts: 3

Re: Rename Files according to Endoded date

TGB wrote:

Isn`t the encode date same as create/modified date?
When you encode a VHS into AVI file, the encode date should be the same as the file creation date.

I agree with you that .AVI files do exhibit that behavior but a .MOV is slightly different.  Here is an example of pulling the meta data with powershell.

Name           : 12.05.2005_test.mov
Size           : 3.37 MB
Item type      : MOV File
Date modified  : 6/6/2006 5:23 AM
Date created   : 3/8/2014 11:31 AM
Date accessed  : 1/3/2017 12:28 AM
Attributes     : A
Perceived type : Unspecified
Owner          : Everyone
Kind           : Video
Rating         : Unrated
Length         : 00:00:08
Bit rate       : 131kbps
Protected      : No
Total size     : 42.3 TB
Computer       : syn
File extension : .mov
Filename       : 12.05.2005_test_gs.mov
Space free     : 5.53 TB
Folder name    : Pictures
Folder path    : 
Folder         : 
Path           : 
Type           : MOV File
Link status    : Unresolved
Space used     : 86%

You can see 3 different dates listed above and none of them equal the Encoded date from mediainfo which is now in the name of the file 12.05.2005.  I have written a small script in PowerShell to pluck the date with mediainfo, sort the date out how I want it, and rename the file but life would be EASY street if Renamer would do it for me.

Last edited by PnoT (2017-01-03 15:05)

Offline

#4 2017-01-03 15:51

Stefan
Moderator
From: Germany, EU
Registered: 2007-10-23
Posts: 887

Re: Rename Files according to Endoded date

Have you seen this >>> http://www.den4b.com/wiki/ReNamer:Scripts:Exiv2


Dummy code:
myCommandLine := 'mediainfo.exe "' + FilePath + '"';
ExecConsoleApp(myCommandLine, myOutputVar)
Matches := SubMatchesRegEx(myOutputVar, myRegExToMatch, False);
FileName := Matches[0] + WideExtractFileExt(FileName);




http://www.den4b.com/wiki/ReNamer:Pasca … _Execution
http://www.den4b.com/wiki/ReNamer:Pascal_Script  >>> Tips

 


For more help and how-to's  read our fine Wiki.
If ReNamer had helped you, please donate a coin to Denis or buy a Pro license for commercial use. (Lite vs Pro)

Offline

#5 2017-01-08 18:17

PnoT
New Member
Registered: 2017-01-02
Posts: 3

Re: Rename Files according to Endoded date

Thanks, I figured it out after looking at your examples and got what I needed.

Offline

#6 2018-05-12 11:52

Igor
New Member
Registered: 2018-05-12
Posts: 1

Re: Rename Files according to Endoded date

I have tried the script in the wiki, making changes to point to the mediainfo executable, but it doesn't seem to work, any help?

{ Extract media meta information using MediaInfo CLI }

const
  MediaInfoExe = 'C:\Tools\MediaInfoCLI\MediaInfo.exe';
  OutputParameter = 'General;%Encoded_Date%';

var
  Command: WideString;
  Output: String;

begin
  Command :=
    '"' + MediaInfoExe + '"' +
    ' --output="' + OutputParameter + '"' +
    ' "' + FilePath + '"';
  if ExecConsoleApp(Command, Output) = 0 then
    FileName := OemToWide(Output) + WideExtractFileExt(FilePath);
end.

Offline

#7 2018-05-13 11:36

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 2,614

Re: Rename Files according to Endoded date

If the filename is not getting updated, it would suggest that MediaInfo tool doesn't execute successfully.

First, try executing it manually from the command line and testing whether you can extract the necessary meta information yourself.

If that works, please paste your command and its output, so that we can adjust the script accordingly. If it doesn't work, then it is possible that MediaInfo simply can't extract the necessary information or that information doesn't exist within the file.

Either way, it would help if you could also provide a sample file for testing. Upload it to any free file upload service and post a link here, or email.

Offline

#8 2018-05-14 06:34

igor2
New Member
Registered: 2018-05-14
Posts: 3

Re: Rename Files according to Endoded date

It seems putting mediainfo inside the renamer directory solved the problem, now I have another one.
encoded time has : which is an invalid character, and throws an error, even if I added a rule to replace : with - , I cannot get pass the error and rename the file.

Offline

#9 2018-05-14 13:11

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 2,614

Re: Rename Files according to Endoded date

It seems putting mediainfo inside the renamer directory solved the problem

If you set MediaInfoExe constant to a correct full path, it should work just as well.

encoded time has ":" which is an invalid character, and throws an error, even if I added a rule to replace ":" with "-", I cannot get pass the error and rename the file.

You can replace all ":" with "-" using a single Replace rule. You may need to untick the "skip extension" option, depending on the state of the filenames and other rules.

If you still can't get it to work, please post here an example of your filenames, renaming rules and the expected result.

P.S. Please setup your forum account using a proper email address, instead of creating a new one for each response using disposable email address. These type of registrations may be deleted / blocked in future.

Last edited by den4b (2018-05-14 13:29)

Offline

#10 2018-05-14 18:46

igor2
New Member
Registered: 2018-05-14
Posts: 3

Re: Rename Files according to Endoded date

Thank you for your reply, sorry for the mess big_smile
I did point to mediainfo path, I am guessing some sort of windows 10 permissions problem.


Unticking "skip extension" doesn't help.

sample video:

http://www.filedropper.com/t1_6

settings & mediainfo :

Capture1.png
Capture2.png

Last edited by den4b (2018-05-15 00:45)

Offline

Board footer

Powered by FluxBB