-
Notifications
You must be signed in to change notification settings - Fork 273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add VIDEO_FORMAT header when writing to string/file from ALE adpater #462
Add VIDEO_FORMAT header when writing to string/file from ALE adpater #462
Conversation
Adds a video_format kwarg to the adapter signature, allowing you to set the format on output. The fallback is to preserve the existing header column, if set. Finally it searches each clips ALE metadata for an "Image Size" setting to infer a project format. If none of that is found it defaults to the adapters DEFAULT_VIDEO_FORMAT (1080)
Codecov Report
@@ Coverage Diff @@
## master #462 +/- ##
==========================================
+ Coverage 87.21% 87.99% +0.77%
==========================================
Files 67 68 +1
Lines 6819 6878 +59
==========================================
+ Hits 5947 6052 +105
+ Misses 872 826 -46
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just had a couple small tweaks. Thanks!
@@ -109,6 +111,20 @@ def _parse_data_line(line, columns, fps): | |||
)) | |||
|
|||
|
|||
def get_video_format(width, height): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be a good idea to bump this map up to the top level and/or add a comment about how to use this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what 'top level' means in an adapter file, but I added a brief comment and made it "private"
Move metadata search and the video_format mapping into private methods outside of `write_to_string`
def _video_format(width, height): | ||
"""Utility function to map a width and hight to an Avid Project Format""" | ||
|
||
format_map = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant that this map could be moved outside the function as a module level constant -- AVID_PROJECT_HEIGHT_TO_WIDTH_MAP = {...}
or something. We're trying to call out these kinds of constant definitions to make them easier to find in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, I think I understand the request, however I don't think that dict would be very useful unless you are applying the width check for resolutions wider than 1920, which avid (currently) considers CUSTOM
I can move the _video_format(...) function to the top of the file and make give that a "public" syntax if you think that would be helpful
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ssteinbach - I moved and renamed it. please let me know if that is more what you are thinking
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, looks great. Thanks!
rename _video_format() to AVID_PROJECT_FORMAT_FROM_WIDTH_HEIGHT()
Rename function to AVID_VIDEO_FORMAT_ from AVID_PROJECT_FORMAT_ to be more accurate to what is being mapped
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thanks.
So, the Media Composer seems to be a bit picky about ALE headers and it will complain if we don't set a
VIDEO_FORMAT
. This MR looks to do that.1080p is probably the most popular format being used right now, but I am open to suggestions if anyone has other thoughts on default settings