Why ImageJ can open video, but FFMPEG fails with "Palette size 0 is wrong"

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

Why ImageJ can open video, but FFMPEG fails with "Palette size 0 is wrong"

Aleksejs Fomins
Hi

I have a video which is recorded by a camera in our lab. When I open it
with ImageJ, it says it is a single channel 8bit video. When I open it
with VLC, it says it is a 200fps video with "Codec: Palettized RGB with
palette element R:G:B (RGBP)". In ImageJ, I am able to save it with jpeg
or png compression no problem.

I wanted to automatize the process to compress multiple videos, since
they are very large (each video ~2GB). I tried compressing them with
FFMPEG, but alas, even converting from raw back to raw seems to fail.
See below for complete FFMPEG summary.

Any advice is welcome.

Thanks,
Aleksejs


ffmpeg -i 2018.09.28_16_05_11.avi -vcodec rawvideo output.avi
ffmpeg version 2.8.15-0ubuntu0.16.04.1 Copyright (c) 2000-2018 the
FFmpeg developers
  built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.10) 20160609
  configuration: --prefix=/usr --extra-version=0ubuntu0.16.04.1
--build-suffix=-ffmpeg --toolchain=hardened
--libdir=/usr/lib/x86_64-linux-gnu
--incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl
--enable-shared --disable-stripping --disable-decoder=libopenjpeg
--disable-decoder=libschroedinger --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-libmodplug --enable-libmp3lame
--enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp
--enable-libschroedinger --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-libxvid
--enable-libzvbi --enable-openal --enable-opengl --enable-x11grab
--enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r
--enable-libx264 --enable-libopencv
  WARNING: library configuration mismatch
  avcodec     configuration: --prefix=/usr
--extra-version=0ubuntu0.16.04.1 --build-suffix=-ffmpeg
--toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu
--incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl
--enable-shared --disable-stripping --disable-decoder=libopenjpeg
--disable-decoder=libschroedinger --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-libmodplug --enable-libmp3lame
--enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp
--enable-libschroedinger --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-libxvid
--enable-libzvbi --enable-openal --enable-opengl --enable-x11grab
--enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r
--enable-libx264 --enable-libopencv --enable-version3 --disable-doc
--disable-programs --disable-avdevice --disable-avfilter
--disable-avformat --disable-avresample --disable-postproc
--disable-swscale --enable-libopencore_amrnb --enable-libopencore_amrwb
--enable-libvo_aacenc --enable-libvo_amrwbenc
  libavutil      54. 31.100 / 54. 31.100
  libavcodec     56. 60.100 / 56. 60.100
  libavformat    56. 40.101 / 56. 40.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 40.101 /  5. 40.101
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.101 /  1.  2.101
  libpostproc    53.  3.100 / 53.  3.100
Input #0, avi, from '2018.09.28_16_05_11.avi':
  Duration: 00:00:13.44, start: 0.000000, bitrate: 796322 kb/s
    Stream #0:0: Video: rawvideo, pal8, 790x628, 796097 kb/s, 200 fps,
200 tbr, 200 tbn, 200 tbc
Output #0, avi, to 'output.avi':
  Metadata:
    ISFT            : Lavf56.40.101
    Stream #0:0: Video: rawvideo, pal8, 790x628, q=2-31, 200 kb/s, 200
fps, 200 tbn, 200 tbc
    Metadata:
      encoder         : Lavc56.60.100 rawvideo
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> rawvideo (native))
Press [q] to stop, [?] for help
[rawvideo @ 0x24a13e0] Palette size 0 is wrong
    Last message repeated 250 times
[rawvideo @ 0x24a13e0] Palette size 0 is wronge=00:00:01.26
bitrate=795479.3kbits/s   
    Last message repeated 258 times
[rawvideo @ 0x24a13e0] Palette size 0 is wronge=00:00:02.55
bitrate=795461.0kbits/s   
    Last message repeated 259 times
[rawvideo @ 0x24a13e0] Palette size 0 is wronge=00:00:03.85
bitrate=795455.0kbits/s   
    Last message repeated 260 times
[rawvideo @ 0x24a13e0] Palette size 0 is wronge=00:00:05.16
bitrate=795452.0kbits/s   
    Last message repeated 260 times
[rawvideo @ 0x24a13e0] Palette size 0 is wronge=00:00:06.46
bitrate=795450.2kbits/s   
    Last message repeated 261 times
[rawvideo @ 0x24a13e0] Palette size 0 is wronge=00:00:07.77
bitrate=795449.0kbits/s   
    Last message repeated 259 times
[rawvideo @ 0x24a13e0] Palette size 0 is wronge=00:00:09.07
bitrate=795448.2kbits/s   
    Last message repeated 258 times
[rawvideo @ 0x24a13e0] Palette size 0 is wronge=00:00:10.37
bitrate=795447.6kbits/s   
    Last message repeated 258 times
[rawvideo @ 0x24a13e0] Palette size 0 is wronge=00:00:11.66
bitrate=795482.7kbits/s   
    Last message repeated 256 times
[rawvideo @ 0x24a13e0] Palette size 0 is wronge=00:00:12.95
bitrate=795478.8kbits/s   
    Last message repeated 96 times
frame= 2687 fps=517 q=-0.0 Lsize= 1304599kB time=00:00:13.43
bitrate=795480.0kbits/s   
video:1304518kB audio:0kB subtitle:0kB other streams:0kB global
headers:0kB muxing overhead: 0.006238%

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Why ImageJ can open video, but FFMPEG fails with "Palette size 0 is wrong"

Glen MacDonald-3
Was the original format lossy or lossless? Aside from space savings, why do you want to convert to jpeg?  That will degrade spatial resolution and the ability to perform intensity based analysis or feature extraction.  Was it really captured in 8-bit  grayscale?  Other possible ways to reduce file size without degrading image quality include cropping to the most important region of interest, removing every nth frame or cutting into segments. Converting between compressed formats can turn your movie into mush.  

Regards,
Glen

> On Oct 26, 2018, at 10:50 AM, Aleksejs Fomins <[hidden email]> wrote:
>
> Hi
>
> I have a video which is recorded by a camera in our lab. When I open it
> with ImageJ, it says it is a single channel 8bit video. When I open it
> with VLC, it says it is a 200fps video with "Codec: Palettized RGB with
> palette element R:G:B (RGBP)". In ImageJ, I am able to save it with jpeg
> or png compression no problem.
>
> I wanted to automatize the process to compress multiple videos, since
> they are very large (each video ~2GB). I tried compressing them with
> FFMPEG, but alas, even converting from raw back to raw seems to fail.
> See below for complete FFMPEG summary.
>
> Any advice is welcome.
>
> Thanks,
> Aleksejs
>
>
> ffmpeg -i 2018.09.28_16_05_11.avi -vcodec rawvideo output.avi
> ffmpeg version 2.8.15-0ubuntu0.16.04.1 Copyright (c) 2000-2018 the
> FFmpeg developers
>   built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.10) 20160609
>   configuration: --prefix=/usr --extra-version=0ubuntu0.16.04.1
> --build-suffix=-ffmpeg --toolchain=hardened
> --libdir=/usr/lib/x86_64-linux-gnu
> --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl
> --enable-shared --disable-stripping --disable-decoder=libopenjpeg
> --disable-decoder=libschroedinger --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-libmodplug --enable-libmp3lame
> --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp
> --enable-libschroedinger --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-libxvid
> --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab
> --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r
> --enable-libx264 --enable-libopencv
>   WARNING: library configuration mismatch
>   avcodec     configuration: --prefix=/usr
> --extra-version=0ubuntu0.16.04.1 --build-suffix=-ffmpeg
> --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu
> --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl
> --enable-shared --disable-stripping --disable-decoder=libopenjpeg
> --disable-decoder=libschroedinger --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-libmodplug --enable-libmp3lame
> --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp
> --enable-libschroedinger --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-libxvid
> --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab
> --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r
> --enable-libx264 --enable-libopencv --enable-version3 --disable-doc
> --disable-programs --disable-avdevice --disable-avfilter
> --disable-avformat --disable-avresample --disable-postproc
> --disable-swscale --enable-libopencore_amrnb --enable-libopencore_amrwb
> --enable-libvo_aacenc --enable-libvo_amrwbenc
>   libavutil      54. 31.100 / 54. 31.100
>   libavcodec     56. 60.100 / 56. 60.100
>   libavformat    56. 40.101 / 56. 40.101
>   libavdevice    56.  4.100 / 56.  4.100
>   libavfilter     5. 40.101 /  5. 40.101
>   libavresample   2.  1.  0 /  2.  1.  0
>   libswscale      3.  1.101 /  3.  1.101
>   libswresample   1.  2.101 /  1.  2.101
>   libpostproc    53.  3.100 / 53.  3.100
> Input #0, avi, from '2018.09.28_16_05_11.avi':
>   Duration: 00:00:13.44, start: 0.000000, bitrate: 796322 kb/s
>     Stream #0:0: Video: rawvideo, pal8, 790x628, 796097 kb/s, 200 fps,
> 200 tbr, 200 tbn, 200 tbc
> Output #0, avi, to 'output.avi':
>   Metadata:
>     ISFT            : Lavf56.40.101
>     Stream #0:0: Video: rawvideo, pal8, 790x628, q=2-31, 200 kb/s, 200
> fps, 200 tbn, 200 tbc
>     Metadata:
>       encoder         : Lavc56.60.100 rawvideo
> Stream mapping:
>   Stream #0:0 -> #0:0 (rawvideo (native) -> rawvideo (native))
> Press [q] to stop, [?] for help
> [rawvideo @ 0x24a13e0] Palette size 0 is wrong
>     Last message repeated 250 times
> [rawvideo @ 0x24a13e0] Palette size 0 is wronge=00:00:01.26
> bitrate=795479.3kbits/s  
>     Last message repeated 258 times
> [rawvideo @ 0x24a13e0] Palette size 0 is wronge=00:00:02.55
> bitrate=795461.0kbits/s  
>     Last message repeated 259 times
> [rawvideo @ 0x24a13e0] Palette size 0 is wronge=00:00:03.85
> bitrate=795455.0kbits/s  
>     Last message repeated 260 times
> [rawvideo @ 0x24a13e0] Palette size 0 is wronge=00:00:05.16
> bitrate=795452.0kbits/s  
>     Last message repeated 260 times
> [rawvideo @ 0x24a13e0] Palette size 0 is wronge=00:00:06.46
> bitrate=795450.2kbits/s  
>     Last message repeated 261 times
> [rawvideo @ 0x24a13e0] Palette size 0 is wronge=00:00:07.77
> bitrate=795449.0kbits/s  
>     Last message repeated 259 times
> [rawvideo @ 0x24a13e0] Palette size 0 is wronge=00:00:09.07
> bitrate=795448.2kbits/s  
>     Last message repeated 258 times
> [rawvideo @ 0x24a13e0] Palette size 0 is wronge=00:00:10.37
> bitrate=795447.6kbits/s  
>     Last message repeated 258 times
> [rawvideo @ 0x24a13e0] Palette size 0 is wronge=00:00:11.66
> bitrate=795482.7kbits/s  
>     Last message repeated 256 times
> [rawvideo @ 0x24a13e0] Palette size 0 is wronge=00:00:12.95
> bitrate=795478.8kbits/s  
>     Last message repeated 96 times
> frame= 2687 fps=517 q=-0.0 Lsize= 1304599kB time=00:00:13.43
> bitrate=795480.0kbits/s  
> video:1304518kB audio:0kB subtitle:0kB other streams:0kB global
> headers:0kB muxing overhead: 0.006238%
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Why ImageJ can open video, but FFMPEG fails with "Palette size 0 is wrong"

Aleksejs Fomins
I was able to find out that it is supposedly a single channel basic
windows bitmap format, which is lossless I think. Surely there must be a
way to save it an almost lossless format and save space. The frames in
the video have a lot in common, so there is potential for compression.

Yeah, I heard that converting between lossy formats is a bad idea. But
converting once from lossless to lossy should be fine, right?

Thanks,
Aleksejs

On 26.10.18 23:16, Glen MacDonald wrote:

> Was the original format lossy or lossless? Aside from space savings, why do you want to convert to jpeg?  That will degrade spatial resolution and the ability to perform intensity based analysis or feature extraction.  Was it really captured in 8-bit  grayscale?  Other possible ways to reduce file size without degrading image quality include cropping to the most important region of interest, removing every nth frame or cutting into segments. Converting between compressed formats can turn your movie into mush.  
>
> Regards,
> Glen
>> On Oct 26, 2018, at 10:50 AM, Aleksejs Fomins <[hidden email]> wrote:
>>
>> Hi
>>
>> I have a video which is recorded by a camera in our lab. When I open it
>> with ImageJ, it says it is a single channel 8bit video. When I open it
>> with VLC, it says it is a 200fps video with "Codec: Palettized RGB with
>> palette element R:G:B (RGBP)". In ImageJ, I am able to save it with jpeg
>> or png compression no problem.
>>
>> I wanted to automatize the process to compress multiple videos, since
>> they are very large (each video ~2GB). I tried compressing them with
>> FFMPEG, but alas, even converting from raw back to raw seems to fail.
>> See below for complete FFMPEG summary.
>>
>> Any advice is welcome.
>>
>> Thanks,
>> Aleksejs
>>
>>
>> ffmpeg -i 2018.09.28_16_05_11.avi -vcodec rawvideo output.avi
>> ffmpeg version 2.8.15-0ubuntu0.16.04.1 Copyright (c) 2000-2018 the
>> FFmpeg developers
>>   built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.10) 20160609
>>   configuration: --prefix=/usr --extra-version=0ubuntu0.16.04.1
>> --build-suffix=-ffmpeg --toolchain=hardened
>> --libdir=/usr/lib/x86_64-linux-gnu
>> --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl
>> --enable-shared --disable-stripping --disable-decoder=libopenjpeg
>> --disable-decoder=libschroedinger --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-libmodplug --enable-libmp3lame
>> --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp
>> --enable-libschroedinger --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-libxvid
>> --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab
>> --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r
>> --enable-libx264 --enable-libopencv
>>   WARNING: library configuration mismatch
>>   avcodec     configuration: --prefix=/usr
>> --extra-version=0ubuntu0.16.04.1 --build-suffix=-ffmpeg
>> --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu
>> --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl
>> --enable-shared --disable-stripping --disable-decoder=libopenjpeg
>> --disable-decoder=libschroedinger --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-libmodplug --enable-libmp3lame
>> --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp
>> --enable-libschroedinger --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-libxvid
>> --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab
>> --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r
>> --enable-libx264 --enable-libopencv --enable-version3 --disable-doc
>> --disable-programs --disable-avdevice --disable-avfilter
>> --disable-avformat --disable-avresample --disable-postproc
>> --disable-swscale --enable-libopencore_amrnb --enable-libopencore_amrwb
>> --enable-libvo_aacenc --enable-libvo_amrwbenc
>>   libavutil      54. 31.100 / 54. 31.100
>>   libavcodec     56. 60.100 / 56. 60.100
>>   libavformat    56. 40.101 / 56. 40.101
>>   libavdevice    56.  4.100 / 56.  4.100
>>   libavfilter     5. 40.101 /  5. 40.101
>>   libavresample   2.  1.  0 /  2.  1.  0
>>   libswscale      3.  1.101 /  3.  1.101
>>   libswresample   1.  2.101 /  1.  2.101
>>   libpostproc    53.  3.100 / 53.  3.100
>> Input #0, avi, from '2018.09.28_16_05_11.avi':
>>   Duration: 00:00:13.44, start: 0.000000, bitrate: 796322 kb/s
>>     Stream #0:0: Video: rawvideo, pal8, 790x628, 796097 kb/s, 200 fps,
>> 200 tbr, 200 tbn, 200 tbc
>> Output #0, avi, to 'output.avi':
>>   Metadata:
>>     ISFT            : Lavf56.40.101
>>     Stream #0:0: Video: rawvideo, pal8, 790x628, q=2-31, 200 kb/s, 200
>> fps, 200 tbn, 200 tbc
>>     Metadata:
>>       encoder         : Lavc56.60.100 rawvideo
>> Stream mapping:
>>   Stream #0:0 -> #0:0 (rawvideo (native) -> rawvideo (native))
>> Press [q] to stop, [?] for help
>> [rawvideo @ 0x24a13e0] Palette size 0 is wrong
>>     Last message repeated 250 times
>> [rawvideo @ 0x24a13e0] Palette size 0 is wronge=00:00:01.26
>> bitrate=795479.3kbits/s  
>>     Last message repeated 258 times
>> [rawvideo @ 0x24a13e0] Palette size 0 is wronge=00:00:02.55
>> bitrate=795461.0kbits/s  
>>     Last message repeated 259 times
>> [rawvideo @ 0x24a13e0] Palette size 0 is wronge=00:00:03.85
>> bitrate=795455.0kbits/s  
>>     Last message repeated 260 times
>> [rawvideo @ 0x24a13e0] Palette size 0 is wronge=00:00:05.16
>> bitrate=795452.0kbits/s  
>>     Last message repeated 260 times
>> [rawvideo @ 0x24a13e0] Palette size 0 is wronge=00:00:06.46
>> bitrate=795450.2kbits/s  
>>     Last message repeated 261 times
>> [rawvideo @ 0x24a13e0] Palette size 0 is wronge=00:00:07.77
>> bitrate=795449.0kbits/s  
>>     Last message repeated 259 times
>> [rawvideo @ 0x24a13e0] Palette size 0 is wronge=00:00:09.07
>> bitrate=795448.2kbits/s  
>>     Last message repeated 258 times
>> [rawvideo @ 0x24a13e0] Palette size 0 is wronge=00:00:10.37
>> bitrate=795447.6kbits/s  
>>     Last message repeated 258 times
>> [rawvideo @ 0x24a13e0] Palette size 0 is wronge=00:00:11.66
>> bitrate=795482.7kbits/s  
>>     Last message repeated 256 times
>> [rawvideo @ 0x24a13e0] Palette size 0 is wronge=00:00:12.95
>> bitrate=795478.8kbits/s  
>>     Last message repeated 96 times
>> frame= 2687 fps=517 q=-0.0 Lsize= 1304599kB time=00:00:13.43
>> bitrate=795480.0kbits/s  
>> video:1304518kB audio:0kB subtitle:0kB other streams:0kB global
>> headers:0kB muxing overhead: 0.006238%
>>
>> --
>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Why ImageJ can open video, but FFMPEG fails with "Palette size 0 is wrong"

Michael Schmid-3
Hi Aleksejs,

in ImageJ you can use PNG compression for movies; depending on the noise
in the images you might gain a factor of 2 or a bit more. PNG is
lossless, ffmpeg can read it.

The huffyuv and FFV1 codecs are also lossless and have better
compression than png. You can use them in e.g. ffmpeg, but plain ImageJ
1 cannot read them.

When using lossy codecs, the problem is not just conversion between
codecs; you also get losses already upon the first conversion from
lossless to a lossy codec. These codecs are optimized in a way that the
losses are not obvious to the eye, but the compression artifacts may be
a problem for quantitative evaluation or for further processing, e.g.,
if you try to enhance weak contrast, do a Fourier transform, etc.


Michael
________________________________________________________________
On 28.10.18 11:25, Aleksejs Fomins wrote:

> I was able to find out that it is supposedly a single channel basic
> windows bitmap format, which is lossless I think. Surely there must be a
> way to save it an almost lossless format and save space. The frames in
> the video have a lot in common, so there is potential for compression.
>
> Yeah, I heard that converting between lossy formats is a bad idea. But
> converting once from lossless to lossy should be fine, right?
>
> Thanks,
> Aleksejs
>
> On 26.10.18 23:16, Glen MacDonald wrote:
>> Was the original format lossy or lossless? Aside from space savings, why do you want to convert to jpeg?  That will degrade spatial resolution and the ability to perform intensity based analysis or feature extraction.  Was it really captured in 8-bit  grayscale?  Other possible ways to reduce file size without degrading image quality include cropping to the most important region of interest, removing every nth frame or cutting into segments. Converting between compressed formats can turn your movie into mush.
>>
>> Regards,
>> Glen
>>> On Oct 26, 2018, at 10:50 AM, Aleksejs Fomins <[hidden email]> wrote:
>>>
>>> Hi
>>>
>>> I have a video which is recorded by a camera in our lab. When I open it
>>> with ImageJ, it says it is a single channel 8bit video. When I open it
>>> with VLC, it says it is a 200fps video with "Codec: Palettized RGB with
>>> palette element R:G:B (RGBP)". In ImageJ, I am able to save it with jpeg
>>> or png compression no problem.
>>>
>>> I wanted to automatize the process to compress multiple videos, since
>>> they are very large (each video ~2GB). I tried compressing them with
>>> FFMPEG, but alas, even converting from raw back to raw seems to fail.
>>> See below for complete FFMPEG summary.
>>>
>>> Any advice is welcome.
>>>
>>> Thanks,
>>> Aleksejs
>>>
>>>
>>> ffmpeg -i 2018.09.28_16_05_11.avi -vcodec rawvideo output.avi
>>> ffmpeg version 2.8.15-0ubuntu0.16.04.1 Copyright (c) 2000-2018 the
>>> FFmpeg developers
>>>    built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.10) 20160609
>>>    configuration: --prefix=/usr --extra-version=0ubuntu0.16.04.1
>>> --build-suffix=-ffmpeg --toolchain=hardened
>>> --libdir=/usr/lib/x86_64-linux-gnu
>>> --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl
>>> --enable-shared --disable-stripping --disable-decoder=libopenjpeg
>>> --disable-decoder=libschroedinger --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-libmodplug --enable-libmp3lame
>>> --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp
>>> --enable-libschroedinger --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-libxvid
>>> --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab
>>> --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r
>>> --enable-libx264 --enable-libopencv
>>>    WARNING: library configuration mismatch
>>>    avcodec     configuration: --prefix=/usr
>>> --extra-version=0ubuntu0.16.04.1 --build-suffix=-ffmpeg
>>> --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu
>>> --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl
>>> --enable-shared --disable-stripping --disable-decoder=libopenjpeg
>>> --disable-decoder=libschroedinger --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-libmodplug --enable-libmp3lame
>>> --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp
>>> --enable-libschroedinger --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-libxvid
>>> --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab
>>> --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r
>>> --enable-libx264 --enable-libopencv --enable-version3 --disable-doc
>>> --disable-programs --disable-avdevice --disable-avfilter
>>> --disable-avformat --disable-avresample --disable-postproc
>>> --disable-swscale --enable-libopencore_amrnb --enable-libopencore_amrwb
>>> --enable-libvo_aacenc --enable-libvo_amrwbenc
>>>    libavutil      54. 31.100 / 54. 31.100
>>>    libavcodec     56. 60.100 / 56. 60.100
>>>    libavformat    56. 40.101 / 56. 40.101
>>>    libavdevice    56.  4.100 / 56.  4.100
>>>    libavfilter     5. 40.101 /  5. 40.101
>>>    libavresample   2.  1.  0 /  2.  1.  0
>>>    libswscale      3.  1.101 /  3.  1.101
>>>    libswresample   1.  2.101 /  1.  2.101
>>>    libpostproc    53.  3.100 / 53.  3.100
>>> Input #0, avi, from '2018.09.28_16_05_11.avi':
>>>    Duration: 00:00:13.44, start: 0.000000, bitrate: 796322 kb/s
>>>      Stream #0:0: Video: rawvideo, pal8, 790x628, 796097 kb/s, 200 fps,
>>> 200 tbr, 200 tbn, 200 tbc
>>> Output #0, avi, to 'output.avi':
>>>    Metadata:
>>>      ISFT            : Lavf56.40.101
>>>      Stream #0:0: Video: rawvideo, pal8, 790x628, q=2-31, 200 kb/s, 200
>>> fps, 200 tbn, 200 tbc
>>>      Metadata:
>>>        encoder         : Lavc56.60.100 rawvideo
>>> Stream mapping:
>>>    Stream #0:0 -> #0:0 (rawvideo (native) -> rawvideo (native))
>>> Press [q] to stop, [?] for help
>>> [rawvideo @ 0x24a13e0] Palette size 0 is wrong
>>>      Last message repeated 250 times
>>> [rawvideo @ 0x24a13e0] Palette size 0 is wronge=00:00:01.26
>>> bitrate=795479.3kbits/s
>>>      Last message repeated 258 times
>>> [rawvideo @ 0x24a13e0] Palette size 0 is wronge=00:00:02.55
>>> bitrate=795461.0kbits/s
>>>      Last message repeated 259 times
>>> [rawvideo @ 0x24a13e0] Palette size 0 is wronge=00:00:03.85
>>> bitrate=795455.0kbits/s
>>>      Last message repeated 260 times
>>> [rawvideo @ 0x24a13e0] Palette size 0 is wronge=00:00:05.16
>>> bitrate=795452.0kbits/s
>>>      Last message repeated 260 times
>>> [rawvideo @ 0x24a13e0] Palette size 0 is wronge=00:00:06.46
>>> bitrate=795450.2kbits/s
>>>      Last message repeated 261 times
>>> [rawvideo @ 0x24a13e0] Palette size 0 is wronge=00:00:07.77
>>> bitrate=795449.0kbits/s
>>>      Last message repeated 259 times
>>> [rawvideo @ 0x24a13e0] Palette size 0 is wronge=00:00:09.07
>>> bitrate=795448.2kbits/s
>>>      Last message repeated 258 times
>>> [rawvideo @ 0x24a13e0] Palette size 0 is wronge=00:00:10.37
>>> bitrate=795447.6kbits/s
>>>      Last message repeated 258 times
>>> [rawvideo @ 0x24a13e0] Palette size 0 is wronge=00:00:11.66
>>> bitrate=795482.7kbits/s
>>>      Last message repeated 256 times
>>> [rawvideo @ 0x24a13e0] Palette size 0 is wronge=00:00:12.95
>>> bitrate=795478.8kbits/s
>>>      Last message repeated 96 times
>>> frame= 2687 fps=517 q=-0.0 Lsize= 1304599kB time=00:00:13.43
>>> bitrate=795480.0kbits/s
>>> video:1304518kB audio:0kB subtitle:0kB other streams:0kB global
>>> headers:0kB muxing overhead: 0.006238%
>>>
>>> --
>>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>> --
>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html