overlaying a clut over a picture

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

overlaying a clut over a picture

Michael Koch
When I create a color-look-up-table with this command line, the result
is a 512x512 clut saved as 16-bit PNG. It works as expected and I
checked that the top left pixel is black (R=0, G=0, B=0) and the bottom
right pixel is white (R=65026, G=65026, B=65026).

c:\ffmpeg\ffmpeg -f lavfi -i haldclutsrc=8 -frames 1 -pix_fmt rgb48be -y
clut.png


In the next example I wanted to extract one frame from a video, overlay
the clut in the top left corner, and save it as 16-bit PNG. I need
16-bit PNG because my video is 10-bit. At first glimpse the result looks
good, but a closer examination finds that the top left pixel is not pure
black, it's R=0, G=1285, B=0, and the bottom right pixel of the clut (at
coordinates 511,511) is not pure white, it's R=65535, G=63736, B=65535.
Why are the colors wrong?

c:\ffmpeg\ffmpeg -ss 5 -i P1000099.mov -f lavfi -i haldclutsrc=8
-filter_complex overlay -frames 1 -pix_fmt rgb48be -y Image_with_CLUT.png

Below is the console output.

Thanks,
Michael



C:\Users\mKoch\Desktop>c:\ffmpeg\ffmpeg -ss 5 -i P1000099.mov -f lavfi
-i haldc
lutsrc=8 -filter_complex overlay -frames 1 -pix_fmt rgb48be -y
Image_with_CLUT.p
ng
ffmpeg version N-92926-g2d580d727c Copyright (c) 2000-2019 the FFmpeg
developers

   built with gcc 8.2.1 (GCC) 20181201
   configuration: --enable-gpl --enable-version3 --enable-sdl2
--enable-fontconfi
g --enable-gnutls --enable-iconv --enable-libass --enable-libbluray
--enable-lib
freetype --enable-libmp3lame --enable-libopencore-amrnb
--enable-libopencore-amr
wb --enable-libopenjpeg --enable-libopus --enable-libshine
--enable-libsnappy --
enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx
--enable-l
ibwavpack --enable-libwebp --enable-libx264 --enable-libx265
--enable-libxml2 --
enable-libzimg --enable-lzma --enable-zlib --enable-gmp
--enable-libvidstab --en
able-libvorbis --enable-libvo-amrwbenc --enable-libmysofa
--enable-libspeex --en
able-libxvid --enable-libaom --enable-libmfx --enable-amf
--enable-ffnvcodec --e
nable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec
--enable-dxva2 --enab
le-avisynth --enable-libopenmpt
   libavutil      56. 25.100 / 56. 25.100
   libavcodec     58. 43.100 / 58. 43.100
   libavformat    58. 25.100 / 58. 25.100
   libavdevice    58.  6.101 / 58.  6.101
   libavfilter     7. 46.101 /  7. 46.101
   libswscale      5.  4.100 /  5.  4.100
   libswresample   3.  4.100 /  3.  4.100
   libpostproc    55.  4.100 / 55.  4.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0000000000404340] decoding for stream 0 failed
Guessed Channel Layout for Input Stream #0.1 : stereo
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'P1000099.mov':
   Metadata:
     major_brand     : qt
     minor_version   : 537986816
     compatible_brands: qt  pana
     creation_time   : 2019-01-03T06:32:13.000000Z
     com.panasonic.Semi-Pro.metadata.xml: <?xml version="1.0"
encoding="UTF-8" st
andalone="no" ?>
                     : <ClipMain
xmlns:xsi="http://www.w3.org/2001/XMLSchema-inst
ance" xmlns="urn:schemas-Professional-Plug-in:Semi-Pro:ClipMetadata:v1.0">
                     :   <ClipContent>
                     :
<GlobalClipID>060A2B340101010501010D2113000000EFE8D053
D0B35534437E1060C1650131</GlobalClipID>
                     : <Duration>1284</Duration>
                     : <EditUnit>1/25</EditUnit>
                     :     <EssenceList>
                     :       <Video>
                     :         <Codec BitRate="150">H264_422_LongGOP</Codec>
                     : <ActiveLine>2496</ActiveLine>
                     : <ActivePixel>3328</ActivePixel>
                     : <BitDepth>10</BitDepth>
                     : <FrameRate>25p</FrameRate>
                     : <TimecodeType>NonDrop</TimecodeType>
                     : <StartTimecode>19:15:30:18</StartTimecode>
                     :       </Video>
                     :       <Audio>
                     : <Channel>2</Channel>
                     : <SamplingRate>48000</SamplingRate>
                     : <BitsPerSample>16</BitsPerSample>
                     :       </Audio>
                     :     </EssenceList>
                     :     <ClipMetadata>
                     :       <Rating>0</Rating>
                     :       <Access>
                     : <CreationDate>2019-01-03T06:32:13+02:00</CreationD
ate>
                     : <LastUpdateDate>2019-01-03T06:32:13+02:00</LastUpd
ateDate>
                     :       </Access>
                     :       <Device>
                     : <Manufacturer>Panasonic</Manufacturer>
                     : <ModelName>DC-GH5S</ModelName>
                     :       </Device>
                     :       <Shoot>
                     : <StartDate>2019-01-03T06:32:13+02:00</StartDate>
                     :       </Shoot>
                     :     </ClipMetadata>
                     :   </ClipContent>
                     :   <UserArea>
                     :     <AcquisitionMetadata
xmlns="urn:schemas-Professional-P
lug-in:P2:CameraMetadata:v1.2">
                     :       <CameraUnitMetadata>
                     :         <Gamma>
                     : <CaptureGamma>V-LogL</CaptureGamma>
                     :         </Gamma>
                     :         <Gamut>
                     : <CaptureGamut>V-Gamut</CaptureGamut>
                     :         </Gamut>
                     :       </CameraUnitMetadata>
                     :     </AcquisitionMetadata>
                     :   </UserArea>
                     : </ClipMain>
                     :
   Duration: 00:00:51.36, start: 0.000000, bitrate: 152983 kb/s
     Stream #0:0(und): Video: h264 (High 4:2:2) (avc1 / 0x31637661),
yuv422p10le(
pc, bt709), 3328x2496 [SAR 1:1 DAR 4:3], 149773 kb/s, 25 fps, 25 tbr,
90k tbn, 5
0 tbc (default)
     Metadata:
       creation_time   : 2019-01-03T06:32:13.000000Z
       timecode        : 19:15:30:18
     Stream #0:1(und): Audio: pcm_s16be (twos / 0x736F7774), 48000 Hz,
stereo, s1
6, 1536 kb/s (default)
     Metadata:
       creation_time   : 2019-01-03T06:32:13.000000Z
       timecode        : 19:15:30:18
     Stream #0:2(und): Data: none (tmcd / 0x64636D74), 0 kb/s (default)
     Metadata:
       creation_time   : 2019-01-03T06:32:13.000000Z
       timecode        : 19:15:30:18
Input #1, lavfi, from 'haldclutsrc=8':
   Duration: N/A, start: 0.000000, bitrate: N/A
     Stream #1:0: Video: rawvideo (RGB[24] / 0x18424752), rgb24, 512x512
[SAR 1:1
  DAR 1:1], 25 tbr, 25 tbn, 25 tbc
Stream mapping:
   Stream #0:0 (h264) -> overlay:main
   Stream #1:0 (rawvideo) -> overlay:overlay
   overlay -> Stream #0:0 (png)
Press [q] to stop, [?] for help
[swscaler @ 000000000d78ee80] No accelerated colorspace conversion found
from yu
va420p to rgb48be.
Output #0, image2, to 'Image_with_CLUT.png':
   Metadata:
     major_brand     : qt
     minor_version   : 537986816
     compatible_brands: qt  pana
     com.panasonic.Semi-Pro.metadata.xml: <?xml version="1.0"
encoding="UTF-8" st
andalone="no" ?>
                     : <ClipMain
xmlns:xsi="http://www.w3.org/2001/XMLSchema-inst
ance" xmlns="urn:schemas-Professional-Plug-in:Semi-Pro:ClipMetadata:v1.0">
                     :   <ClipContent>
                     :
<GlobalClipID>060A2B340101010501010D2113000000EFE8D053
D0B35534437E1060C1650131</GlobalClipID>
                     : <Duration>1284</Duration>
                     : <EditUnit>1/25</EditUnit>
                     :     <EssenceList>
                     :       <Video>
                     :         <Codec BitRate="150">H264_422_LongGOP</Codec>
                     : <ActiveLine>2496</ActiveLine>
                     : <ActivePixel>3328</ActivePixel>
                     : <BitDepth>10</BitDepth>
                     : <FrameRate>25p</FrameRate>
                     : <TimecodeType>NonDrop</TimecodeType>
                     : <StartTimecode>19:15:30:18</StartTimecode>
                     :       </Video>
                     :       <Audio>
                     : <Channel>2</Channel>
                     : <SamplingRate>48000</SamplingRate>
                     : <BitsPerSample>16</BitsPerSample>
                     :       </Audio>
                     :     </EssenceList>
                     :     <ClipMetadata>
                     :       <Rating>0</Rating>
                     :       <Access>
                     : <CreationDate>2019-01-03T06:32:13+02:00</CreationD
ate>
                     : <LastUpdateDate>2019-01-03T06:32:13+02:00</LastUpd
ateDate>
                     :       </Access>
                     :       <Device>
                     : <Manufacturer>Panasonic</Manufacturer>
                     : <ModelName>DC-GH5S</ModelName>
                     :       </Device>
                     :       <Shoot>
                     : <StartDate>2019-01-03T06:32:13+02:00</StartDate>
                     :       </Shoot>
                     :     </ClipMetadata>
                     :   </ClipContent>
                     :   <UserArea>
                     :     <AcquisitionMetadata
xmlns="urn:schemas-Professional-P
lug-in:P2:CameraMetadata:v1.2">
                     :       <CameraUnitMetadata>
                     :         <Gamma>
                     : <CaptureGamma>V-LogL</CaptureGamma>
                     :         </Gamma>
                     :         <Gamut>
                     : <CaptureGamut>V-Gamut</CaptureGamut>
                     :         </Gamut>
                     :       </CameraUnitMetadata>
                     :     </AcquisitionMetadata>
                     :   </UserArea>
                     : </ClipMain>
                     :
     encoder         : Lavf58.25.100
     Stream #0:0: Video: png, rgb48be, 3328x2496 [SAR 1:1 DAR 4:3],
q=2-31, 200 k
b/s, 25 fps, 25 tbn, 25 tbc (default)
     Metadata:
       encoder         : Lavc58.43.100 png
frame=    1 fps=0.1 q=-0.0 Lsize=N/A time=00:00:00.04 bitrate=N/A
speed=0.00517x

video:10533kB audio:0kB subtitle:0kB other streams:0kB global
headers:0kB muxing
  overhead: unknown
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: overlaying a clut over a picture

Michael Koch
Am 14.01.2019 um 07:28 schrieb Michael Koch:

> When I create a color-look-up-table with this command line, the result
> is a 512x512 clut saved as 16-bit PNG. It works as expected and I
> checked that the top left pixel is black (R=0, G=0, B=0) and the
> bottom right pixel is white (R=65026, G=65026, B=65026).
>
> c:\ffmpeg\ffmpeg -f lavfi -i haldclutsrc=8 -frames 1 -pix_fmt rgb48be
> -y clut.png
>
>
> In the next example I wanted to extract one frame from a video,
> overlay the clut in the top left corner, and save it as 16-bit PNG. I
> need 16-bit PNG because my video is 10-bit. At first glimpse the
> result looks good, but a closer examination finds that the top left
> pixel is not pure black, it's R=0, G=1285, B=0, and the bottom right
> pixel of the clut (at coordinates 511,511) is not pure white, it's
> R=65535, G=63736, B=65535. Why are the colors wrong?
>
> c:\ffmpeg\ffmpeg -ss 5 -i P1000099.mov -f lavfi -i haldclutsrc=8
> -filter_complex overlay -frames 1 -pix_fmt rgb48be -y Image_with_CLUT.png

I found a solution myself:  overlay=format=rgb

Michael
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: overlaying a clut over a picture

Michael Koch
Am 14.01.2019 um 08:40 schrieb Michael Koch:

> Am 14.01.2019 um 07:28 schrieb Michael Koch:
>> When I create a color-look-up-table with this command line, the
>> result is a 512x512 clut saved as 16-bit PNG. It works as expected
>> and I checked that the top left pixel is black (R=0, G=0, B=0) and
>> the bottom right pixel is white (R=65026, G=65026, B=65026).
>>
>> c:\ffmpeg\ffmpeg -f lavfi -i haldclutsrc=8 -frames 1 -pix_fmt rgb48be
>> -y clut.png
>>
>>
>> In the next example I wanted to extract one frame from a video,
>> overlay the clut in the top left corner, and save it as 16-bit PNG. I
>> need 16-bit PNG because my video is 10-bit. At first glimpse the
>> result looks good, but a closer examination finds that the top left
>> pixel is not pure black, it's R=0, G=1285, B=0, and the bottom right
>> pixel of the clut (at coordinates 511,511) is not pure white, it's
>> R=65535, G=63736, B=65535. Why are the colors wrong?
>>
>> c:\ffmpeg\ffmpeg -ss 5 -i P1000099.mov -f lavfi -i haldclutsrc=8
>> -filter_complex overlay -frames 1 -pix_fmt rgb48be -y
>> Image_with_CLUT.png
>
> I found a solution myself:  overlay=format=rgb

But the output of the overlay filter seems to be RGB24. Is it possible
to get RGB48 out of the overlay filter? Or is there any other filter for
overlaying two RGB48 images?

Michael
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: overlaying a clut over a picture

Paul B Mahol
On 1/14/19, Michael Koch <[hidden email]> wrote:

> Am 14.01.2019 um 08:40 schrieb Michael Koch:
>> Am 14.01.2019 um 07:28 schrieb Michael Koch:
>>> When I create a color-look-up-table with this command line, the
>>> result is a 512x512 clut saved as 16-bit PNG. It works as expected
>>> and I checked that the top left pixel is black (R=0, G=0, B=0) and
>>> the bottom right pixel is white (R=65026, G=65026, B=65026).
>>>
>>> c:\ffmpeg\ffmpeg -f lavfi -i haldclutsrc=8 -frames 1 -pix_fmt rgb48be
>>> -y clut.png
>>>
>>>
>>> In the next example I wanted to extract one frame from a video,
>>> overlay the clut in the top left corner, and save it as 16-bit PNG. I
>>> need 16-bit PNG because my video is 10-bit. At first glimpse the
>>> result looks good, but a closer examination finds that the top left
>>> pixel is not pure black, it's R=0, G=1285, B=0, and the bottom right
>>> pixel of the clut (at coordinates 511,511) is not pure white, it's
>>> R=65535, G=63736, B=65535. Why are the colors wrong?
>>>
>>> c:\ffmpeg\ffmpeg -ss 5 -i P1000099.mov -f lavfi -i haldclutsrc=8
>>> -filter_complex overlay -frames 1 -pix_fmt rgb48be -y
>>> Image_with_CLUT.png
>>
>> I found a solution myself:  overlay=format=rgb
>
> But the output of the overlay filter seems to be RGB24. Is it possible
> to get RGB48 out of the overlay filter? Or is there any other filter for
> overlaying two RGB48 images?

Try maskedmerge filter with gbrp16 pixel format.
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: overlaying a clut over a picture

Michael Koch
Am 14.01.2019 um 09:48 schrieb Paul B Mahol:

> On 1/14/19, Michael Koch <[hidden email]> wrote:
>> Am 14.01.2019 um 08:40 schrieb Michael Koch:
>>> Am 14.01.2019 um 07:28 schrieb Michael Koch:
>>>> When I create a color-look-up-table with this command line, the
>>>> result is a 512x512 clut saved as 16-bit PNG. It works as expected
>>>> and I checked that the top left pixel is black (R=0, G=0, B=0) and
>>>> the bottom right pixel is white (R=65026, G=65026, B=65026).
>>>>
>>>> c:\ffmpeg\ffmpeg -f lavfi -i haldclutsrc=8 -frames 1 -pix_fmt rgb48be
>>>> -y clut.png
>>>>
>>>>
>>>> In the next example I wanted to extract one frame from a video,
>>>> overlay the clut in the top left corner, and save it as 16-bit PNG. I
>>>> need 16-bit PNG because my video is 10-bit. At first glimpse the
>>>> result looks good, but a closer examination finds that the top left
>>>> pixel is not pure black, it's R=0, G=1285, B=0, and the bottom right
>>>> pixel of the clut (at coordinates 511,511) is not pure white, it's
>>>> R=65535, G=63736, B=65535. Why are the colors wrong?
>>>>
>>>> c:\ffmpeg\ffmpeg -ss 5 -i P1000099.mov -f lavfi -i haldclutsrc=8
>>>> -filter_complex overlay -frames 1 -pix_fmt rgb48be -y
>>>> Image_with_CLUT.png
>>> I found a solution myself:  overlay=format=rgb
>> But the output of the overlay filter seems to be RGB24. Is it possible
>> to get RGB48 out of the overlay filter? Or is there any other filter for
>> overlaying two RGB48 images?
> Try maskedmerge filter with gbrp16 pixel format.

In the meantime a found this solution with the xstack filter:

c:\ffmpeg\ffmpeg -ss 5 -i P1000099.mov -f lavfi -i haldclutsrc=8
-filter_complex
"[1]format=pix_fmts=rgb48be[a];[a][0]xstack=inputs=2:layout=0_0|w0_0"
-frames 1 -y Image_with_CLUT.png

It's not an overlay but a horizontal stack, but that doesn't care. It's
only important that I have the clut and the picture combined in one
16-bit picture, so that they can be processed simultaneously. By the way
xstack is much better than hstack because it accepts pictures of
different height. Problem solved!

Thanks,
Michael

_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".