2 frames difference of timecode extracted by Exiftool or Adobe Media Encoder

Started by huyun0, July 05, 2017, 02:19:35 AM

Previous topic - Next topic

huyun0

First of all, I would like to thank Prof. Phil Harvey for making this wonderful tool for digital media files.
Recently I encountered a problem, when I want to extract timecode from a mts file, I found the value extracted from Exiftool is different from the one from Adobe Media Encoder CC, there is always 2 frames difference of the 2 values, please see the screenshot as following:
1, From Exiftool


2, From Adobe Media Encoder CC


Have any one known the reason? Your answer would be greatly appreciated.

huyun0

This is not an occasional case, all MTS files recorded with SONY or Panisonic, Canon, have 2 frames less than those timecode extracted from Exiftool.
Looking forward to some discussion.

Phil Harvey

All I can say is that Exiftool is showing you the actual TimeCode values stored in the file.  It is possible that the byte value of the frames in the TimeCode record has a different meaning, but I can't check this because I don't have access to the H264 specification, and am working from incomplete documentation.  But are you sure that you are seeing the full duration in Adobe Media Encoder?

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

huyun0

Quote from: Phil Harvey on July 05, 2017, 08:29:27 AM
All I can say is that Exiftool is showing you the actual TimeCode values stored in the file.  It is possible that the byte value of the frames in the TimeCode record has a different meaning, but I can't check this because I don't have access to the H264 specification, and am working from incomplete documentation.  But are you sure that you are seeing the full duration in Adobe Media Encoder?

- Phil

Hi Prof. Phil,

I am really grateful for your personal prompt reply,
What do you mean the  'full duration' in Adobe Media Encoder (AME)? Sorry I am not very techical.
What I am very sure is that the byte segement location Exiftool reads from a MTS file is definitely correct, because I made a program to extract timecode metadata with Exiftool for a hundred MTS files and compare the difference to those extracted by AME, all of the results for every MTS file are almost same, only difference is that the first one is 2 frames bigger than the last one, like as aa:bb:cc:dd to aa:bb:cc:(dd-2).  So, regarding your question of 'a different meaning', my answer is 'no', and as you said, I also checked the HEX value in MTS file, the value of timecode is exact as Exiftool reads,
So I am doubt if AME changes the value for some specific purpose? and another point very popular on internet is that AME extracts timecode only when the MTS file is associated with a clip file with extension .CPI, if not, AME set the timecode to 00:00:00:00 while Exiftool can still extract a correct timecode (which I think Exiftool is really great~~) from the MTS file.
I am uploading a MTS file of 1.3s video (Link: http://pan.baidu.com/s/1o8AzoXs   pass: mp1d), since this file was cut by FFmpeg(I have to make the file has a size under 10M limitation) so there is no associated CPI file for AME to get a timedoe, but Exiftool can read successfully, I wish it helps everyone which is interested to analyse the H.264 coding which would be very meaningful for me.
By the way, Prof. Phil, why Exiftool doesn't support MXF container? I have to use Mediainfo to read MXF and Exiftool to read MTS~~
Once again, I would really appreciate your support~~

Phil Harvey

Quote from: huyun0 on July 05, 2017, 11:45:11 AM
What do you mean the  'full duration' in Adobe Media Encoder (AME)?

The screendump you posted shows a time at the top of a progress bar, but the first frame of the video has already been displayed, so is it possible that this is the duration of the remaining video frames?  That would give a difference of 1.  And if the duration is calculated to the start of the last frame instead of the end, that could be another difference of 1, for a total difference of 2 frames.  This is only wild conjecture.[/quote]

QuoteBy the way, Prof. Phil, why Exiftool doesn't support MXF container? I have to use Mediainfo to read MXF and Exiftool to read MTS~~

ExifTool does read MXF metadata (since Dec 2010, version 8.43).

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

huyun0

Hi Prof. Phil,

Great thinking~~

The 2 frames deduction you supposed seems the only explanation up to now, I will try to look for some information on how the Adobe Encoder works on the timecode,

By the way, your answer also reminds me of the duration issue, I just noticed as the screendump above indicate, the same clip duration seems also different from Exiftool with a value of 18.90, while 00:00:18:18 from Adobe Encoder, my video is 25fps format, so the duration of Adobe Encoder should be 18+18/25 = 18.72s, even if we add the 2 frames it comes to 18.8s, there is still about (18.9-18.8s)=0.1s (about 2.5frames),  so my question is ,what is your algorithm to caculate the time of duration?  Furthermore, do you think this minor difference might be to some extent related with the Timecode difference?

For Exiftool working on MXF, I will check again~~

Great thanks~~

Phil Harvey

There is no calculation involved in the decoding of H264:TimeCode.  It is stored as 4 bytes, and ExifTool shows you the values of each byte, separated by colons.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

huyun0

Hi Prof. Phil,

On the previous post, I mean there is an difference in the length of the clip in addition to we discussed about Timecode, as I mentioned the duration of example clip from extracted Adobe Encoder is 00:00:18:18, which is 18.72s, while 18.90s by Exiftool. And, I use FFmpeg to get the information, it's also 18.72s.

So I would like to know if the reason for this is as same as the Timecode issue,

Sorry to taking you so much time to answer~~~~ Great thanks.

Phil Harvey

I really don't know.  ffmpeg should give an accurate duration for the video, but I don't know how it obtains this value.

If I get a chance I'll look into this in more detail.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

huyun0

Hi, Prof. Phil,

Just want to let you know that the 2 frames difference of timecode,  seem to be the intention of Adobe Media Encoder, because I tested more than 300+ MTS files, and all timecodes of these files are 2 frames earlier in Adobe Media Encoder than Exiftool, I wish this finding would be useful to you and other fans of you-:)

By the way, I am also working on r3d raw format by RED camera, so far I couldn't extract metadata it with Exiftool......

Thanks~~

Phil Harvey

Thanks for this note.

I wouldn't be surprised if there was no metadata in R3D files -- the seem to store it in an RMD sidecar file.  [Edit: A quick look shows that they do contain some metadata.  I'll see about decoding it.]

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).


Phil Harvey

ExifTool 10.77 supports reading metadata from R3D videos, and 10.78 will decode even more tags from these.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

huyun0

Hi, Prof. Phil,

It's great to have the new feature of Exiftool~~

Thank you for the great job!!

Hu Yun