I want to convert a .jp2 file from the Sentinel 2 project to .tif with gdal. For some bands it works (e.g. B01) and for some bands it always fails (e.g. B04). I use the sentinel public image browser data (e.g this product).
When I run gdal_translate B04.jp2 B04.tif
I get the following output:
Input file size is 10980, 10980 0maximum number of samples exceeded (120560400 > 67108864) error: cannot decode code stream ERROR 1: B04.jp2, band 1: IReadBlock failed at X offset 0, Y offset 0
My gdal version is 2.3.0, released 2018/05/04
gdalinfo --formats
.brew install gdal --with-complete
). I don't know how to change the JP2 drivers. I tried the gdal docker image (geodata/gdal) which comes with GDAL 2.3.0dev, released 2017/99/99 and has the JP2OpenJPEG driver. Everything works with that combination.