how to specify pixel format of input image pixels

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

how to specify pixel format of input image pixels

Mayur Patel
We have encoded YUV pixels into TIF images.  TIF is one of the few image formats that FFMPEG show support for yuv444p pixels (as identified by ffmpeg -h encoder=tiff)

I am having trouble getting ffmpeg to read the pixels as yuv444p (as opposed to the default rgb24):

Here is a typical command line:

ffmpeg -r 24 -f image2  -c:v tiff -pix_fmt yuv444p -start_number 0101 -y -i "frames.%04d.tif" -r 24 -vframes 130 -threads 6 -c:v dnxhd -timecode 00:00:04:05 -vf format=yuv422p,scale=out_range=tv -b:v 36M /var/tmp/a_dnxhd.mov

In the output, we see that the pixels are not identified as yuv444p:
    Stream #0:0: Video: tiff, rgb24, 1920x1080, 24 fps, 24 tbr, 24 tbn, 24 tbc

Does anyone have a suggestion for how to identify input image pixels as yuv444p?  Even better -- is there any way to get formats like bmp or ppm (which can be streamed) to identify as yuv444p pixels?  Writing intermediate images is a hassle and I would much rather use ffmpeg -f image2pipe which I believe can only be done with these simpler, streamable image formats.

Thanks,
Mayur

_______________________________________________
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: how to specify pixel format of input image pixels

Kieran O Leary
Hi

On Fri, 14 Sep 2018, 16:33 Mayur Patel, <[hidden email]> wrote:

> We have encoded YUV pixels into TIF images.  TIF is one of the few image
> formats that FFMPEG show support for yuv444p pixels (as identified by
> ffmpeg -h encoder=tiff)
>
> I am having trouble getting ffmpeg to read the pixels as yuv444p (as
> opposed to the default rgb24):
>
>
> Here is a typical command line:
>
> ffmpeg -r 24 -f image2  -c:v tiff -pix_fmt yuv444p -start_number 0101 -y
> -i "frames.%04d.tif" -r 24 -vframes 130 -threads 6 -c:v dnxhd -timecode
> 00:00:04:05 -vf format=yuv422p,scale=out_range=tv -b:v 36M
> /var/tmp/a_dnxhd.mov
>

Can you send the full, uncut terminal output? Are you sure that your input
TIFF files are actually YUV and not RGB? Also perhaps share one of the tiff
files? I  tried with an oldish version of ffmpeg which had no issue
identifying yuv444p TIFF:

$ ffmpeg -i  1fr.tif
ffmpeg version 3.4.4-0ubuntu0.18.04.1 Copyright (c) 2000-2018 the FFmpeg
developers
  built with gcc 7 (Ubuntu 7.3.0-16ubuntu3)
  configuration: --prefix=/usr --extra-version=0ubuntu0.18.04.1
--toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu
--incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping
--enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa
--enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca
--enable-libcdio --enable-libflite --enable-libfontconfig
--enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm
--enable-libmp3lame --enable-libmysofa --enable-libopenjpeg
--enable-libopenmpt --enable-libopus --enable-libpulse
--enable-librubberband --enable-librsvg --enable-libshine
--enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh
--enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx
--enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2
--enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx
--enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394
--enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r
--enable-libopencv --enable-libx264 --enable-shared
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libavresample   3.  7.  0 /  3.  7.  0
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
Input #0, tiff_pipe, from '1fr.tif':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: tiff, yuv444p, 320x240 [SAR 1:1 DAR 4:3], 25 tbr,
25 tbn, 25 tbc


Best,

Kieran.
_______________________________________________
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: how to specify pixel format of input image pixels

Mayur Patel
Thanks for your reply.

Here is the full output from the ffmpeg invocation:

> m.patel@dk131 ~]$ffmpeg -r 24 -f image2  -c:v tiff -pix_fmt yuv444p -start_number 0101 -y -i "/home/personal_folders/m.patel/share/mastering/fng_test/src/030/010_0030_frames_l_65c0f650a16b11e88c2790b11c92e13d.%04d.exr.tif" -r 24 -vframes 130 -threads 6 -c:v dnxhd -timecode 00:00:04:05 -vf format=yuv422p,scale=out_range=tv -b:v 36M /var/tmp/a_dnxhd.mov
ffmpeg version 4.0.1-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
  configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-6 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg
  libavutil      56. 14.100 / 56. 14.100
  libavcodec     58. 18.100 / 58. 18.100
  libavformat    58. 12.100 / 58. 12.100
  libavdevice    58.  3.100 / 58.  3.100
  libavfilter     7. 16.100 /  7. 16.100
  libswscale      5.  1.100 /  5.  1.100
  libswresample   3.  1.100 /  3.  1.100
  libpostproc    55.  1.100 / 55.  1.100
Input #0, image2, from '/home/personal_folders/m.patel/share/mastering/fng_test/src/030/010_0030_frames_l_65c0f650a16b11e88c2790b11c92e13d.%04d.exr.tif':
  Duration: 00:00:05.42, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: tiff, rgb24, 1920x1080, 24 fps, 24 tbr, 24 tbn, 24 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (tiff (native) -> dnxhd (native))
Press [q] to stop, [?] for help
Output #0, mov, to '/var/tmp/a_dnxhd.mov':
  Metadata:
    timecode        : 00:00:04:05
    encoder         : Lavf58.12.100
    Stream #0:0: Video: dnxhd (DNXHD) (AVdn / 0x6E645641), yuv422p, 1920x1080, q=2-1024, 36000 kb/s, 0.04 fps, 12288 tbn, 24 tbc
    Metadata:
      encoder         : Lavc58.18.100 dnxhd
frame=  130 fps=103 q=1.0 Lsize=   23922kB time=00:00:05.37 bitrate=36458.1kbits/s speed=4.27x    
video:23920kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.006557%


Perhaps there's something that needs to happen in the TIF header?

My TIF header looks like this:
TIFF Directory at offset 0x8 (8)
  Image Width: 1920 Image Length: 1080
  Bits/Sample: 8
  Sample Format: unsigned integer
  Compression Scheme: AdobeDeflate
  Photometric Interpretation: RGB color
  Orientation: row 0 top, col 0 lhs
  Samples/Pixel: 3
  Rows/Strip: 32
  Planar Configuration: single image plane
  Software: OpenImageIO 1.8.5 : oiiotool -q --threads 3 -i /home/personal_folders/m.patel/share/mastering/fng_test/src/030/010_0030_frames_l_65c0f650a16b11e88c2790b11c92e13d.0110.exr --iscolorspace acescg --tocolorspace yuv --fit 1920x1080 --croptofull --dither --scanline -d uint8 -o /home/personal_folders/m.patel/share/mastering/fng_test/src/030/010_0030_frames_l_65c0f650a16b11e88c2790b11c92e13d.0110.exr.tif
  DateTime: 2018:09:14 10:50:25
  RichTIFFIPTC Data: <present>, 420 bytes
  Predictor: horizontal differencing 2 (0x2)


Do I need to figure out how to set my TIF header Photometric Interpretation to 6 (YCrCb)?  Does ffmpeg key from that?

Mayur


________________________________________
From: ffmpeg-user [[hidden email]] on behalf of Kieran O Leary [[hidden email]]
Sent: Friday, September 14, 2018 2:13 PM
To: FFmpeg user questions
Subject: Re: [FFmpeg-user] how to specify pixel format of input image pixels

Hi

On Fri, 14 Sep 2018, 16:33 Mayur Patel, <[hidden email]> wrote:

> We have encoded YUV pixels into TIF images.  TIF is one of the few image
> formats that FFMPEG show support for yuv444p pixels (as identified by
> ffmpeg -h encoder=tiff)
>
> I am having trouble getting ffmpeg to read the pixels as yuv444p (as
> opposed to the default rgb24):
>
>
> Here is a typical command line:
>
> ffmpeg -r 24 -f image2  -c:v tiff -pix_fmt yuv444p -start_number 0101 -y
> -i "frames.%04d.tif" -r 24 -vframes 130 -threads 6 -c:v dnxhd -timecode
> 00:00:04:05 -vf format=yuv422p,scale=out_range=tv -b:v 36M
> /var/tmp/a_dnxhd.mov
>

Can you send the full, uncut terminal output? Are you sure that your input
TIFF files are actually YUV and not RGB? Also perhaps share one of the tiff
files? I  tried with an oldish version of ffmpeg which had no issue
identifying yuv444p TIFF:

$ ffmpeg -i  1fr.tif
ffmpeg version 3.4.4-0ubuntu0.18.04.1 Copyright (c) 2000-2018 the FFmpeg
developers
  built with gcc 7 (Ubuntu 7.3.0-16ubuntu3)
  configuration: --prefix=/usr --extra-version=0ubuntu0.18.04.1
--toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu
--incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping
--enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa
--enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca
--enable-libcdio --enable-libflite --enable-libfontconfig
--enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm
--enable-libmp3lame --enable-libmysofa --enable-libopenjpeg
--enable-libopenmpt --enable-libopus --enable-libpulse
--enable-librubberband --enable-librsvg --enable-libshine
--enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh
--enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx
--enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2
--enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx
--enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394
--enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r
--enable-libopencv --enable-libx264 --enable-shared
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libavresample   3.  7.  0 /  3.  7.  0
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
Input #0, tiff_pipe, from '1fr.tif':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: tiff, yuv444p, 320x240 [SAR 1:1 DAR 4:3], 25 tbr,
25 tbn, 25 tbc


Best,

Kieran.
_______________________________________________
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".
_______________________________________________
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: how to specify pixel format of input image pixels

Carl Eugen Hoyos-2
2018-09-14 21:03 GMT+02:00, Mayur Patel <[hidden email]>:

>   Photometric Interpretation: RGB color

This indicates that your tiff is not yuv, see:
https://www.awaresystems.be/imaging/tiff/tifftags/photometricinterpretation.html

Carl Eugen
_______________________________________________
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: how to specify pixel format of input image pixels

Kieran O Leary
In reply to this post by Mayur Patel
Hi,

On Fri, Sep 14, 2018 at 8:03 PM Mayur Patel <[hidden email]> wrote:
> Perhaps there's something that needs to happen in the TIF header?
>   Photometric Interpretation: RGB color
That would probably be a bad idea, seeing as the issue is most likely
that whatever tool is creating your TIFF file is actually creating RGB
values, not YCbCr values, and this Photometric Interpretation value is
probably correct. The issue is probably at source. Does the image
display correctly when you open it?

> Do I need to figure out how to set my TIF header Photometric Interpretation to 6 (YCrCb)?  Does ffmpeg key from that?

No, ffmpeg does not do that AFAIK and messing with that value won't
fix your issue. Instead of hacking your file to add YCbCr to
Photometric interpretation, you should instead use whatever software
(what software is it and what settings are you using?) is creating the
TIFF to actually create YCbCr files.

I'm attaching two files. One is a yuv444 file made in ffmpeg. Then I
used a hex editor and switched the photometric interpretation value to
2. You can see that the hexedited one will decode incorrectly.

Best,

Kieran O'Leary
IFI Irish Film Archive

_______________________________________________
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".

real_yuv444.tif (311K) Download Attachment
hex_edited_to_be_rgb.tif (311K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: how to specify pixel format of input image pixels

Mayur Patel
In reply to this post by Carl Eugen Hoyos-2
Setting the photometric interpretation to 6 (YCrCb) AND uncompressing the pixels produces a result which is largely green.  I'm assuming at this point that my channels need to be shuffled.

Thanks for the help.
Mayur

________________________________________
From: ffmpeg-user [[hidden email]] on behalf of Carl Eugen Hoyos [[hidden email]]
Sent: Friday, September 14, 2018 3:07 PM
To: FFmpeg user questions
Subject: Re: [FFmpeg-user] how to specify pixel format of input image pixels

2018-09-14 21:03 GMT+02:00, Mayur Patel <[hidden email]>:

>   Photometric Interpretation: RGB color

This indicates that your tiff is not yuv, see:
https://www.awaresystems.be/imaging/tiff/tifftags/photometricinterpretation.html

Carl Eugen
_______________________________________________
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".
_______________________________________________
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: how to specify pixel format of input image pixels

Paul B Mahol
On 9/14/18, Mayur Patel <[hidden email]> wrote:
> Setting the photometric interpretation to 6 (YCrCb) AND uncompressing the
> pixels produces a result which is largely green.  I'm assuming at this point
> that my channels need to be shuffled.

Please provide such files.

>
> Thanks for the help.
> Mayur
>
> ________________________________________
> From: ffmpeg-user [[hidden email]] on behalf of Carl Eugen
> Hoyos [[hidden email]]
> Sent: Friday, September 14, 2018 3:07 PM
> To: FFmpeg user questions
> Subject: Re: [FFmpeg-user] how to specify pixel format of input image pixels
>
> 2018-09-14 21:03 GMT+02:00, Mayur Patel <[hidden email]>:
>
>>   Photometric Interpretation: RGB color
>
> This indicates that your tiff is not yuv, see:
> https://www.awaresystems.be/imaging/tiff/tifftags/photometricinterpretation.html
>
> Carl Eugen
> _______________________________________________
> 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".
> _______________________________________________
> 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".
_______________________________________________
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".