Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage
Register FAQ Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
Old 26th July 2019, 18:49   #1  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,904
Encoding a DCP

Hi,
as a broadcast encoder, I face new challenges everyday.
This time, they asked us to make a DCP out of one of our original production in order to be displayed at cinema.
I gotta be fair, I'm really new to DCP and the Senior Encoder who was working with DCP is now retired, so... I have no clue.
I checked the specifications of the format and it seems that they wanna have a JPEG2000 encoded with the Digital Cinema profile, 4:4:4 12bit progressive at 24fps.

I decided to make a test with one of our commercial/promotion video in order to make sure I was doing the right thing.

First things first. Let's start with Avisynth:

Code:
#Indexing
video=FFVideoSource("HNS.mxf")
ch1=FFAudioSource("HNS.mxf", track=1)
ch2=FFAudioSource("HNS.mxf", track=2)
audio=MergeChannels(ch1, ch2)
AudioDub(video, audio)

#Slow-down from 25p to 24p
AssumeFPS(24, 1, true)
ResampleAudio(48000)

#Bringing everything to 16bit planar
ConvertBits(16)

#From yv16 planar to RGB
ConvertToPlanarRGB()

#From linear BT709 SDR to DCI XYZ
Cube("C:\Programmi\AviSynth+\LUTs\BT709_to_DCI_XYZ.cube", cpu=1, fullrange=false)

Then I encoded it with ffmpeg which basically got each and every frame from Avisynth and encoded each one in a single image (.tiff).
After this, I used OpenDCP to make it encode in JPEG2000 D-Cinema 2K, 250 Mbit/s, 4:4:4 12bit.

Although I've got the file with the right codec and metadata (I think), when I opened with NeoDCP, I wasn't able to play it with the right XYZ->YUV conversion, so I have no idea whether I made my LUT in the right way or not. Don't get me wrong, I think that I did it correctly, but I'm really not sure as I have nothing to check it, so... may I ask you to check it and tell me whether it's correct or not?


Source:




Encode:




A few Screenshots:


Source BT709 yv16 planar 8bit:



Encode DCI XYZ 4:4:4 planar 12bit:



Source BT709 yv16 planar 8bit:



Encode DCI XYZ 4:4:4 planar 12bit:



Source BT709 yv16 planar 8bit:



Encode DCI XYZ 4:4:4 planar 12bit:



Source BT709 yv16 planar 8bit:



Encode DCI XYZ 4:4:4 planar 12bit:



Source BT709 yv16 planar 8bit:



Encode DCI XYZ 4:4:4 planar 12bit:





Here you'll find the download link:

DCP Attempt 1 + Source: Link
Experimental matrices of linear transformation (LUTs): Link

(Inside you'll find a .zip with the DCP created with Avisynth, ffmpeg and OpenDCP and the original source file in BT709 yv16 8bit planar).
(Note: please note that the source file is 25fps progressive flagged as interlaced)

Please let me know whether I did something terribly wrong or not.

Thank you in advance,
Frank

Last edited by FranceBB; 26th July 2019 at 19:02.
FranceBB is offline   Reply With Quote
Old 27th July 2019, 12:45   #2  |  Link
real.finder
Registered User
 
Join Date: Jan 2012
Location: Mesopotamia
Posts: 2,587
with this
Code:
ffms2("HNS.video.mxf",colorspace="RGBP16") #don't know why it not output RGBP in first place! since XYZ more close to RGB than YUV! and why not accept RGBP12!
ConvertToRGB64.ConvertXYZtorgb #another don't know why not accept RGBP! or even RGB48!
the color kinda back to normal but the brightness and the contrast changed!
__________________
See My Avisynth Stuff

Last edited by real.finder; 27th July 2019 at 12:51.
real.finder is offline   Reply With Quote
Old 27th July 2019, 13:35   #3  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,904
I see...
So I must have done something wrong when I was creating the LUT as the contrast changed when bringing it back to YUV.
Rather than making a brand new LUT, I'm gonna try to encode like this:

Code:
FFVideoSource("C:\Users\bucciantinif\Desktop\DCP_attempt1\Source.mxf")

ConvertToRGB32()

ConvertRGBtoXYZ()
so that ffmpeg will extract the .tiff and OpenDCP will encode to JPEG2000. I'll let you know about my second attempt soon.
FranceBB is offline   Reply With Quote
Old 27th July 2019, 13:39   #4  |  Link
real.finder
Registered User
 
Join Date: Jan 2012
Location: Mesopotamia
Posts: 2,587
Quote:
Originally Posted by FranceBB View Post
I see...
So I must have done something wrong when I was creating the LUT as the contrast changed when bringing it back to YUV.
Rather than making a brand new LUT, I'm gonna try to encode like this:

Code:
FFVideoSource("C:\Users\bucciantinif\Desktop\DCP_attempt1\Source.mxf")

ConvertToRGB32()

ConvertRGBtoXYZ()
so that ffmpeg will extract the .tiff and OpenDCP will encode to JPEG2000. I'll let you know about my second attempt soon.
since avs+ don't support XYZ and deal with it as RGB, I think you need to tell ffmpeg that the output of avs+ is XYZ not RGB, don't know how that can be done though
__________________
See My Avisynth Stuff
real.finder is offline   Reply With Quote
Old 27th July 2019, 14:10   #5  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,904
It's not such a big deal as it doesn't really matter whether it flags .tiff as RGB or XYZ as long as it doesn't make any conversion (so it doesn't screw up anything), 'cause OpenDCP is "dumb" and will ignore any metadata and take as granted that .tiff are in XYZ.
I'll let you know, though.
FranceBB is offline   Reply With Quote
Old 28th July 2019, 07:58   #6  |  Link
Jamaika
Registered User
 
Join Date: Jul 2015
Posts: 706
I found the libraw program.
The problem is that if you don't have Adobe, you will not resize, change bitdepth or hard to keep colorspace XYZ by converting it to j2K.

dcraw_emu.exe -v -F -o 5 -mem -6 -T RAW_CANON_EOS_5DS.cr2
Code:
Camera2RGB matrix:
1.9176  -1.0691 0.1516
-0.1750 1.6879  -0.5129
0.0375  -0.5628 1.5254

XYZ->CamRGB matrix:
0.6250  -0.0711 -0.0808
-0.5153 1.2794  0.2636
-0.1249 0.2198  0.5610

Derived D65 multipliers: 2.299029 0.928817 1.404652
Writing file RAW_CANON_EOS_5DS.cr2.tiff
convert.exe RAW_CANON_EOS_5DS.cr2 -verbose -alpha off -color-matrix "1.9176 -1.0691 0.1516 -0.1750 1.6879 -0.5129 0.0375 -0.5628 1.5254" -set color-matrix "0.6250 -0.0711 -0.0808 -0.5153 1.2794 0.2636 -0.1249 0.2198 0.5610" -gamma 2.2 -evaluate pow 4.5 -depth 12 -resize 2048x1080! dci-xyz.tiff

Don't conversion RGB->YCC (no Multiple Component Transform)
copenjpeg2000.exe -i dci-xyz.tiff -o XYZ(444).j2k -F 2048,1080,3,12,u@1x1:1x1:1x1 -mct 0 -cinema2K 24 -r 6 -C ""

Last edited by Jamaika; 28th July 2019 at 10:59.
Jamaika is offline   Reply With Quote
Old 28th July 2019, 16:06   #7  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,904
Alright, I tried to convert using Avisynth from YUV to XYZ, but the resulting DCP encoded in JPEG2000 is wrong.

If I try to convert it back with Avisynth, I get the wrong colors: Img1 - Img2
This basically means that although Avisynth did it correctly, either ffmpeg or OpenDCP screwed up the levels.
I bet it's ffmpeg 'cause it's interpreting the Avisynth XYZ output as RGB and it's encoding it in the wrong way.

DCP Attempt 2: Link

By the way, I'm also trying to make a brand new LUT just because I don't know how to tell ffmpeg what Avisynth is frameserving to ffmpeg, so perhaps with a LUT I can let ffmpeg apply it and flag it correctly, I think.

This is my brand new LUT (I still have to encode with this new one): Link

Last edited by FranceBB; 28th July 2019 at 16:28.
FranceBB is offline   Reply With Quote
Old 28th July 2019, 19:55   #8  |  Link
Jamaika
Registered User
 
Join Date: Jul 2015
Posts: 706
ffmpeg.exe -y -i "Source.mxf" -ss 7.500 -an -f image2 -frames 1 -vf scale=2048:1080:in_color_matrix=bt709:in_range=limited,format=bgr48,lutyuv=clipval:clipval:clipval -strict -1 111.tiff

convert.exe 111.tiff -verbose -alpha off -depth 16 -gamma 2.2 -color-matrix "1.9176 -1.0691 0.1516 -0.1750 1.6879 -0.5129 0.0375 -0.5628 1.5254" -colorspace XYZ -set colorspace XYZ dci-xyz.tiff

copenjpeg2000.exe -i dci-xyz.tiff -o XYZ(444).j2k -F 2048,1080,3,12,u@1x1:1x1:1x1 -mct 0 -cinema2K 24 -r 6 -C "Jamaika"

ffplay.exe XYZ(444).j2k
Stream #0:0: Video: jpeg2000 (JPEG 2000 digital cinema 2K), xyz12le, 2048x1080, 25 tbr, 25 tbn, 25 tbc


Last edited by Jamaika; 29th July 2019 at 04:16.
Jamaika is offline   Reply With Quote
Old 28th July 2019, 21:27   #9  |  Link
SeeMoreDigital
Life's clearer in 4K UHD
 
SeeMoreDigital's Avatar
 
Join Date: Jun 2003
Location: Notts, UK
Posts: 12,227
Quote:
Originally Posted by FranceBB View Post
Hi,
as a broadcast encoder, I face new challenges everyday.
This time, they asked us to make a DCP out of one of our original production in order to be displayed at cinema.
I gotta be fair, I'm really new to DCP and the Senior Encoder who was working with DCP is now retired, so... I have no clue.
I checked the specifications of the format and it seems that they wanna have a JPEG2000 encoded with the Digital Cinema profile, 4:4:4 12bit progressive at 24fps.
I wonder if VirtualDub2 can be configured to generate a DCP JPEG2000 image sequence...
__________________
| I've been testing hardware media playback devices and software A/V encoders and decoders since 2001 | My Network Layout & A/V Gear |
SeeMoreDigital is offline   Reply With Quote
Old 31st July 2019, 18:14   #10  |  Link
Emulgator
Big Bit Savings Now !
 
Emulgator's Avatar
 
Join Date: Feb 2007
Location: close to the wall
Posts: 1,545
Hi FranceBB,
Here I throw 16bit TIFFs at OpenDCP.
RGB to XYZ done, JPEG2000 Encoding done, muxing done, folder and aux file generation done.
The resulting DCPs have been tested on Doremi under HFS+, NTFS, and Ext2.
Projected ok in Berlin Cinemas and around.
It just works beautifully, thanks Terrence Meiczinger !!!
__________________
"To bypass shortcuts and find suffering...is called QUALity" (Die toten Augen von Friedrichshain)
"Data reduction ? Yep, Sir. We're that issue working on. Synce invntoin uf lingöage..."

Last edited by Emulgator; 31st July 2019 at 18:21.
Emulgator is offline   Reply With Quote
Old 1st August 2019, 10:38   #11  |  Link
kolak
Registered User
 
Join Date: Nov 2004
Location: Poland
Posts: 2,843
And if it was 2K you could just use free Resolve and have rather hassle free workflow
kolak is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:39.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.