Opened 9 years ago

Closed 9 years ago

#4087 closed defect (fixed)

webp muxer does not write a VP8X header properly

Reported by: jamal Owned by:
Priority: important Component: avformat
Version: git-master Keywords: webp regression
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

It writes one only when the file is an animation, and when it does it apparently doesn't set the corresponding bits based on EXIF, ALPH and other chunks presence.

Take the Exif sample from the FATE suit (Which contains an EXIF chunk and the corresponding presence bit in the VP8X chunk set), and copy it to a new webp file.

$ ./ffmpeg -i ../samples/exif/image_small.webp -c:v copy image.webp
ffmpeg version N-67397-g8176638 Copyright (c) 2000-2014 the FFmpeg developers
  built on Nov  5 2014 23:23:45 with gcc 4.9.2 (Rev2, Built by MSYS2 project)
  configuration: --enable-gpl --target-os=mingw32 --prefix=/mingw64
  libavutil      54. 11.100 / 54. 11.100
  libavcodec     56. 10.102 / 56. 10.102
  libavformat    56. 12.101 / 56. 12.101
  libavdevice    56.  2.100 / 56.  2.100
  libavfilter     5.  2.103 /  5.  2.103
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Input #0, webp_pipe, from '../samples/exif/image_small.webp':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: webp, yuv420p(tv, bt470bg/unknown/unknown), 400x225, 25 tbr, 25 tbn, 25 tbc
Output #0, webp, to 'image.webp':
  Metadata:
    encoder         : Lavf56.12.101
    Stream #0:0: Video: webp, yuv420p, 400x225, q=2-31, 1k tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
frame=    1 fps=0.0 q=-1.0 Lsize=      38kB time=00:00:00.04 bitrate=7851.6kbits/s
video:38kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

Then try to decode the new file

$ ./ffmpeg -i image.webp -f md5 -
ffmpeg version N-67397-g8176638 Copyright (c) 2000-2014 the FFmpeg developers
  built on Nov  5 2014 23:23:45 with gcc 4.9.2 (Rev2, Built by MSYS2 project)
  configuration: --enable-gpl --target-os=mingw32 --prefix=/mingw64
  libavutil      54. 11.100 / 54. 11.100
  libavcodec     56. 10.102 / 56. 10.102
  libavformat    56. 12.101 / 56. 12.101
  libavdevice    56.  2.100 / 56.  2.100
  libavfilter     5.  2.103 /  5.  2.103
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
[webp @ 0000000001773060] EXIF chunk present, but Exif bit not set in the VP8X header
Input #0, webp_pipe, from 'image.webp':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: webp, yuv420p(tv, bt470bg/unknown/unknown), 400x225, 25 tbr, 25 tbn, 25 tbc
Output #0, md5, to 'pipe:':
  Metadata:
    encoder         : Lavf56.12.101
    Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 400x225, q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc
    Metadata:
      encoder         : Lavc56.10.102 rawvideo
Stream mapping:
  Stream #0:0 -> #0:0 (webp (native) -> rawvideo (native))
Press [q] to stop, [?] for help
[webp @ 00000000017ab740] EXIF chunk present, but Exif bit not set in the VP8X header
MD5=2b44bd9cf3f9578c85fc5f76e546d22a
frame=    1 fps=0.0 q=0.0 Lsize=       0kB time=00:00:00.04 bitrate=   7.4kbits/s
video:132kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

While the warning mentions the VP8X header doesn't have the relevant bit set, what really happened is that there's no VP8X header at all (the decoder could be changed so it reports as much instead, for that matter, but that's not relevant here).

Example of a file with an ALPH chunk

$ ./ffmpeg -i http://www.gstatic.com/webp/gallery3/5_webp_a.webp -c:v copy alph.webp
ffmpeg version N-67397-g8176638 Copyright (c) 2000-2014 the FFmpeg developers
  built on Nov  6 2014 03:38:00 with gcc 4.9.2 (Rev2, Built by MSYS2 project)
  configuration: --enable-gpl --enable-libwebp --target-os=mingw32 --prefix=/mingw64
  libavutil      54. 11.100 / 54. 11.100
  libavcodec     56. 10.102 / 56. 10.102
  libavformat    56. 12.101 / 56. 12.101
  libavdevice    56.  2.100 / 56.  2.100
  libavfilter     5.  2.103 /  5.  2.103
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Input #0, webp_pipe, from 'http://www.gstatic.com/webp/gallery3/5_webp_a.webp':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: webp, yuva420p(tv, bt470bg/unknown/unknown), 300x300, 25 tbr, 25 tbn, 25 tbc
Output #0, webp, to 'alph.webp':
  Metadata:
    encoder         : Lavf56.12.101
    Stream #0:0: Video: webp, yuva420p, 300x300, q=2-31, 1k tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
frame=    1 fps=0.0 q=-1.0 Lsize=      68kB time=00:00:00.04 bitrate=13977.6kbits/s
video:68kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

Decode resulting file

ffmpeg version N-67397-g8176638 Copyright (c) 2000-2014 the FFmpeg developers
  built on Nov  6 2014 03:38:00 with gcc 4.9.2 (Rev2, Built by MSYS2 project)
  configuration: --enable-gpl --enable-libwebp --target-os=mingw32 --prefix=/mingw64
  libavutil      54. 11.100 / 54. 11.100
  libavcodec     56. 10.102 / 56. 10.102
  libavformat    56. 12.101 / 56. 12.101
  libavdevice    56.  2.100 / 56.  2.100
  libavfilter     5.  2.103 /  5.  2.103
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
[webp @ 0000000001874f60] ALPHA chunk present, but alpha bit not set in the VP8X header
Input #0, webp_pipe, from 'alph.webp':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: webp, yuva420p(tv, bt470bg/unknown/unknown), 300x300, 25 tbr, 25 tbn, 25 tbc
Output #0, md5, to 'pipe:':
  Metadata:
    encoder         : Lavf56.12.101
    Stream #0:0: Video: rawvideo (Y4[11][8] / 0x80B3459), yuva420p, 300x300, q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc
    Metadata:
      encoder         : Lavc56.10.102 rawvideo
Stream mapping:
  Stream #0:0 -> #0:0 (webp (native) -> rawvideo (native))
Press [q] to stop, [?] for help
[webp @ 0000000001854be0] ALPHA chunk present, but alpha bit not set in the VP8X header
[webp @ 0000000001854be0] A frame threaded decoder did not free the frame on failure. This is a bug, please report it.
MD5=d41d8cd98f00b204e9800998ecf8427e
frame=    0 fps=0.0 q=0.0 Lsize=       0kB time=00:00:00.00 bitrate=N/A
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Output file is empty, nothing was encoded (check -ss / -t / -frames parameters if used)

In this case the resulting file is completely broken because the VP8X header is needed to handle the alpha channel.

This is of course a regression since the webp muxer was introduced (or rather, since image2 stopped handling the muxing).

Change History (1)

comment:1 by Michael Niedermayer, 9 years ago

Reproduced by developer: set
Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.