[FFmpeg-trac] #4523(avcodec:new): JPEG2000 yuv420p file generated by ffmpeg with libopenjpeg codec is broken
FFmpeg
trac at avcodec.org
Tue Apr 28 12:44:47 CEST 2015
#4523: JPEG2000 yuv420p file generated by ffmpeg with libopenjpeg codec is broken
-------------------------------------+-------------------------------------
Reporter: saste | Owner:
Type: defect | Status: new
Priority: important | Component: avcodec
Version: git- | Keywords: libopenjpeg
master | Blocking:
Blocked By: | Analyzed by developer: 0
Reproduced by developer: 1 |
-------------------------------------+-------------------------------------
Summary of the bug:
How to reproduce:
{{{
$ ffmpeg -i fate-samples/lena.pnm -strict -2 -c libopenjpeg -pix_fmt
yuv420p -y lena.yuv420p.j2k
ffmpeg version N-71578-g57865a9 Copyright (c) 2000-2015 the FFmpeg
developers
built with gcc 4.8 (Ubuntu/Linaro 4.8.1-10ubuntu9)
configuration: --extra-cflags=-I/home/stefano/include --extra-
ldflags=-L/home/stefano/lib --enable-libopenjpeg --enable-pic --enable-
fontconfig --enable-libass --enable-version3 --prefix=/home/stefano
--disable-shared --enable-static --enable-debug=3 --enable-pthreads
--disable-optimizations --enable-libvorbis --enable-gpl --enable-nonfree
--enable-libmp3lame --enable-libtheora --enable-gpl --enable-x11grab
--enable-frei0r --enable-libfaac --enable-libcaca --enable-libflite
--enable-libzmq --enable-libfreetype --enable-libopencv --enable-libgme
--enable-libcdio --enable-libvo-aacenc --enable-libx264 --enable-ladspa
--enable-libquvi --enable-opengl --enable-libvpx --enable-libxcb
libavutil 54. 23.100 / 54. 23.100
libavcodec 56. 35.101 / 56. 35.101
libavformat 56. 30.100 / 56. 30.100
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 14.100 / 5. 14.100
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 3.100 / 53. 3.100
Input #0, image2, from 'fate-samples/lena.pnm':
Duration: 00:00:00.04, start: 0.000000, bitrate: 39333 kb/s
Stream #0:0: Video: ppm, rgb24, 256x256, 25 tbr, 25 tbn, 25 tbc
Output #0, image2, to 'lena.yuv420p.j2k':
Metadata:
encoder : Lavf56.30.100
Stream #0:0: Video: jpeg2000 (libopenjpeg), yuv420p, 256x256, q=2-31,
200 kb/s, 25 fps, 25 tbn, 25 tbc
Metadata:
encoder : Lavc56.35.101 libopenjpeg
Stream mapping:
Stream #0:0 -> #0:0 (ppm (native) -> jpeg2000 (libopenjpeg))
Press [q] to stop, [?] for help
frame= 1 fps=0.0 q=0.0 Lsize=N/A time=00:00:00.04 bitrate=N/A
video:46kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: unknown
}}}
The generated file lena.yuv420p.j2k can be successfully decoded, but
contains chroma artifacts. Of the three applications used to display it
(ffplay, okular, display) only okular was able to show the image
correctly.
Re-encoding the file with ffmpeg generates a corrupted image, showing the
same artifacts as the image displayed by ffplay (see attachment):
{{{
ffmpeg -i lena.yuv420p.j2k lena.yuv420p.png
ffmpeg version N-71578-g57865a9 Copyright (c) 2000-2015 the FFmpeg
developers
built with gcc 4.8 (Ubuntu/Linaro 4.8.1-10ubuntu9)
configuration: --extra-cflags=-I/home/stefano/include --extra-
ldflags=-L/home/stefano/lib --enable-libopenjpeg --enable-pic --enable-
fontconfig --enable-libass --enable-version3 --prefix=/home/stefano
--disable-shared --enable-static --enable-debug=3 --enable-pthreads
--disable-optimizations --enable-libvorbis --enable-gpl --enable-nonfree
--enable-libmp3lame --enable-libtheora --enable-gpl --enable-x11grab
--enable-frei0r --enable-libfaac --enable-libcaca --enable-libflite
--enable-libzmq --enable-libfreetype --enable-libopencv --enable-libgme
--enable-libcdio --enable-libvo-aacenc --enable-libx264 --enable-ladspa
--enable-libquvi --enable-opengl --enable-libvpx --enable-libxcb
libavutil 54. 23.100 / 54. 23.100
libavcodec 56. 35.101 / 56. 35.101
libavformat 56. 30.100 / 56. 30.100
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 14.100 / 5. 14.100
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 3.100 / 53. 3.100
Input #0, j2k_pipe, from 'lena.yuv420p.j2k':
Duration: N/A, bitrate: N/A
Stream #0:0: Video: jpeg2000 (JPEG 2000 codestream restriction 0),
yuv420p, 256x256, 25 tbr, 25 tbn, 25 tbc
File 'lena.yuv420p.png' already exists. Overwrite ? [y/N] y
Output #0, apng, to 'lena.yuv420p.png':
Metadata:
encoder : Lavf56.30.100
Stream #0:0: Video: apng, rgb24, 256x256, q=2-31, 200 kb/s, 25 fps, 25
tbn, 25 tbc
Metadata:
encoder : Lavc56.35.101 apng
Stream mapping:
Stream #0:0 -> #0:0 (jpeg2000 (native) -> apng (native))
Press [q] to stop, [?] for help
[apng @ 0x24703c0] Only a single frame so saving as a normal PNG.
frame= 1 fps=0.0 q=0.0 Lsize= 140kB time=00:00:00.04
bitrate=28599.6kbits/s
video:140kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: 0.019585%
}}}
The problem doesn't exist if I use -pix_fmt yuv444p.
--
Ticket URL: <https://trac.ffmpeg.org/ticket/4523>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list