Get media source resolution from timeline segment

Hey,

I am trying to get resolution information form timeline PySegment. I haven’t found a way to get media source from PySegment - is there any way to get it?

I have noticed that PySequence inherits from PyClip so width and height are available there. But PySegment is inheriting from PyFlameObject and there is none of those attributes available.

Thank you for any help :wink:

Yeah, right, how do we go from PySegment to Pyclip seems a mystery.
Can we?
@fredwarren, if you please, is this possible?
Cheers

You can get the PyClip of a PySegment via the parent property of the PyFlameObjects
PySegment.parent give the PyTrack
PyTrack.parent give the PyVersion
PyVersion.parent give the PyClip
so PySegment.parent.parent.parent will give you the PyClip of the PySegment

Hi and thank you Philippe,
It seems that PySegment.parent.parent.parent returns the PySequence ancestor, which does have width and height, but that’s the resolution of the sequence containing the clip, not the clip itself.
The parent of the sequence is the reel, or a folder (library …)
Did I misunderstand something?

2 Likes

The following properties are available on a PySegment as of the 2023 version:

PySegment (source, gap, bfx):

  • source_width
  • source_height
  • source_bit_depth
  • source_ratio
  • source_scan_mode
  • source_colour_primaries
  • source_matrix_coefficients
  • source_transfer_characteristics

PySegment with source media:

  • source_cached
  • source_has_history
  • source_unlinked
  • source_essence_uid
  • source_uid
  • original_source_uid

PySegment on an audio track:

  • source_sample_rate
3 Likes

Very nice!!!
Thanks a lot!