View Full Version : cfenc - command line Cineform encoder
F1nkster
5th April 2020, 13:50
Not sure what the interest level may be, but thought I would at least make it known that I wrote a command line Cineform encoder for Linux. Mac is also supported, but the main purpose and value is Linux, for which no native Cineform encoder has been available up to now.
You can find it here (with full details, please visit the site before asking questions). It's free/OSS of course.
https://github.com/marksfink/cfenc
If you have interest, feedback, questions, feel free to ask!
Jamaika
5th April 2020, 14:22
It is difficult to say whether there will be interest in the topic.
Coronavirus free volunteering cut out.
From what was written on the forum: Cineform is old codec, no longer updated, based on old jpeg2000 and dpx. We already have HTjpeg2000. Will Cineform be competitive with JPEG XS?
F1nkster
5th April 2020, 14:55
There will always be new, better codecs coming along so it is not so much about debating the technical merits of each. It's more about workflows and how well codecs fit into them. And many people use Cineform from what I gather on forums even if it's not the newest, sexiest thing.
In any case, I expect the interest level to be modest certainly but not non-existent. We'll see. In any case, I used some of my Covid-19 stay-at-home time to write it and it's useful to me! I can now remove wine from my system.
filler56789
5th April 2020, 15:15
command line Cineform encoder
:goodpost:
Hope the MABS team will add support for it Very-Soon™.
Jamaika
6th April 2020, 08:49
For geeks under windows cfenc. :) UNTESTED
https://www.sendspace.com/file/qv6rj4
foxyshadis
6th April 2020, 10:15
It's always surprising how little effort it would actually take a company to support Linux, if they just cared. Thanks! I imagine it wouldn't take much more to support something like GStreamer, either.
F1nkster
7th April 2020, 01:27
I agree. If an amateur weekend programmer like myself can write it, a pro could do it in their sleep!
Now, I am loathe to get into a "this codec is better than that codec" discussion, but Jamaika got me looking at JPEG XS. It sounds really cool, however...I don't see any publicly available implementation or SDK for it. Looks like it has to be licensed, which is perfectly fair and reasonable. Unfortunately that does me no good. I work on GoPro footage (which got me into Cineform to begin with) and now I use Cineform for everything else. But it's all personal stuff. And I like Cineform over DNXHD and Prores because I get significantly smaller file sizes at similar quality settings. That's the long and short of it for me.
filler56789
7th April 2020, 05:44
For geeks under windows cfenc. :) UNTESTED
https://www.sendspace.com/file/qv6rj4
1) :thanks: for the binary.
2) OK, the source-code could be compiled, but in the real world of Windows it doesn't work :–/
=> cfenc -i input.avi C:\DISCIMGS\cftest001.avi
cfenc version 0.0 -- Cineform encoder/transcoder
libavformat 58. 42.100
libavcodec 58. 77.101
libavutil 56. 42.102
libswscale 5. 6.101
libCFHDCodec 10. 0. 2
Failed to open 'input.avi':
Protocol not found
FWIW: "input.avi" is a 1-minute Xvid clip @ 640x480 @ 29.97 fps.
Jamaika
7th April 2020, 06:21
Now, I am loathe to get into a "this codec is better than that codec" discussion, but Jamaika got me looking at JPEG XS. It sounds really cool, however...I don't see any publicly available implementation or SDK for it. Looks like it has to be licensed, which is perfectly fair and reasonable. Unfortunately that does me no good. I work on GoPro footage (which got me into Cineform to begin with) and now I use Cineform for everything else. But it's all personal stuff. And I like Cineform over DNXHD and Prores because I get significantly smaller file sizes at similar quality settings. That's the long and short of it for me.
For me, cineform is better than mjpeg2000. Plays movies much smoother. However, as cineform was robbed and had cracks, so it was abandoned technologically and has been added as free on github.
It annoys me that there is no HDR BT2020 option although the codec is for 10 / 12bit movies. I don't know how 4K support, in older versions of Sony Vegas did not want to work. Let's say good quality, if you choose high is average.
PS JPEG XS was about to appear this Christmas.
2) OK, the source-code could be compiled, but in the real world of Windows it doesn't work :–/
I'm sorry as amateur:
After four hours, but only where something screwed up?
I don't know. Does cineform work? I never compiled it with GCC
https://github.com/gopro/cineform-sdk/commit/b6c144ef0dd2fa9fa2555d399d093973722c8d4d
Config setting for amateur in libav is torment.
static const AVCodec * const codec_list[] = {
&ff_rawvideo_encoder,
&ff_rawvideo_decoder,
&ff_cinepak_encoder,
&ff_cinepak_decoder,
NULL };
static const AVBitStreamFilter *bitstream_filters[] = {
NULL };
static const AVCodecParser * const parser_list[] = {
NULL };
static const AVInputFormat * const demuxer_list[] = {
&ff_avi_demuxer,
&ff_cine_demuxer,
&ff_mov_demuxer,
&ff_rawvideo_demuxer,
NULL };
static const AVOutputFormat * const muxer_list[] = {
&ff_avi_muxer,
&ff_mov_muxer,
&ff_rawvideo_muxer,
NULL };
static const URLProtocol * const url_protocols[] = {
&ff_md5_protocol,
NULL };
I add libav witf ffmpeg. It annoys me that config and internal.h doesn't attach all options to libav files
#define HAVE_FAST_CLZ 1
#define HAVE_ERF 1
#define HAVE_FCNTL 0
#define HAVE_FAST_UNALIGNED 1
#define HAVE_GMTIME_R 0
#define HAVE_HYPOT 1
#define HAVE_LOCALTIME_R 0
#define HAVE_NANOSLEEP 0
#define HAVE_SYSCTL 0
#define HAVE_PTHREADS 1
#define HAVE_PRAGMA_DEPRECATED 0
#define CONFIG_MOV_MUXER 1
#define CONFIG_RAWVIDEO_MUXER 1
filler56789
7th April 2020, 18:55
cfenc-20200405-0f80fbd-win64 (https://www.mediafire.com/file/dixgf8rdn4cqnny/cfenc-20200405-0f80fbd-win64.7z/file)
This one works! :)
:thanks:
kolak
7th April 2020, 20:54
For me, cineform is better than mjpeg2000. Plays movies much smoother. However, as cineform was robbed and had cracks, so it was abandoned technologically and has been added as free on github.
It annoys me that there is no HDR BT2020 option although the codec is for 10 / 12bit movies. I don't know how 4K support, in older versions of Sony Vegas did not want to work. Let's say good quality, if you choose high is average.
PS JPEG XS was about to appear this Christmas.
Cineform is simple and this is its power. It's many times faster than Jpeg2000, which without good code is still so problematic (and good code costs big money).
Cineform was 10 years ahead its time. There are still so many features around Cineform workflows which are ahead of current time (eg. use of heavy/dynamic metadata :) )
It's more than codec and only fact that David had no support from big company stopped it to be mainstream.
No idea what you mean by 4K? It supports "any" resolution. I tested up to 32K if I remember well. Only annoying bit which should be removed I need of mod 16 (horizontally).
HDR? Nothing more than any other video. 12bit is there so HDR is not a problem for Cineform. You even have a RAW mode.
Jamaika
7th April 2020, 22:07
Thx HolyWu, I failed to compile under gcc.
Library & codec: https://www.sendspace.com/file/3qr77g
Hmm. Perhaps the developers have improved something for 4K. I know one thing, to have 12bit you need to have a professional editor and handling of mov containers. For avi there is only 8bit. The codec is 15 years or more and editors haven't had the pressure to add Cineform to 10 / 12bit movies.
Color space in Sony Vegas for 8bit movies are distorted. So I prefer to use RGB uncompresed than Cineform.
kolak
7th April 2020, 22:44
There is no problem with 10bit if you use low level integration (not crapy VFW or directshow). Stay away form those "technologies" and you are fine.
All what you mentioned has nothing to do with codec itself and its "age".
Other than this- AVI is poor and old container.
LigH
8th April 2020, 07:28
@HolyWu – might be interesting to get it supported in the media-autobuild suite (https://github.com/m-ab-s/media-autobuild_suite/issues/1609), I hope you can give some advices.
F1nkster
26th April 2020, 19:22
I found it was very easy to add, so I created a branch called "alpha" on the Github repo for an update that supports alpha channels.
I will merge it into the master branch once I get confirmation from at least one person that it works correctly. I did some basic testing and believe it is good.
This is in response to an issue opened in the Github repo, so at least one person cares about it! :).
It works very simply: if the input video has an alpha channel then it automatically encodes to RGBA. No command-line option for it. I was surprised to find that the Cineform SDK does not support YUVA, which is why we encode to RGBA and don't bother with a command line option.
Jamaika
27th April 2020, 05:45
Thanks and for that. I won't check because I can't compile properly under Windows. Point for you. :D
urik
28th June 2020, 19:21
Thanks for making this! Dunno about assembling but I used build from this (https://forum.doom9.org/showthread.php?p=1906671#post1906671) reply above.
I've tried using VirtualDub2 for this before (its commandline version, vdub), but the logistics of using that were so much "jumping through hoops", and then with last version it stopped working altogether.
Whereas cfenc is pretty much like FFMpeg, straight to the point. Shame FFmpeg won't implement it.
richardpl
28th June 2020, 20:56
Whereas cfenc is pretty much like FFMpeg, straight to the point. Shame FFmpeg won't implement it.
I heard you donated for cineform encoder in FFmpeg.
F1nkster
4th July 2020, 14:14
@urik, I previously used VirtualDub2 also. Over the past year, I migrated to Linux and so I wanted a Cineform encoder that is compiled for Linux vs running under Wine.
The Windows build is also posted on the Github repo under Releases.
I have since added a branch to the repo called "alpha" that adds alpha channel support. I'm waiting for folks to test it before I merge it to master.
As for ffmpeg, I waited for years for someone to add Cineform encoding to it, but found a post where someone said that they won't do it because Cineform is written for x86 only and ffmpeg supports other architectures, which begs the question why not at least include Cineform encoding for x86 and simply exclude it for others? In any case, rather than argue and probably lose, I wrote cfenc.
richardpl
4th July 2020, 15:16
Instead of writing proper portable solution you just wrote wrapper.
filler56789
4th July 2020, 19:35
Instead of writing proper portable solution you just wrote wrapper.
Better writing an "improper" solution than posting trollish replies...
https://forum.videohelp.com/attachments/43740-1510717165/cineform+ffmpeg.png
F1nkster
18th July 2020, 13:24
Indeed, cfenc is less-than-ideal, but it beats nothing. Anyhow, just posted version 0.2:
Support "-i -" for piped input (previously required "pipe:")
Support BT.2020 coefficients for conversions
Add passthrough for v210 -- this was an oversight on my part, no harm caused previously, just more efficient now
richardpl
18th July 2020, 16:53
Better writing an "improper" solution than posting trollish replies...
Tells one that never contributed patch or anything to project.
poisondeathray
11th August 2020, 16:39
cfhd encoder has made it's way to ffmpeg
ffmpeg -h encoder=cfhd
Encoder cfhd [Cineform HD]:
General capabilities: threads
Threading capabilities: frame
Supported pixel formats: yuv422p10le gbrp12le
richardpl
11th August 2020, 19:04
Encoder cfhd [Cineform HD]:
General capabilities: threads
Threading capabilities: frame
Supported pixel formats: yuv422p10le gbrp12le gbrap12le
cfhd AVOptions:
-quality <int> E..V...... set quality (from 0 to 12) (default film3+)
film3+ 0 E..V......
film3 1 E..V......
film2+ 2 E..V......
film2 3 E..V......
film1.5 4 E..V......
film1+ 5 E..V......
film1 6 E..V......
high+ 7 E..V......
high 8 E..V......
medium+ 9 E..V......
medium 10 E..V......
low+ 11 E..V......
low 12 E..V......
F1nkster
14th August 2020, 02:20
Finally!! I didn't wait quite long enough for it. I had fun writing cfenc anyhow, learned a lot from it.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.