[FFmpeg-trac] #3745(avcodec:new): error with libopenjpeg encoding
FFmpeg
trac at avcodec.org
Thu Jun 26 20:12:25 CEST 2014
#3745: error with libopenjpeg encoding
-------------------------------------+-------------------------------------
Reporter: dericed | Owner:
Type: defect | Status: new
Priority: normal | Component: avcodec
Version: git- | Keywords: libopenjpeg
master | Blocking:
Blocked By: | Analyzed by developer: 0
Reproduced by developer: 0 |
-------------------------------------+-------------------------------------
Summary of the bug:
When using ffmpeg with libopenjpeg to make lossless encodings I use
framemd5 to verify the losslessness. I found this sample that causes a
glitch.
How to reproduce:
This command makes both a jpeg2000 output and a framemd5 output of the
source file, which is available here
https://archive.org/download/v210_cant_be_jpeg2000d/v210_cant_be_jpeg2000d.mov.
{{{
ffmpeg -y -i v210_cant_be_jpeg2000d.mov -c:v libopenjpeg -an
isthisjpeg2000lossless.mov -f framemd5 -an v210_cant_be_jpeg2000d.framemd5
ffmpeg version N-64075-g47c8d1e Copyright (c) 2000-2014 the FFmpeg
developers
built on Jun 19 2014 10:18:25 with Apple LLVM version 5.1
(clang-503.0.40) (based on LLVM 3.4svn)
configuration: --prefix=/usr/local/Cellar/ffmpeg/HEAD --enable-shared
--enable-pthreads --enable-gpl --enable-version3 --enable-nonfree
--enable-hardcoded-tables --enable-avresample --enable-vda --cc=clang
--host-cflags= --host-ldflags= --enable-libx264 --enable-libfaac --enable-
libmp3lame --enable-libxvid --enable-libfreetype --enable-ffplay --enable-
libopenjpeg --extra-
cflags='-I/usr/local/Cellar/openjpeg/1.5.1_1/include/openjpeg-1.5 '
libavutil 52. 89.100 / 52. 89.100
libavcodec 55. 67.100 / 55. 67.100
libavformat 55. 44.100 / 55. 44.100
libavdevice 55. 13.101 / 55. 13.101
libavfilter 4. 8.100 / 4. 8.100
libavresample 1. 3. 0 / 1. 3. 0
libswscale 2. 6.100 / 2. 6.100
libswresample 0. 19.100 / 0. 19.100
libpostproc 52. 3.100 / 52. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'v210_cant_be_jpeg2000d.mov':
Metadata:
major_brand : qt
minor_version : 512
compatible_brands: qt
encoder : Lavf55.44.100
Duration: 00:00:01.02, start: 0.021333, bitrate: 219267 kb/s
Stream #0:0(eng): Video: v210 (v210 / 0x30313276), yuv422p10le,
720x486, 223725 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 30k tbc (default)
Metadata:
handler_name : DataHandler
encoder : Lavc55.68.100 v210
Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo,
fltp, 123 kb/s (default)
Metadata:
handler_name : DataHandler
[mov @ 0x7fb81b00e400] Using AVStream.codec.time_base as a timebase hint
to the muxer is deprecated. Set AVStream.time_base instead.
[framemd5 @ 0x7fb81b01f200] Using AVStream.codec.time_base as a timebase
hint to the muxer is deprecated. Set AVStream.time_base instead.
Output #0, mov, to 'isthisjpeg2000lossless.mov':
Metadata:
major_brand : qt
minor_version : 512
compatible_brands: qt
encoder : Lavf55.44.100
Stream #0:0(eng): Video: jpeg2000 (libopenjpeg) (mjp2 / 0x32706A6D),
yuv422p10le, 720x486, q=2-31, 200 kb/s, 29.97 fps, 30k tbn, 29.97 tbc
(default)
Metadata:
handler_name : DataHandler
encoder : Lavc55.67.100 libopenjpeg
Output #1, framemd5, to 'v210_cant_be_jpeg2000d.framemd5':
Metadata:
major_brand : qt
minor_version : 512
compatible_brands: qt
encoder : Lavf55.44.100
Stream #1:0(eng): Video: rawvideo (Y3[10][10] / 0xA0A3359),
yuv422p10le, 720x486, q=2-31, 200 kb/s, 29.97 fps, 29.97 tbn, 29.97 tbc
(default)
Metadata:
handler_name : DataHandler
encoder : Lavc55.67.100 rawvideo
Stream mapping:
Stream #0:0 -> #0:0 (v210 (native) -> jpeg2000 (libopenjpeg))
Stream #0:0 -> #1:0 (v210 (native) -> rawvideo (native))
Press [q] to stop, [?] for help
frame= 31 fps=8.8 q=0.0 Lq=0.0 size= 13587kB time=00:00:01.03
bitrate=107608.2kbits/s dup=1 drop=0
video:54593kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: unknown
}}}
To verify the losslessness I then make a framemd5 from the j2k output:
{{{
ffmpeg -y -vcodec libopenjpeg -i isthisjpeg2000lossless.mov -f framemd5
-an isthisjpeg2000lossless.framemd5
ffmpeg version N-64075-g47c8d1e Copyright (c) 2000-2014 the FFmpeg
developers
built on Jun 19 2014 10:18:25 with Apple LLVM version 5.1
(clang-503.0.40) (based on LLVM 3.4svn)
configuration: --prefix=/usr/local/Cellar/ffmpeg/HEAD --enable-shared
--enable-pthreads --enable-gpl --enable-version3 --enable-nonfree
--enable-hardcoded-tables --enable-avresample --enable-vda --cc=clang
--host-cflags= --host-ldflags= --enable-libx264 --enable-libfaac --enable-
libmp3lame --enable-libxvid --enable-libfreetype --enable-ffplay --enable-
libopenjpeg --extra-
cflags='-I/usr/local/Cellar/openjpeg/1.5.1_1/include/openjpeg-1.5 '
libavutil 52. 89.100 / 52. 89.100
libavcodec 55. 67.100 / 55. 67.100
libavformat 55. 44.100 / 55. 44.100
libavdevice 55. 13.101 / 55. 13.101
libavfilter 4. 8.100 / 4. 8.100
libavresample 1. 3. 0 / 1. 3. 0
libswscale 2. 6.100 / 2. 6.100
libswresample 0. 19.100 / 0. 19.100
libpostproc 52. 3.100 / 52. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'isthisjpeg2000lossless.mov':
Metadata:
major_brand : qt
minor_version : 512
compatible_brands: qt
encoder : Lavf55.44.100
Duration: 00:00:01.04, start: 0.000000, bitrate: 107542 kb/s
Stream #0:0(eng): Video: jpeg2000 (mjp2 / 0x32706A6D), yuv422p10le,
720x486, 107601 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 30k tbc (default)
Metadata:
handler_name : DataHandler
encoder : Lavc55.67.100 libopenjpeg
[framemd5 @ 0x7f859d811e00] Using AVStream.codec.time_base as a timebase
hint to the muxer is deprecated. Set AVStream.time_base instead.
Output #0, framemd5, to 'isthisjpeg2000lossless.framemd5':
Metadata:
major_brand : qt
minor_version : 512
compatible_brands: qt
encoder : Lavf55.44.100
Stream #0:0(eng): Video: rawvideo (Y3[10][10] / 0xA0A3359),
yuv422p10le, 720x486, q=2-31, 200 kb/s, 29.97 fps, 29.97 tbn, 29.97 tbc
(default)
Metadata:
handler_name : DataHandler
encoder : Lavc55.67.100 rawvideo
Stream mapping:
Stream #0:0 -> #0:0 (jpeg2000 (libopenjpeg) -> rawvideo (native))
Press [q] to stop, [?] for help
frame= 31 fps= 15 q=0.0 Lsize= 3kB time=00:00:01.03 bitrate=
20.3kbits/s
video:42373kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: unknown
}}}
Then check the similarity of the framemd5 outputs:
{{{
diff v210_cant_be_jpeg2000d.framemd5 isthisjpeg2000lossless.framemd5
6a7
> 0, 0, 0, 1, 1399680,
b49bc926bc8d4734e861297e9bf63c96
23c24
< 0, 17, 17, 1, 1399680,
698ea483de551f4efc0cc9fbdebdcf61
---
> 0, 17, 17, 1, 1399680,
160cda3daf1402700944d2eaa322687e
}}}
With mov I often see this extra frame at the beginning, but I'm more
concerned about frame 17. When I look at frame 17 in the j2k output it has
bright red and green colors over the frame. The Y and U planes seem
accurate but the V plane seems very odd. I posted an image of it here:
https://twitter.com/dericed/status/482195897456275457 the image on the
right shows U on the left and V on the right. Very odd. I reran the
process hoping it was a fluke but got a consistently glitchy output for
jpeg2000, though when I transcode the same source to ffv1 the framemd5s
matched.
--
Ticket URL: <https://trac.ffmpeg.org/ticket/3745>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list