-
Notifications
You must be signed in to change notification settings - Fork 309
Add filebundle (otioz and otiod) adapters #561
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 filebundle (otioz and otiod) adapters #561
Conversation
Codecov Report
@@ Coverage Diff @@
## master #561 +/- ##
==========================================
+ Coverage 84.33% 84.36% +0.03%
==========================================
Files 74 74
Lines 3090 3090
==========================================
+ Hits 2606 2607 +1
+ Misses 484 483 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
I like this a lot. It seems tremendously useful and is very simple in concept. If you require the internal otio to have the same name as the zip file, then it will break if/when someone renames the zip file. Using a consistent name, like On the reading side, how would someone extract the media files? Maybe there could be a helper function or option on the reader to unzip the bundle? That would also allow for a future switch from zip to some other bundle mechanism, if needed. |
Great note! I like content.otioz. As far as a command to unzip the bundle, do you mean some kind of api function you can call? I like the idea of putting an API call that encapsulates the schema though. Also I wonder if we can put an extra magic number into the file somehow to detect which 'version' of OTIOZ it is. |
You could put a version in OTIOZ metadata on the top level object, or wrap the content in a |
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.
This is super interesting.
I think it also may be useful to be able to selectively extract media from the otioz (i.e. give me the essence bytes for this specific media reference).
There are some nitpicky considerations here like how we uniqify filenames in the archive and what the conventions should be around constructing target_urls so it's clear how to locate them within the archive (Here is an interesting discussion I found with some interesting conventions around this: frictionlessdata/datapackage#137).
I think the idea of dropping some well-named file in the archive with version info is a good one that serves a couple purposes. Relying on files to keep their extensions all the time can be a little risky, so it's helpful to have some signal in the content of the file that can help you identify that it's a special kind of zip.
Overall, I'd love to see this in the hands of users and see what ideas they have!
What if we had two adapters: |
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.
Just a few minor comments. This is looking really cool!
except AttributeError: | ||
continue | ||
|
||
if not target_url.startswith("file://"): |
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.
This isn't a requirement, but using urlparse for operating on these urls may help add clarity:
try:
# Python 2.7
import urlparse
except ImportError:
# Python 3
import urllib.parse as urlparse
parsed_url = urlparse.urlparse(target_url)
if not parsed_url.scheme == "file":
...
# And for line 94:
target_file = parsed_url.path
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.
that is way better, good call.
We'll version in the OTIO file rather than come up with a separate versioning scheme specifically for otioz. |
Rebased onto current master branch. |
Because we don't have a concrete need for this at the moment, and there is concern that this might expand the scope of OTIO (because this is a file format that includes media), we've decided to close this for now. The branch will remain in my fork so that if there is a desire for this in the future, this work can be brought forward and re-applied. Please let us know if you have any questions! |
I came across this SMPTE spec for AXF which attempts to address a similar problem: It looks like AXF attempts to address issues of very large data sets, as well as a bunch of extra metadata about each item in the archive. I'm just posting this here for future reference, since OTIOZ is likely to come up again 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.
using six here is nice
Thank you to the community for the thorough review. |
overview
Introduces the idea of an OTIO "file bundle". This has two flavors: .otioz and .otiod. This PR includes documentation and implements adapters that can convert into those formats.
otioz
zipfile
module)file:
protocoltarget_url
fields, as parsed byurllib
in python)content.otio
encodes the structure of the timeline and exclusively references media which is present in themedia
subdirectory.content.otio
is compressed, but the rest of the media files are notversion.txt
is only present in otioz files and exclusively encodes a file bundle version string into the file in case of future changes to the layout of file bundlesotiod
.otioz
can be expanded usingotioconvert
through the adapter system without needing to use zip directly, into a form that any system that readsotio
from the filesystem can consume.TODO:
file://
vsfile:
consistent when generating absolute paths[ ] add a-- going to do this in a future PR/issuefile:///path/to/otioz?file=media/somefile.mov
form ofExternalReference.target_url
when reading OTIOZ files... this allows the otiod adapter the ability to directly decompressotioz
files, andotioconvert
could detect it when going from otioz to otiod.