Log in

View Full Version : Cineform Decoder queries


WorBry
30th November 2013, 22:45
I’ve been experimenting with the GoPro Studio software of late, in part to examine the quality (enough said) of raw Hero3+ action cam samples (with and without ProTune metadata) and the implications for third-party editing and processing. GoPro Studio utilizes the Cineform codec as an intermediate format in its internal processes and output to third-party software.

It's encouraging to find that MPC-HC (with GoPro Studio installed) plays back the Cineform/WAV muxed avi files and appears to use the native Cineform decoder to do so. VLC player seems “unable to find a CFHD decompressor”.

That said, one thing I have observed with MPC-HC is that, on first playback, at some point into the video, the audio becomes disrupted and the video starts to stall. Once it has got through that first pass however, the video subsequently plays without any problems. Not a big issue, but is this a known quirk that might be overcome? Looking at the Cineform Decoder-2 config, as it shows in the MPC-HC ‘Filters’ view during playback, it appears that it is able to output in a range of ‘pixel formats’. I was wondering which of these MPC-HC uses? Edit: Screen shot of Decoder attached.

My second query relates to processing these files through AVISynth. The Cineform codec as it appears in the Virtual Dub vfw compression library reveals only the encoder. When Cineform avi files are opened directly in VirtualDub, the File Information shows the decoder to be the GoPro Cineform codec and so looks to be outputting directly to RGB. When the files are opened as an AVISource into AVISynth however, the output is always YUY2 4:2:2 (in which case Vdub shows the decompressor to be 'YUV 4:2:2 (YUY2)'. The Cineform format is itself 10-bit YUV 4:2:2 (4:4:4 for 3D video). As I understand, AVISynth always looks for YV12 input, before YUY2, so it appears that the vfw Cineform decoder is not offering YV12 per se. Tried also as DirectShowSouce with pixel_type="YV12", but no joy.

Since (I’m sure like most people) I perform AVISynth processing in, and with output to YV12, I have therefore been adding a ConvertToYV12 step at the top of the script. The encoder however accepts both YUY2 and YV12 inputs without any problem, and so, in multi-stage processing, the only consideration is in possible sampling inefficiencies introduced as the Cineform files are returned from YUY2 to YV12 color space.

What has me wondering is that one of the listed Cineform Decoder-2 ‘pixel’ output options is NV12. From what I have read, NV12 is, like YV12, a YUV 4:2:0 color space, the only difference being that NV12 is interleaved. As I understand it, NV12 output is primarily intended for hardware decoding, as opposed to YV12 for software decoding.

Notwithstanding the possibility that the Cineform Decoder-2 (as used by MCP-HC) and vfw CFHD decompressor (??) are different entities, I wonder if there is any scope for conversion of the NV12 output to YV12 in a manner that would obviate the YUY2 to YV12 re-conversion? Anything in the FFMPEG domain?

Just a thought.

WorBry
1st December 2013, 03:21
Hmmm....thinking about it, seems likely that Cineform outputs to 8-bit NV12 via a YUY2 intermediate anyway (and likewise the encoder, in reverse) so there's probably nothing to be gained in attempting to tap into the NV12 output.

Could consider AVISynth processing in YUY2 as far as possible, but it would be slower, at some point there's going to be YUY2 to YV12 conversion, so probably better to 'bite that bullet' from the outset.

So, optimum workflow with would likely be edit in Cineform and convert once to YV12 for AVISynth processing.

Any GoPro Hero cam users out there who do it differently?

kolak
6th December 2013, 16:34
VLC uses ffmpeg for decoding, which has no CF support.

Default CF decoder output is YUY2, but tab which you showed allows you to overwrite it, so you can set your desired output format. Once you set NV12 (hit Make Default button) than avisynth should get NV12 data as the default (but it does support it in avisource, so it does not work). RGB24 works for example.

I've played with CF and vapoursynth and I was able to request even v210 and it worked very well.

In your case it's even desired to use YUY2, why would you degrade your source straight away to 4:2:0. Keep it 4:2:2 and convert to 4:2:0 in the last step if required.

WorBry
9th December 2013, 01:44
Thanks.

... Once you set NV12 (hit Make Default button) than avisynth should get NV12 data as the default (but it does support it in avisource, so it does not work).....

I think you rather meant avisynth doesn't support it (NV12) in avisource, but I get the gist.

I've played with CF and vapoursynth and I was able to request even v210 and it worked very well.

That's an interesting possibility; I've not looked at VapourSynth as yet. Edit: Looking at the list of currently available plugins though I doubt I could find much, if any use for it.

In your case it's even desired to use YUY2, why would you degrade your source straight away to 4:2:0. Keep it 4:2:2 and convert to 4:2:0 in the last step if required.

Yes, that's something I have been re-considering. Clearly, changing from an 'all YV12' to 'all YUY2' AVISynth workflow requires careful examination of the manner in which chosen or alternative filters and functions handle the respective inputs, and particularly whether internal color space conversions might be involved that could 'break the chain', so to speak.