[CinCV TNG] Fwd: Re: OpenJPEG files inside CinGG outdated?

Andrew Randrianasulu randrianasulu at gmail.com
Mon May 7 13:43:55 CEST 2018

Ok, actual ffmpeg (2.8.x) commandline for producting working with correct 
colors .mxf was:

ffmpeg  -v debug -r 24 -i /dev/shm/rgb.mov  -r 24 -an -profile:v 3 -cinema_mode 
1  -format 0 -numresolution 6  -compression_level 30 -prog_order 4  -pix_fmt 
xyz12 -c:v libopenjpeg  -threads 4 /dev/shm/dci.mxf  

note pix_fmt xyz12 !

rgb.mov is test rawvideo mov done by ffmpeg, too (I used this step because I was 
unsure where exactly was my problem, at that stage of recompression)

ffmpeg -i ~/botva/vid/MMC_14_may_2011_four_pilot_whales.mp4 -an -pix_fmt 
rgb24 -c:v rawvideo /dev/shm/rgb.mov

input file was at 29.97 fps, so I missed framerate conversion step, but it seems 
modern ffmpeg if fed with correct options can produce those strange 'digital 
cinema' files, and Cinelerra-GG can open them and seek inside (playback still 
damn too slow on my machine even for just 2k!)

My hacks for integration openjpeg 2.3.0 were:

cat openjpeg-23.patch
--- configure._orig.ac  2018-05-06 21:19:13.179206006 +0300
+++ configure.ac        2018-05-06 21:30:08.243214018 +0300
@@ -233,7 +233,7 @@
   [ include ])

-  [openjpeg-2.1.0-20160221],
+  [openjpeg-2.3.0],
   [ bin/libopenjp2.a ],
   [ src/lib/openjp2 ])

and inside slackbuild:

cd thirdparty
# tmp openjpeg 2.3 hack!
rm src/openjpeg-2.1.0-20160221.tar.xz
cp $CWD/openjpeg-2.3.0.tar.gz src/

Both files also attached

also, I think opencv can be configured without any 'external' image decoding 
support, because inside Cinelerra-GG it always fed with already decoded data? 
(currently opencv build fails due to outdated libtiff {3.9.7} on my system.)

----------  Пересланное сообщение  ----------

Тема: Re: [CinCV TNG] OpenJPEG files inside CinGG outdated?
Дата: Понедельник 07 мая 2018
Отправитель: Andrew Randrianasulu <randrianasulu at gmail.com>
Получатель:  cinelerra at lists.cinelerra-cv.org

В сообщении от Sunday 06 May 2018 22:15:10 Phyllis Smith написал(а):
> We appreciate the update on libraries because there are a lot of them used
> in cinelerra and hard to keep track.
> On Sun, May 6, 2018 at 11:53 AM, Andrew Randrianasulu <
> randrianasulu at gmail.com> wrote:
> > Hello, all!
> >
> > I was looking into all those new/old codec news, and found OpenJPEG has
> > some
> > speed work last year:
> > http://www.openjpeg.org/2017/10/04/OpenJPEG-2.3.0-released
> > ...
> > so, because I rely on Cinelerra-provided new libraries (system partially
> > outdated), may be files used by Cin-GG can be updated? Right now they at
> > openjpeg-2.1.0-20160221 . I will try to do some tests locally.
> GG will look into updating JPEG soon if no problems - faster jpeg would be
> a nice improvement.  If you do find any problems while testing, please let
> us know.  Hopefully there should be none since it has been out for awhile
> now.

So, after minor hacking in configure.ac and buildscript (I simply downloaded 
openjpeg-2.3.0 release and replaced deleted original xz with tar.gz version) 
Cinelerra-GG was built, and appear to work, but speed on jpeg2000 mxf file 
still way too slow for realtime, but at least picture is decoded correctly (? 
as far as I can see) and you can single-step in file!

File to test:
(download zip, unzip it, open tos_dcp_test_04/tos_video.mxf )

I was unable to find smaller (2k) free sample for those mxf-wrapped jpeg2k 
sequences, but ordinary j2k files appear to work fine.

for example this file - 

Additional link about openjpeg in mxf:

FFmpeg for DCI encoding 
 From version 1.2 onward, FFmpeg can encode DCI-compliant jpeg-2000, that DCP 
servers can read, and take advantage of the versatility of FFmpeg for videos
 Sample Usage 
/usr/local/bin/ffmpeg  -v debug -r 25 -i 
~/Downloads/decomptes-leader_charbon_HD_25i_bip_a_50.mov  -r 25 -an -profile:v 
3 \
          -cinema_mode 1  -format 0 -numresolution 6  -compression_level 
30 -prog_order 4 -pix_fmt gbrp12 \
          -threads 12 -vf rgb2xyz /stuff/j2c/%06d.j2c

"-v debug" : more verbosity
"-r 25" : assume 25 fps on input
" -i ~/Downloads/decomptes-leader_charbon_HD_25i_bip_a_50.mov" : input video 
"-r 25" : output fps 
"-an" : no audio
"-profile:v 3" : utilise profile number 3 from libopenjpeg library : that 
is "cinema2k" (use "4" for "cinema4k")
"-cinema_mode 1" : turn DCI mode on
"-format 0" : output .j2c, not .jp2
"-numresolution 6" : allow 6 different resolutions for decoding
"-compression_level 30" ; this is not the bandwidth ; one could use less 
compression, but it's better to have margin in order to stay under 250 MBits/s
"-prog_order 4" : necessary for DCI
"-pix_fmt gbrp12" : output should have 12 bit per channel
"-threads 12" : encode 12 images at a time
"-vf rgb2xyz" : convert colors from RGB HD to DCI XYZ using the filter rgb2xyz
"/stuff/j2c/%06d.j2c" : save jpeg-2000 in the folder /stuff/j2c/, using a 
6-number naming scheme
EDIT : rgb2xyz filter is now obsolete, as FFmpeg has xyz built-in

--------end quote-----

(it still outputs individual images, you need to wrap them with another tool )

DCI is apparently standard for digital cinema, I never ever saw any such file in 
my life before!

> > Also, some urls in thirdparty/downloads.txt are outdated?
> This file is just a note file used by the developer and hopefully future
> programmers! to be able to more easily find a required library.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: cinelerra-goodguy.SlackBuild
Type: application/x-shellscript
Size: 4668 bytes
Desc: not available
URL: <http://lists.cinelerra-cv.org/pipermail/cinelerra/attachments/20180507/a614bc07/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: openjpeg-23.patch
Type: text/x-diff
Size: 280 bytes
Desc: not available
URL: <http://lists.cinelerra-cv.org/pipermail/cinelerra/attachments/20180507/a614bc07/attachment.patch>

More information about the Cinelerra mailing list