gopro / cineform-sdk

The GoPro® CineForm video codec SDK.
Apache License 2.0
275 stars 57 forks source link

Where are samples/documentation? #39

Closed irieger closed 5 years ago

irieger commented 5 years ago

Hello,

I thought about integrating cineform into a toy project of mine which currently can just process image sequences through openimageio. I know oiio would even be able to do some stuff with video files, but my implementation is for frame sequences only at the moment. Cineform seems like a nice intermediate codec and as I just realized a few days ago that DaVinci Resolve supports Cineform it would be nice to integrate it as working with large sequences of OpenEXR/tiff/dpx files is cumbersome. (Resolve for Linux is Cineform read only at the moment so I never saw it in the export and hadn't realized Resolve has at least some support for it.)

However, I'm unable to find a documentation for the use of Cineform either in the repository nor in the README and there is no usage sample. As I haven't found any other repository from gopro, is there any sample repository for the usage of cineform-sdk or a sample site? I saw some mentions about some docu/samples from the times before cineform-sdk was open source somewhere. Are those available?

dnewman-gpsw commented 5 years ago

There is sample code for using the CineForm SDK here: https://github.com/gopro/cineform-sdk/tree/master/Example

irieger commented 5 years ago

I meant like an example to understand the code. The only thing I can spot there is the code that generates the TestCFHD which is absolutely not self-describing and the only comments besides a few small notes are the licence information. Searching more for an example how to just use Cineform to read/write a file, like coming from an array of uint16_t RGB data or something like that giving it to cineform and write to mov/read mov and get uint16_t or so?

dnewman-gpsw commented 5 years ago

There is not too much complexity to implementing things like uint16_t RGB (use CFHD_PIXEL_FORMAT_RG48), that is shown in the sample code as all the pixel formats are tested. I think you are wanting sample code for the complete file I/O from an MOV or similar. As file I/O is so system dependent, I didn't include an MOV writer. There is a very simple MP4/MOV reader in the repo, (a more recent version here https://github.com/gopro/gpmf-parser) there is no writer equivalent included. Most developers are adding CineForm to an existing media I/O layer, so this has been sufficient documentation for that purpose. For a MOV/MP4 writer you will need to look at FFMpeg, GStreamer, Media Foundation or AV Foundation etc.

irieger commented 5 years ago

Hey, sorry. Missed this. Got around it in the meantime by using the ffmpeg library (libavformat) access avi/mov clips with cineform. Now I'm working on getting the encoding/muxing side running but from the cineform side I seem god for now. I'll try to find some time to extract the cineform handling stuff from my project and create a small usage sample for the ffmpeg/cineform-sdk combination.

dnewman-gpsw commented 5 years ago

Please be aware that the CineForm decoder in FFMPEG was a reverse engineered implementation, it is not complete (not all pixel formats supported,) and it is significantly slower. So eventually you may want to only use the file I/O from FFMPEG and this SDK for both encode and decode.

irieger commented 5 years ago

Sure, I'm fully aware of the situation of the ffmpeg-codec. Did it the way you suggest. I'm only using libavformat to get frame packages and uncompress via cineform-sdk. Trying the same for encoding now. Frame compression via SDK is already done, now I'm working on building the container via ffmpeg.

zcream commented 4 years ago

Hi irieger, looking forward to seeing your usage sample.

irieger commented 4 years ago

Yeah, if I only had time. Started a Github project and prepped some stuff locally but currently my master thesis is priority 1 and everything else has to way. Will update when I found the time to clean my code from project related structures and make it working standalone. As my code works fine in my current application this should be an easy task (besides a few deprecation warnings I should address while reworking it...).