ExifTool Forum

ExifTool => Newbies => Topic started by: nndrom on June 23, 2018, 11:43:17 AM

Title: How can I use Recorded Date to rename my mts/mpg video files
Post by: nndrom on June 23, 2018, 11:43:17 AM
Hello,

I'm a newbie with ExifTool and trying to find a solution if possible to make order in my lately recovered video library.
All my videos were lost due to an external drive failure and I've used a recovery software to get them back.
All recovered video files are now named "Foundxxxxxxx.mts" or .mpg and it's a complete mess!
I've initially tried to use the ExifTool command to restore the file names to "DateTimeOriginal", but it didn't worked - the new date shown was the date&time at the time of recovery process.
And then also tried with "MediaCreateDate" and "FileModifiyDate" options, but smae results.

I've checked the files metadata with MediaInfo and surprisingly there is a correct information about the date and time of the original files - it was called "Recorded date".
First move was to try this option with ExifTool, but of course that it was not recognized as correct command.

I've checked hundreds of files with MediaInfo and definitely the only correct date & time of the videos was under that "Recorded date".

My question: is there any possibility to use ExifTool to rename the recovered files using the available "Recorded date" metadata?
Thank you!

Nick

My system: Windows 10 Home 64-bit
Exiftool-11.03
Video files taken with Sony camera HDR-PJ620 and DSC-RX100.


   
Title: Re: How can I use Recorded Date to rename my mts/mpg video files
Post by: StarGeek on June 23, 2018, 01:46:30 PM
Can you give an example of the command you were using?

Also, run exiftool -s FILE to get the actual tag name of "Recorded date".  Look for the tag with the same correct date as MediaInfo shows.
Title: Re: How can I use Recorded Date to rename my mts/mpg video files
Post by: nndrom on June 23, 2018, 03:30:40 PM
The command was:
exiftool -ext mts -d "[%Y-%m-%d][%A] [%H.%M.%S].%%e" "-Filename<MediaCreateDate" "-Filename<DateTimeOriginal" DIR

I'm attaching the MediaInfo screenshot showing that only Recorded Date info is available.

I've ran the suggested command (also attached) and all tags related to date are indicating the file recovery date&time.
I'm afraid that ExifTool cannot retrieve that Recorded Date shown by MediaInfo.

Thanks!
Title: Re: How can I use Recorded Date to rename my mts/mpg video files
Post by: Phil Harvey on June 23, 2018, 04:09:58 PM
Can you send me that video so I can take a look?  (philharvey66 at gmail.com)

- Phil
Title: Re: How can I use Recorded Date to rename my mts/mpg video files
Post by: twoj on January 19, 2021, 11:30:42 PM
Apologies to resurrect the post - but i am doing some mts to mp4 conversions and i am noticing the same thing and i don't see any solution posted. The conversion is done with ffmpeg;

ffmpeg.exe -i $FullName -c:v copy -c:a copy -f mp4 $Outname

the mts files are videocam files that use the DateTimeOriginal tag, however after the conversion i compared the MediaInfo info of the mp4 file which has the tag;

Recorded date

which is the same as DateTimeOriginal, however when i look in exiftools there is no tag that has this information; the closest tags are;

CreateDate                      : 0000:00:00 00:00:00
ModifyDate                      : 0000:00:00 00:00:00

Any ideas why exiftools isn't seeing that tag and mediainfo does?
thanks

If you want i can send you a clip.
Title: Re: How can I use Recorded Date to rename my mts/mpg video files
Post by: Phil Harvey on January 20, 2021, 07:07:18 AM
Sure.  My email is philharvey66 at gmail.com

Be sure to send a link to this thread in the email.

- Phil
Title: Re: How can I use Recorded Date to rename my mts/mpg video files
Post by: twoj on January 21, 2021, 09:20:46 AM
Hi Phil
I just wanted to check to see if you received the email and got the files?
Title: Re: How can I use Recorded Date to rename my mts/mpg video files
Post by: Phil Harvey on January 21, 2021, 09:39:41 AM
I got them, thanks.

This same topic has come up before fairly recently.

As I suspected, MediaInfo is parsing the H264 video stream to obtain the date/time information.

ExifTool doesn't currently process the video stream in MP4 files for performance reasons.

With the current version of ExifTool you can uncomment line 427 in lib/Image/ExifTool/QuickTime.pm to enable this ability when the -ee option is used.  ie) change this:

      # avcC => 'stsd', # (uncomment to parse H264 stream)

to this:

        avcC => 'stsd', # (uncomment to parse H264 stream)

With this change, you get this:

> exiftool ~/Desktop/20140226175951/20140226175951.mp4 -ee -G0:1 -time:all -a
[File:System]   File Modification Date/Time     : 2021:01:20 09:52:12-05:00
[File:System]   File Access Date/Time           : 2021:01:21 09:38:29-05:00
[File:System]   File Inode Change Date/Time     : 2021:01:21 09:29:00-05:00
[QuickTime]     Create Date                     : 0000:00:00 00:00:00
[QuickTime]     Modify Date                     : 0000:00:00 00:00:00
[QuickTime:Track1] Track Create Date            : 0000:00:00 00:00:00
[QuickTime:Track1] Track Modify Date            : 0000:00:00 00:00:00
[QuickTime:Track1] Media Create Date            : 0000:00:00 00:00:00
[QuickTime:Track1] Media Modify Date            : 0000:00:00 00:00:00
[H264:Track1]   Date/Time Original              : 2014:02:26 17:59:51-05:00
[H264:Track1]   Date/Time Original              : 2014:02:26 17:59:51-05:00
[H264:Track1]   Date/Time Original              : 2014:02:26 17:59:51-05:00
[H264:Track1]   Date/Time Original              : 2014:02:26 17:59:51-05:00
[H264:Track1]   Date/Time Original              : 2014:02:26 17:59:51-05:00
[H264:Track1]   Date/Time Original              : 2014:02:26 17:59:51-05:00
[H264:Track1]   Date/Time Original              : 2014:02:26 17:59:51-05:00
[H264:Track1]   Date/Time Original              : 2014:02:26 17:59:51-05:00
[H264:Track1]   Date/Time Original              : 2014:02:26 17:59:51-05:00
[H264:Track1]   Date/Time Original              : 2014:02:26 17:59:51-05:00
[H264:Track1]   Date/Time Original              : 2014:02:26 17:59:51-05:00
[H264:Track1]   Date/Time Original              : 2014:02:26 17:59:51-05:00
[H264:Track1]   Date/Time Original              : 2014:02:26 17:59:51-05:00
[H264:Track1]   Date/Time Original              : 2014:02:26 17:59:51-05:00
[H264:Track1]   Date/Time Original              : 2014:02:26 17:59:51-05:00
[H264:Track1]   Date/Time Original              : 2014:02:26 17:59:51-05:00
[H264:Track1]   Date/Time Original              : 2014:02:26 17:59:51-05:00
[H264:Track1]   Date/Time Original              : 2014:02:26 17:59:51-05:00
[H264:Track1]   Date/Time Original              : 2014:02:26 17:59:51-05:00
[H264:Track1]   Date/Time Original              : 2014:02:26 17:59:51-05:00
[H264:Track1]   Date/Time Original              : 2014:02:26 17:59:51-05:00
[H264:Track1]   Date/Time Original              : 2014:02:26 17:59:51-05:00
[H264:Track1]   Date/Time Original              : 2014:02:26 17:59:51-05:00
[H264:Track1]   Date/Time Original              : 2014:02:26 17:59:51-05:00
[H264:Track1]   Date/Time Original              : 2014:02:26 17:59:51-05:00
[H264:Track1]   Date/Time Original              : 2014:02:26 17:59:51-05:00
[H264:Track1]   Date/Time Original              : 2014:02:26 17:59:51-05:00
[H264:Track1]   Date/Time Original              : 2014:02:26 17:59:51-05:00
[H264:Track1]   Date/Time Original              : 2014:02:26 17:59:51-05:00
[H264:Track1]   Date/Time Original              : 2014:02:26 17:59:51-05:00
[QuickTime:Track2] Track Create Date            : 0000:00:00 00:00:00
[QuickTime:Track2] Track Modify Date            : 0000:00:00 00:00:00
[QuickTime:Track2] Media Create Date            : 0000:00:00 00:00:00
[QuickTime:Track2] Media Modify Date            : 0000:00:00 00:00:00


I could enable this feature with an option, but I'm not sure what would be best.  I don't want to just enable it with -ee because people that already use -ee for other reasons would see a huge performance penalty.  Maybe I could just extract the first timestamp, which shouldn't slow things down to much, but what if someone wants to extract them all?

- Phil
Title: Re: How can I use Recorded Date to rename my mts/mpg video files
Post by: Phil Harvey on January 21, 2021, 10:36:01 AM
I have an idea.  I could enhance the -ee option so -ee2 parses the H264 stream until the first SEI message is decoded (so the first DateTimeOriginal will be extracted), or -ee3 to decode all SEI information.

- Phil
Title: Re: How can I use Recorded Date to rename my mts/mpg video files
Post by: twoj on January 21, 2021, 11:05:52 AM
I think thats an excellent idea
when i started this some years ago my idea was to reverse-engineer the avchd mts and cpi and cont files, but it seems that each manufacturer implements avchd slightly differently. I had exchanged a few emails with Hayo Bann when i used his script from this post;
https://exiftool.org/forum/index.php?topic=6938.msg35137#msg35137
So you know that the timestamp is encoded along the stream. I did make some progress in figuring out some stuff but i ran out of time and patience to do a simple task like change the timestamp of the mts video. When they came up with the metadata i guess they never thought that the timestamp could be incorrect.

Do you have an idea when you would be able to implement this?
thanks Bryan
Title: Re: How can I use Recorded Date to rename my mts/mpg video files
Post by: Phil Harvey on January 21, 2021, 12:53:36 PM
Hi Bryan,

Quote from: twoj on January 21, 2021, 11:05:52 AM
Do you have an idea when you would be able to implement this?

It's done.

- Phil