Aye Silicon,
I guess @FranceBB, the goal here is just to decode the file correctly and conforming to the standard. Also, the Origin Metadata tells what frames cannot be displayed (but MUST BE decoded). The decoder must be in deed feed with the defective frames of the first Open GOP in the file at the start, otherwise it could not decode the actually visible frames. It is something that ffmpeg will not do (at least not in the next 10 years i guess hehe)
Thats kind of an issue because none of our decoders nor ffmpeg supports Precharce (Origin) and Rollout out of the box. In fact, ffmpeg don't support origin AND rollout. That said, if you Transcode (so decode/encode) the file, it is not a MUST to honor origin and rollout because after transcoding the mpeg structure of start and end will not be defective anymore. But of course the duration will differ from the original (up to 15-16 frames longer).
One way to deal with it is working around like this:
1) parse the origin value and duration in frames using the tool on ffastrans.com/share (folder: support/Tools/GetMXFDuration.zip)
2) Note that you have to add the Origin value to the Duration value, %s_parsed_duratoin% = %s_parsed_duratoin%+%s_parsed_origin%
3) use A/V Decoder and after that, use a custom avisynth script , content:
m_clip = trim(m_clip,%s_parsed_origin%,%s_parsed_duration%)
Downloads:
1)
https://ffastrans.com/share (folder: support/Tools/GetMXFDuration.zip)
Analyzer, a custom tool that can tell you the
exact duration that an Omneon Server would recognize when importing the same file and a few more things that usual analyzers don't tell you about MXF files.
2)
https://ffastrans.com/share (folder: samples/MXF_TESTFILE_ORIGIN_5_ROLLOUT_1.mxf)
Using this file as a source file for testing, you will be able to visually see if origin and rollout have been processed correctly. All frames that are Origin or Rollout have a special colour and text.
Regex for getting the Duration (use in $regext function in a populate proc):
Duration.*? : (\d+)
Regex for getting the Origin (use in $regext function in a populate proc):
SPH Origin.*? : (\d+)
The Analyzer tool output will look like this, you only care about the Duration (Omneon decoder) and the SPH Origin value. The Lastsystemitem userdate is buggy, don't count on the value to be what you think (it is the first systemitem time of the last body partition in the file) but all other values are pretty accurate.
Code: Select all
Firstsysitem Userdate: 10:12:03.13
Lastsystemitem Userdate: 10:12:03.13
Duration (Omneon decoder) : 12(00:00:00:12)
Materialpackage:
MPH Duration: 18446744073709551615 (error/undefined)
MPH Origin : 0
MPH StartTC : 10:12:03:15
Sourcepackage:
SPH Duration: 18446744073709551615 (error/undefined)
SPH Origin : 2
SPH StartTC : 10:12:03:13
Example workflow (notice that we take care about the Origin but not the rollout, lemme know if you need to handle rollout as well):
Further actions needed:
-) We would also need to reset the stat timecode to the one from Sourcepackage because our analyzers will spit out the one from materialpackage
-) Handle rollout?