Renaming from Recorded date

Advanced Renamer forum
#1 : 23/05-19 09:32
Nathan
Nathan
Posts: 5
Hi, I'm chasing some help.
I would like to batch process video files.
The problem is that the exif profile doesn't pull the information I want out for the renaming.
This is the media file I'm trying to rename
https://drive.google.com/open?id=152EfC8_iAI34Q- AG_6eV8N_1I0fEP0xy
This is a txt file of the media information I can see when I am in Media Player Classic (MPC-HC) and I click on properties of the video file and then media information.
https://drive.google.com/open?id=1X7VNAzjhdQV5c_ jz74YAy0dl-6Mo0XmJ

What I want to rename the file as is the information in the media txt file that is called "Recorded date"
However, the exif tool doesn't pull this specific information out as it does with other files and I am not sure why.

If you could help me with this I would be eternally grateful

Cheers
Nathan



23/05-19 09:32
#2 : 23/05-19 14:46
David Lee
David Lee
Posts: 1125
A work-around would be to rename your MediaInfo.txt files based on Line 10 in the file. Modify the filename in the form of a line in the csv file compatible with "Import... Files from CSV" (eg"uvs110915-006-12.avi,2005-01-13 19_13_45"). Then reload the renamed files, populate a List method and save the list with .csv extension. You can then use the resulting csv file to Import and rename the corresponding AVI files.

Whilst this is reasonably straightforward it does shift the problem to batch-creating the MediaInfo files, which is why I haven't wasted time posting more detailed instructions at this point.





23/05-19 14:46 - edited 23/05-19 14:49
#3 : 24/05-19 03:09
Nathan
Nathan
Posts: 5
Reply to #2:
Thank you David for your prompt reply.
The mediainfo.txt file is something I manually generated from within MPC, So, unfortunately, it doesn't help at all.
Do you have any idea why exif cant pull the correct information out of the media?
I can copy and paste the information out of the media info to the new file name, however, that will be highly time-consuming for thousands of clips and that is the point of the batch processing as I am sure you are aware.
Thank you for your time :)
Cheers
Nathan


24/05-19 03:09
#4 : 24/05-19 10:45
David Lee
David Lee
Posts: 1125
Reply to #3:
The issue probably is that avi metadata is not stored in exif format.

However, it looks as though MPC-HC uses the open source utility MediaInfo to display and output metadata.

MediaInfo is available to download both as a GUI and command line version from https://mediaarea.net/en/MediaInfo

Using the CLI version the command: "mediainfo uvs110915-006-12.avi" will replicate exactly the contents of your txt file.

The documentation is a bit sketchy to say the least and takes some effort and experimentation to sort out, but the command: "mediainfo --Output=General;%Recorded_Date% uvs110915-006-12.avi" will return the date you require: 2005-01-13 19:13:45.000

Now it's just a matter of cycling through all your video files in a Windows batch file and renaming them to the date returned by MediaInfo (without using Advanced Renamer). Whilst this will involve some advanced batch code you should be able to sort out the details fairly easily if you search the Internet for help.



24/05-19 10:45 - edited 24/05-19 11:01
#5 : 24/05-19 11:18
David Lee
David Lee
Posts: 1125
Reply to #4:
On second thoughts...

The date/time string returned by MediaInfo contains ":" as a separator, which is a forbidden character in Windows filenames. A better way forward probably would be to use MediaInfo to generate a CSV file which you can import into Advanced Renamer, as I originally suggested.

The MediaIndo CLI command:
"mediainfo.exe "--Output=General;%FileName%.avi,%Recorded_Date%" uvs110915-006-12.avi"
will return the output: "uvs110915-006-12.avi,2005-01-13 19:13:45.000"

Use a Windows batch script to cycle through all your filenames and append each output line to a .csv file.

Import the resulting file into Advanced Renamer using "Import: Files" from CSV... The filenames in the first field of each line in the file will be imported into the file list and the strings in the second fields automatically will populate a List method. You can then add a Replace method to edit the names to remove the illegal characters (and possibly also the trailing sub-second string).



24/05-19 11:18
#6 : 24/05-19 13:28
David Lee
David Lee
Posts: 1125
Reply to #5:
If you open a command window in the folder containing your avi files then the following command will create list.csv:

for %f in (*.avi) do "<path\>mediainfo" --Output=General;%FileName%.avi,%Recorded_Date% "%f" >> list.csv

You should replace <path\> with the full path to the CLI version of mediainfo.exe

You can of course also specify the path to the avi files - but remember to put the entire path (including *.avi) in quotes if the path contains any spaces.

For use in a batch file you will need to replace % with %%
eg
@echo off
for %%f in (*.mp4) do "<path\>mediainfo" --Output=General;%%FileName%%.mp4,%%Encoded_Date%% "%%f" >> list.csv


24/05-19 13:28
#7 : 06/06-19 08:25
Nathan
Nathan
Posts: 5
Reply to #6:
OMG David, you are a superstar.
Thank you for the information, it is working, kinda.
I have done what you said and was able to retrieve the information from mediainfo.

However, when I import into AR with the import CSV, the information goes haywire.

When I import the file names the new file name is not what it is supposed to be, but if I swap the original and new filenames around, the correct information is there, however it doesn't work when done in the way I need it to.

As you can see in this picture
https://photos.app.goo.gl/oqdLuMHAWnND8Ygq8
The new file names are incorrect when pulled from the CSV file.

However, the correct information for the renaming is there as can be seen when reversing the column selections for the original and new file names.
https://photos.app.goo.gl/tCiSB5qzFTSMy9zS8

Any idea why it is able to pull the information correctly when different columns are selected?

Thank you again for your time.
Cheers
Nathan


06/06-19 08:25
#8 : 06/06-19 09:12
Nathan
Nathan
Posts: 5
Reply to #7:
So I kinda figured it out.
Because of the ":" in the generated CSV file.
The second filename must use ":" automatically as a separate, so by formatting the CSV file in excel to have "." instead of ":" I was able to produce a workable file name.
Still not as intended but pretty close.
Cheers again :)


06/06-19 09:12
#9 : 06/06-19 15:07
David Lee
David Lee
Posts: 1125
Reply to #8:
Sorry about that - I only tested the production of the list file and assumed that it would import into A. Renamer. However, it appears that A.Ren (or perhaps the Windows API) is assuming everything before the final colon in a filename is the volume name (as in C: etc) and stripping it out. The same issue arises if you load new filenames directly into the List method from a txt file.

You don't need to mess around with Excel to fix the problem - simply open the .csv file in Notepad (or your text editor of choice) and replace ":" with "_".



06/06-19 15:07
#10 : 06/06-19 16:31
Nathan
Nathan
Posts: 5
Reply to #9:
Thank you thank you thank you.
I can't thank you enough.
Give me your PayPal address and I'll send you some money to say thanks :)
You have just enabled me to do something I have been trying to sort out for about a decade.
I have all my videos of my kids from when they were little. The file you helped me with is one of them, the filenames had nothing to do with anything, unfortunately (gotta love firewire days of data transfer)
I have now been able to rename and then reset the modified dates for them, organise them into chronological folder structures and now in the process of uploading them to good photos for safekeeping, all 1695 files and 900Gb of data. All with google organising them properly in date order now.
I cannot express how happy I am right now, and how much I love the program and your help.
Thank you again
A very happy
Nathan


06/06-19 16:31