Opened 4 years ago

Last modified 4 years ago

#1933 new defect

ffmpeg prores artifacts

Reported by: rivierakid Owned by:
Priority: normal Component: undetermined
Version: git-master Keywords: prores
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

The ProRes? codecs are not working correctly with the image in attachment. The output quicktime has some artifacts in the gray square (see attachment zoomed part of image - out.tif)

ffmpeg -i test.tif -vcodec prores -profile 1 output.mov

ffmpeg 2012-11-05 (git-c995644-win64)
built on win64, but also on OS X 10.6

Attachments (2)

out.tif (795.1 KB) - added by rivierakid 4 years ago.
test.jpg (377.6 KB) - added by rivierakid 4 years ago.

Download all attachments as: .zip

Change History (37)

Changed 4 years ago by rivierakid

Changed 4 years ago by rivierakid

comment:1 Changed 4 years ago by rivierakid

I can't attach test.tif, because it is too big. But same problem with attached test.jpg...

comment:2 Changed 4 years ago by cehoyos

  • Keywords quicktime removed

Please add your command line together with complete, uncut console output.

comment:3 Changed 4 years ago by cehoyos

And please upload an input file, see http://ffmpeg.org/bugreports.html or upload to http://www.datafilehost.com/

comment:4 Changed 4 years ago by rivierakid

Ok, original file input uploaded: http://www.datafilehost.com/download-5f72f895.html
Console:

ffmpeg -i test.tif -vcodec prores -profile 1 output.mov
ffmpeg version N-46469-gc995644 Copyright (c) 2000-2012 the FFmpeg developers
  built on Nov  5 2012 18:00:04 with gcc 4.7.2 (GCC)
  configuration: --disable-static --enable-shared --enable-gpl --enable-version3 --disable-pthreads --enable-runtime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-
libfreetype --enable-libgsm --enable-libmp3lame --enable-libnut --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libutvideo --enable-libvo-aacenc --enable-libvo-amrwbenc --enable
-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
  libavutil      52.  5.100 / 52.  5.100
  libavcodec     54. 71.100 / 54. 71.100
  libavformat    54. 36.100 / 54. 36.100
  libavdevice    54.  3.100 / 54.  3.100
  libavfilter     3. 21.106 /  3. 21.106
  libswscale      2.  1.102 /  2.  1.102
  libswresample   0. 16.100 /  0. 16.100
  libpostproc    52.  1.100 / 52.  1.100
Input #0, image2, from 'test.tif':
  Duration: 00:00:00.04, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: tiff, rgb24, 2048x1556, 25 tbr, 25 tbn, 25 tbc
Please use -profile:a or -profile:v, -profile is ambiguous
Output #0, mov, to 'output.mov':
  Metadata:
    encoder         : Lavf54.36.100
    Stream #0:0: Video: prores (apcs) (apcs / 0x73637061), yuv422p10le, 2048x1556, q=2-31, 200 kb/s, 12800 tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (tiff -> prores)
Press [q] to stop, [?] for help
frame=    1 fps=0.0 q=0.0 Lsize=     583kB time=00:00:00.04 bitrate=119348.6kbits/s
video:582kB audio:0kB subtitle:0 global headers:0kB muxing overhead 0.120129%
Last edited 4 years ago by cehoyos (previous) (diff)

comment:5 Changed 4 years ago by cehoyos

Is the problem also reproducible for you with the following command line?
$ ffmpeg -i test.tif -vcodec prores_kostya out.mov
(There is an implicit lossy colourspace conversion - -pix_fmt yuv422p10 - involved in your original command line, I am not sure if you are aware of this.)

Alternatively, you could test the following command line to check my theory:
$ ffmpeg -i test.tif -pix_fmt yuv422p -qscale 2 out.jpg

comment:6 Changed 4 years ago by rivierakid

$ ffmpeg -i test.tif -vcodec prores_kostya out.mov
Same artifacts as in "prores"

$ ffmpeg -i test.tif -pix_fmt yuv422p -qscale 2 out.jpg
out.jpg is OK...

comment:7 Changed 4 years ago by rivierakid

$ ffmpeg -i test.tif -vcodec prores_kostya -qscale 15 out.mov
No artifacts in gray square but it is low quality (too much pixelized)
With "prores" there are still artifacts in the square...

comment:8 Changed 4 years ago by rivierakid

I have created 16-bit TIF from 8-bit and it works, no artifacts!!!
test16.tif http://www.datafilehost.com/download-eae732ef.html

So I think that the conversion from 8-bit RGB to k422YpCbCr10CodecType is buggy. Your theory is probably right except that JPEG can't have the Apple YUV 10 bit space, yuv422p != yuv422p10. So JPEG encoding test is usefull...

Last edited 4 years ago by rivierakid (previous) (diff)

comment:9 Changed 4 years ago by rivierakid

Oh no, the result is still not correct! The gray square is now OK, but there are new artifacts in the brown square :)

Last edited 4 years ago by rivierakid (previous) (diff)

comment:10 Changed 4 years ago by rivierakid

Definitely it is not a problem with color space conversion. I have converted the image into YCbCr space in my c++ program, but output image still has artifacts...

comment:11 Changed 4 years ago by richardpl

It would be best if you try with v210 input. (which is packed 10bit yuv422)

Last edited 4 years ago by richardpl (previous) (diff)

comment:12 Changed 4 years ago by rivierakid

Thanks, I made several attemps:
AV_PIX_FMT_YUV422P - no artifacts
AV_PIX_FMT_YUV444P - no artifacts
AV_PIX_FMT_RGB24 - artifacts
AV_PIX_FMT_YUV422P10LE - artifacts, IMHO this format would be ProRes? native, I was playing only with luma component.

So I've changed my opinion, the problem could be in built-in color space conversion :o)

BTW ProResLT has lower quality then the original Apple ProResLT, is it possible to set bitrate? It seems that it completely ignores -b parameter...

comment:13 Changed 4 years ago by richardpl

I'm confused by your reply, v210 files have tag v210 and are in mov container

FFmpeg use internal YUV422P10 pix format to decode such files.

Please give ffmpeg output with v210 as input codec.

comment:14 follow-ups: Changed 4 years ago by rivierakid

pixfmt.h:
#define AV_PIX_FMT_YUV422P10 AV_PIX_FMT_NE(YUV422P10BE, YUV422P10LE)

YUV422P10 = AV_PIX_FMT_YUV422P10LE on Win32

I see artifacts in the output video when using YUV422P10 directly in my program...
BTW is it possible to store video in YUV422P10 without Apple ProRes?? I've tried h.264, but it only auto-selects yuv422p

Last edited 4 years ago by rivierakid (previous) (diff)

comment:15 in reply to: ↑ 14 Changed 4 years ago by cehoyos

Replying to rivierakid:

BTW is it possible to store video in YUV422P10 without Apple ProRes??

-vcodec v210

comment:16 in reply to: ↑ 14 Changed 4 years ago by cehoyos

Replying to rivierakid:

BTW is it possible to store video in YUV422P10 without Apple ProRes?? I've tried h.264, but it only auto-selects yuv422p

That is because you have not compiled your local copy of x264 with 10-bit encoding support. dnxhd, ffv1 and libopenjpeg also support yuv422p10, but they are either not lossless or less common.

Last edited 4 years ago by cehoyos (previous) (diff)

comment:17 Changed 4 years ago by rivierakid

Testing with test.tif http://www.datafilehost.com/download-5f72f895.html
-vcodec 210 no artifacts
-vcodec prores artifacts in gray square

I wonder about bitrate settings, for prores_kostya there is a global_quality parameter (prores_kostya.c), which controls the bitrate (there is a four items-bitrates tab for every profile). But I don't know how to control quality in "prores"? Is it equal to "prores_anatolyi"? Because I can't find a source code for it and seems that "prores_anatolyi" auto-selects the quality...

comment:18 Changed 4 years ago by richardpl

I'm not interested in encoding to v210 codec, you did not give command output.
I'm interested in encoding from v210 to prores.

comment:19 Changed 4 years ago by rivierakid

ffmpeg -i test.tif -vcodec v210 v210.mov
Output: http://www.datafilehost.com/download-5832388c.html

ffmpeg -i v210.mov -vcodec prores -profile 1 out.mov

out.mov: there is a pixel pattern in "one color" gray square.
v210.mov is OK

comment:20 Changed 4 years ago by richardpl

so both prores encoders are bad?

comment:21 Changed 4 years ago by rivierakid

Yes for v210 same buggy behaviour, but now I prefer prores_kostya because it has more settings (quality-bitrate).

Hmm, converting first into yuv444p and then to prores_kostya is OK...

ffmpeg -i test.tif -vcodec h264 -pix_fmt yuv444p 444.mov
ffmpeg -i 444.mov -vcodec prores_kostya -profile 1 out.mov

It's really strange :o)

comment:22 Changed 4 years ago by richardpl

So lt profile is broken only for 422?

comment:23 follow-up: Changed 4 years ago by rivierakid

Not only LT, HQ and probably other profiles are broken too.
Not sure if it's broken only for 422.
444 seems to work great, but tested only for single image...

Last edited 4 years ago by rivierakid (previous) (diff)

comment:24 in reply to: ↑ 23 Changed 4 years ago by cehoyos

Replying to rivierakid:

444 seems to work great, but tested only for single image...

You originally wrote 'Same artifacts as in "prores"' ...
Since I see several statements that possibly contradict each-other, please try to clarify which command lines allow you to reproduce the problem and which work fine.
If possible, do not try to involve x264, it is a lossy codec and may affect your test results.

comment:25 follow-up: Changed 4 years ago by rivierakid

That was not for 444 format, but I've made many tests and you're right that it's little bit unclear :)

Reproducing problem:
test.tif http://www.datafilehost.com/download-5f72f895.html

ffmpeg -i test.tif -vcodec prores_kostya -profile 1 out.mov

  • result is bad (artifacts)

ffmpeg -i test.tif -vcodec v308 -pix_fmt yuv444p test.mov
ffmpeg -i test.mov -vcodec prores_kostya -profile 1 out1.mov

  • result is OK

Instead of x264 I'm using v308 = uncompressed 4:4:4

Last edited 4 years ago by rivierakid (previous) (diff)

comment:26 in reply to: ↑ 25 ; follow-up: Changed 4 years ago by nichot20

Replying to rivierakid:

That was not for 444 format, but I've made many test and you're right that it's little bit unclear :)

Reproducing problem:
test.tif http://www.datafilehost.com/download-5f72f895.html

ffmpeg -i test.tif -vcodec prores_kostya -profile 1 out.mov

  • result is bad (artifacts)

Where are these artefacts? Not immediately obvious to me when I ran the test.

With -v debug I notice several "Unknown or unsupported tag..." messages for the tif... might they be significant?

ffmpeg -i test.tif -vcodec v308 -pix_fmt yuv444p test.mov
ffmpeg -i test.mov -vcodec prores_kostya -profile 1 out1.mov

  • result is OK

Instead of x264 I'm using v308 = uncompressed 4:4:4

comment:27 Changed 4 years ago by cehoyos

Thank your for clarification!

Could you test the following commands?
$ ffmpeg -i test.tif -vcodec v210 out.mov

and

$ ffmpeg -i test.tif -vcodec v308 test.mov
$ ffmpeg -i test.mov -vcodec v210 out1.mov

comment:28 in reply to: ↑ 26 ; follow-up: Changed 4 years ago by rivierakid

Replying to nichot20:

Where are these artefacts? Not immediately obvious to me when I ran the test.

See out.tif in attachment, it is zoomed, there are stripes in a gray single color area.

With -v debug I notice several "Unknown or unsupported tag..." messages for the tif... might they be significant?

I'think no, file was created in Foundry Nuke

comment:29 Changed 4 years ago by cehoyos

And one more thing to test would be:
$ ffmpeg -i test.tif -vcodec prores out.mov

(I assume result is bad)

and

$ ffmpeg -i test.tif -vcodec v308 test.mov
$ ffmpeg -i test.mov -vcodec prores out1.mov

comment:30 follow-up: Changed 4 years ago by rivierakid

$ ffmpeg -i test.tif -vcodec v210 out.mov

  • OK

$ ffmpeg -i test.tif -vcodec v308 test.mov
$ ffmpeg -i test.mov -vcodec v210 out1.mov

  • OK

$ ffmpeg -i test.tif -vcodec prores out.mov

  • bad

$ ffmpeg -i test.tif -vcodec v308 test.mov
$ ffmpeg -i test.mov -vcodec prores out1.mov

  • OK

comment:31 in reply to: ↑ 30 Changed 4 years ago by cehoyos

Replying to rivierakid:

$ ffmpeg -i test.tif -vcodec v210 out.mov

  • OK

This indicates that there is no problem with the colourspace conversion from rgb24 to yuv422p10.

$ ffmpeg -i test.tif -vcodec prores out.mov

  • bad

$ ffmpeg -i test.tif -vcodec v308 test.mov
$ ffmpeg -i test.mov -vcodec prores out1.mov

  • OK

This indicates that there is no problem with the prores encoder, only with the (direct) colourspace conversion from rgb24 to yuv422p10.

But I probably miss something...

comment:32 in reply to: ↑ 28 Changed 4 years ago by nichot20

Replying to rivierakid:

Replying to nichot20:

Where are these artefacts? Not immediately obvious to me when I ran the test.

See out.tif in attachment, it is zoomed, there are stripes in a gray single color area.

I see it on yours, but not on mine.....

With -v debug I notice several "Unknown or unsupported tag..." messages for the tif... might they be significant?

I'think no, file was created in Foundry Nuke

comment:33 follow-up: Changed 4 years ago by rivierakid

And what version are you using?

I've been using many of pre-compiled versions for Win64 from http://ffmpeg.zeranoe.com/builds/
including the lastest 2012-11-20

Last edited 4 years ago by rivierakid (previous) (diff)

comment:34 in reply to: ↑ 33 Changed 4 years ago by nichot20

Replying to rivierakid:

And what version are you using?

Just tried on current git HEAD, and I cannot see the patterning.

I've been using many of pre-compiled version for Win64 from http://ffmpeg.zeranoe.com/builds/
including the lastest 2012-11-20

comment:35 Changed 4 years ago by rivierakid

Could you add your command line with console output? And please upload your resulting mov-file.
I'll check it :o)

Note: See TracTickets for help on using tickets.