Opened 5 years ago

Last modified 7 months ago

#1087 open enhancement

support decoding the CineForm codec

Reported by: dericed Owned by:
Priority: wish Component: avcodec
Version: git-master Keywords: CFHD, CineForm
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

I found that ffmpeg can't read CineForm? CFHD files.

There are some samples available here: http://samples.mplayerhq.hu/V-codecs/CFHD/
I may be able to provide more samples if needed.

ffmpeg -y -i MT_BeartoothHighway_1min_Cineform.avi anything.mp4
ffmpeg version N-34835-g4a9f466 Copyright (c) 2000-2012 the FFmpeg developers
  built on Mar  4 2012 08:53:39 with gcc 4.2.1 (Apple Inc. build 5666) (dot 3)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/HEAD --enable-shared --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --enable-libfreetype --cc=/usr/bin/gcc-4.2 --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libxvid --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libass
  libavutil      51. 41.100 / 51. 41.100
  libavcodec     54.  7.100 / 54.  7.100
  libavformat    54.  2.100 / 54.  2.100
  libavdevice    53.  4.100 / 53.  4.100
  libavfilter     2. 63.100 /  2. 63.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0.  7.100 /  0.  7.100
  libpostproc    52.  0.100 / 52.  0.100
[avi @ 0x7fb4c201ae00] decoding for stream 0 failed
[avi @ 0x7fb4c201ae00] Could not find codec parameters (Video: none (CFHD / 0x44484643), 1280x720)
Input #0, avi, from 'MT_BeartoothHighway_1min_Cineform.avi':
  Duration: 00:01:01.96, start: 0.000000, bitrate: 16472 kb/s
    Stream #0:0: Video: none (CFHD / 0x44484643), 1280x720, 29.97 fps, 29.97 tbr, 29.97 tbn, 29.97 tbc
    Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, 2 channels, s16, 1536 kb/s
Video pixel format is unknown, stream cannot be encoded

Attachments (1)

color_709.avi (194.1 KB) - added by shekh 7 months ago.

Download all attachments as: .zip

Change History (35)

comment:1 Changed 5 years ago by cehoyos

  • Priority changed from normal to wish
  • Reproduced by developer set
  • Status changed from new to open

comment:2 Changed 5 years ago by compn

we need a specification or whitepaper or other info on this codec to speed up development of a decoder.

try contacting cineform , maybe they will share with us?

comment:3 Changed 4 years ago by leandroprz

I contacted Cineform support and they replied back:

===========
Thank you for you interest in Cineform. Please would you provide some more details of your project ?
===========

I'm no developer so I don't know what to reply.

comment:4 Changed 4 years ago by compn

tell them you want cineform cfhd decoding support in the ffmpeg project.
http://www.ffmpeg.org
that may answer their questions.

comment:5 Changed 4 years ago by ianken

FWIW: Cineform is on it's way to becoming a SMPTE standard as "VC5"

https://kws.smpte.org/apps/group_public/project/details.php?project_id=15

comment:6 Changed 4 years ago by compn

someone could try again to get a response back from cineform...

comment:7 follow-up: Changed 3 years ago by richardpl

Is there dll somewhere?

comment:8 in reply to: ↑ 7 Changed 3 years ago by heleppkes

Replying to richardpl:

Is there dll somewhere?

There is a binary decoder here, for DirectShow/VfW as well as QuickTime? (Mac):
http://cineform.com/gopro-cineform-decoder

comment:9 Changed 22 months ago by 11rcombs

Apparently Cineform has now been adopted as VC-5 by SMPTE; the spec documents are here: http://standards.smpte.org/search?fulltext=VC-5&smptes-status=in-force&submit=yes&content-group=smptes&x=0&y=0

comment:10 Changed 19 months ago by richardpl

I'm not subscribed and I'm not going to pay for spec documents.

comment:11 Changed 11 months ago by caseyh

With VR coming down the pipeline, we are looking at the best way of dealing with much higher resolution files efficiently and it seems that for windows, Cineform may be the best way to go when dealing with moving between Adobe and ffmpeg. What is the proper place to try to contribute to VC-5 decoding (any maybe even encoding?) support to be added to avcodec. Also, what is needed to make this happen - I can gather documents and contact people easily enough.

Also, what is necessary to increase the priority for the ticket?

comment:12 Changed 11 months ago by richardpl

Get specification and contact developers, me for example.

comment:13 Changed 10 months ago by richardpl

I got specification.

comment:14 Changed 10 months ago by kierank

Specification is not very useful, please provide more samples.

comment:15 Changed 10 months ago by rkromer

I can provide file examples on Monday.

comment:16 Changed 10 months ago by rkromer

Here I up-loaded two short clips: http://avpres.net/CineForm/

comment:17 Changed 10 months ago by kierank

Thanks, can you document the expected resolution of these files?

comment:18 Changed 10 months ago by cehoyos

bigger_res.mov: 4512x2952
lower_res.mov: 3312x2488
Or do I miss something?

comment:19 Changed 10 months ago by kierank

Asking because these files are completely different internally to other CFHD samples I have.

comment:20 Changed 10 months ago by cehoyos

Just guessing: The new files correspond to the VC-5 specification while the files we already had are years old and use another codec (with the same fourcc)?

comment:21 Changed 10 months ago by kierank

No files in the wild comply with VC-5 at this time.

comment:22 Changed 10 months ago by cehoyos

So VC-5 is just based on Cineform but different? What fourcc does it use?

comment:23 follow-up: Changed 10 months ago by kierank

VC-5 uses some of the features from Cineform but it's a different codec.
The fourcc's are not standardised yet but I guess it will use "VC-5" or similar.

I get the feeling this is just marketing though with the intent that Cineform can say their codec is standardised but you have to buy their implementation in order to play actual files in the real-world.

comment:24 in reply to: ↑ 23 ; follow-up: Changed 10 months ago by cehoyos

Replying to kierank:

VC-5 uses some of the features from Cineform but it's a different codec.
The fourcc's are not standardised yet but I guess it will use "VC-5" or similar.

Thank you for explaining!

I get the feeling this is just marketing though with the intent that Cineform can say their codec is standardised but you have to buy their implementation in order to play actual files in the real-world.

The scandal is apparently that SMPTE allowed to be (ab)used for this marketing gag.

comment:25 in reply to: ↑ 24 Changed 10 months ago by kierank

The scandal is apparently that SMPTE allowed to be (ab)used for this marketing gag.

This is normal in SMPTE - AVC-Intra is another example.

comment:26 Changed 9 months ago by rkromer

Sorry for stepping in that late!
Yes, it's 4512 x 2952 pixel resp. 3312 x 2488 pixel.
Yes, it's scandalous that SMPTE accepted CineForm?/VC-5 as a standard without having to document the format.

comment:27 follow-up: Changed 9 months ago by kierank

Interestingly these files seem to have an internal resolution of a quarter of what they are meant to be. Perhaps they are encoded as quadrants or something.

What pixel format are they (YUV, RGB, ???) - nothing looks correct so far. There appears to be 4 planes though and I don't understand how a film scanner can scan alpha.

comment:28 Changed 9 months ago by rkromer

Yes, the sensor has 4 quadrants. Bayer is used. I'll check next week, if I can find the pixel format. The CLI MediaInfo?? gives me CFHD; I'll try also a hex dump if you don't haven't yet done it.

comment:29 in reply to: ↑ 27 Changed 9 months ago by cehoyos

Replying to kierank:

What pixel format are they (YUV, RGB, ???) - nothing looks correct so far. There appears to be 4 planes though and I don't understand how a film scanner can scan alpha.

If it is a Bayer format, please look at AV_PIX_FMT_BAYER_BGGR8 and AV_PIX_FMT_BAYER_BGGR16 and their friends. If it is CMYK, you will find a conversion routine in mjpegdec.c. But in any case, if you have a patch that produces a recognizable image with wrong colours (and resolution) please post it, others could improve it.

comment:30 Changed 9 months ago by rkromer

It should be RGR. I’ll try to find out more on Monday.

comment:31 Changed 9 months ago by rkromer

Last edited 9 months ago by rkromer (previous) (diff)

comment:32 Changed 9 months ago by rkromer

The packet will be decoded to a 16 bit Bayer space image. A single 16 bit ushort per pixel. Are you deriving the size based off of 4 components per pixel RGBA (4 x 16 bit)? This may be be where you are miscalculating resolution. Information from the CineForm? SDK definitions:

Original to encoder

CFHD_PixelFormat = CFHD_PIXEL_FORMAT_BYR4 = FOUR_CHAR_CODE('BYR4')

«RAW» Bayer 16 bits per pixel received by the encoder should also be used as the decoded interpretation.

Compressed

CFHD_PixelFormat = CFHD_PIXEL_FORMAT_CFHD = FOUR_CHAR_CODE('CFHD')

CFHD_EncodedFormat = CFHD_ENCODED_FORMAT_BAYER

CFHD_BayerFormat (Bayer phase) will be one of the following, but can change every frame based on stabilisation

typedef enum CFHD_BayerFormat {
    CFHD_BAYER_FORMAT_UNKNOWN = -1,
    CFHD_BAYER_FORMAT_RED_GRN = 0,
    CFHD_BAYER_FORMAT_GRN_RED = 1,
    CFHD_BAYER_FORMAT_GRN_BLU = 2,
    CFHD_BAYER_FORMAT_BLU_GRN = 3,
} CFHD_BayerFormat;

Hope this helps!

Changed 7 months ago by shekh

comment:33 Changed 7 months ago by shekh

I saved color_709.avi with vfw codec 9.0.5, option "use 709" was on.
I noticed value at offset 203F, it is either 01 (709 off) of 02 (709 on).
Hope this helps.

comment:34 Changed 7 months ago by v0lt

On this page there are samples that ffplay not play.
http://www.siliconimaging.com/DigitalCinema/gallery_footage.html
Not all samples are available, but something can be downloaded.

Note: See TracTickets for help on using tickets.