Opened 8 months ago

Last modified 6 weeks ago

#7759 new defect

Wrong length/frames with VP9 when using yuva420p and lossless

Reported by: ChristianW Owned by:
Priority: normal Component: avcodec
Version: git-master Keywords: libvpx alpha
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

There will be wrong number of frames/length if VP9 and alpha with lossless is used.
If lossless is not used then it works ok.
If no alpha(yuv420p) is used it works ok.
Easies is to look at the time=00:00:07.16 versus the wrong time=00:00:6.52
So the video stopps before the last frame.
Very bad when a looping video is needed.

/Christian

Ok when running(180 frames of png with alpha) with alpha and without lossless:
ffmpeg -i Image%04d.png -c:v libvpx-vp9 -pix_fmt yuva420p output.webm
ffmpeg version N-93252-gf948082e5f Copyright (c) 2000-2019 the FFmpeg developers

built with gcc 8.2.1 (GCC) 20190212
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
libavutil 56. 26.100 / 56. 26.100
libavcodec 58. 47.102 / 58. 47.102
libavformat 58. 26.101 / 58. 26.101
libavdevice 58. 6.101 / 58. 6.101
libavfilter 7. 48.100 / 7. 48.100
libswscale 5. 4.100 / 5. 4.100
libswresample 3. 4.100 / 3. 4.100
libpostproc 55. 4.100 / 55. 4.100

Input #0, image2, from 'Image%04d.png':

Duration: 00:00:07.20, start: 0.000000, bitrate: N/A

Stream #0:0: Video: png, rgba(pc), 320x180 [SAR 2835:2835 DAR 16:9], 25 fps, 25 tbr, 25 tbn, 25 tbc

Stream mapping:

Stream #0:0 -> #0:0 (png (native) -> vp9 (libvpx-vp9))

Press [q] to stop, ? for help
[libvpx-vp9 @ 00000220f80fd5c0] v1.8.0-166-g2543f37a3
Output #0, webm, to 'output.webm':

Metadata:

encoder : Lavf58.26.101
Stream #0:0: Video: vp9 (libvpx-vp9), yuva420p, 320x180 [SAR 1:1 DAR 16:9], q=-1--1, 200 kb/s, 25 fps, 1k tbn, 25 tbc
Metadata:

encoder : Lavc58.47.102 libvpx-vp9

Side data:

cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1

frame= 180 fps= 29 q=0.0 Lsize= 257kB time=00:00:07.16 bitrate= 293.5kbits/s speed=1.14x
video:158kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 62.363186%

Ok when running(180 frames of png with alpha) without alpha and with lossless:
ffmpeg -i Image%04d.png -c:v libvpx-vp9 -lossless 1 -pix_fmt yuv420p output.webm
ffmpeg version N-93252-gf948082e5f Copyright (c) 2000-2019 the FFmpeg developers

built with gcc 8.2.1 (GCC) 20190212
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
libavutil 56. 26.100 / 56. 26.100
libavcodec 58. 47.102 / 58. 47.102
libavformat 58. 26.101 / 58. 26.101
libavdevice 58. 6.101 / 58. 6.101
libavfilter 7. 48.100 / 7. 48.100
libswscale 5. 4.100 / 5. 4.100
libswresample 3. 4.100 / 3. 4.100
libpostproc 55. 4.100 / 55. 4.100

Input #0, image2, from 'Image%04d.png':

Duration: 00:00:07.20, start: 0.000000, bitrate: N/A

Stream #0:0: Video: png, rgba(pc), 320x180 [SAR 2835:2835 DAR 16:9], 25 fps, 25 tbr, 25 tbn, 25 tbc

Stream mapping:

Stream #0:0 -> #0:0 (png (native) -> vp9 (libvpx-vp9))

Press [q] to stop, ? for help
[libvpx-vp9 @ 0000025298b9cdc0] v1.8.0-166-g2543f37a3
Output #0, webm, to 'output.webm':

Metadata:

encoder : Lavf58.26.101
Stream #0:0: Video: vp9 (libvpx-vp9), yuv420p, 320x180 [SAR 1:1 DAR 16:9], q=-1--1, 200 kb/s, 25 fps, 1k tbn, 25 tbc
Metadata:

encoder : Lavc58.47.102 libvpx-vp9

Side data:

cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1

frame= 180 fps= 52 q=0.0 Lsize= 1974kB time=00:00:07.16 bitrate=2258.1kbits/s speed=2.06x
video:1972kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.098054%

Not ok when running(180 frames of png with alpha) with alpha and with lossless:
ffmpeg -i Image%04d.png -c:v libvpx-vp9 -lossless 1 -pix_fmt yuva420p output.webm
ffmpeg version N-93252-gf948082e5f Copyright (c) 2000-2019 the FFmpeg developers

built with gcc 8.2.1 (GCC) 20190212
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
libavutil 56. 26.100 / 56. 26.100
libavcodec 58. 47.102 / 58. 47.102
libavformat 58. 26.101 / 58. 26.101
libavdevice 58. 6.101 / 58. 6.101
libavfilter 7. 48.100 / 7. 48.100
libswscale 5. 4.100 / 5. 4.100
libswresample 3. 4.100 / 3. 4.100
libpostproc 55. 4.100 / 55. 4.100

Input #0, image2, from 'Image%04d.png':

Duration: 00:00:07.20, start: 0.000000, bitrate: N/A

Stream #0:0: Video: png, rgba(pc), 320x180 [SAR 2835:2835 DAR 16:9], 25 fps, 25 tbr, 25 tbn, 25 tbc

Stream mapping:

Stream #0:0 -> #0:0 (png (native) -> vp9 (libvpx-vp9))

Press [q] to stop, ? for help
[libvpx-vp9 @ 000001ae26efcdc0] v1.8.0-166-g2543f37a3
Output #0, webm, to 'output.webm':

Metadata:

encoder : Lavf58.26.101
Stream #0:0: Video: vp9 (libvpx-vp9), yuva420p, 320x180 [SAR 1:1 DAR 16:9], q=-1--1, 200 kb/s, 25 fps, 1k tbn, 25 tbc
Metadata:

encoder : Lavc58.47.102 libvpx-vp9

Side data:

cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1

frame= 180 fps= 34 q=0.0 Lsize= 1986kB time=00:00:06.52 bitrate=2494.3kbits/s speed=1.24x
video:1797kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 10.490592%

Change History (3)

comment:1 Changed 8 months ago by cehoyos

  • Component changed from ffmpeg to undetermined
  • Keywords yuva420p lossless removed
  • Priority changed from critical to normal

comment:2 Changed 6 weeks ago by User

lag-in-frames seems like it's the culprit; using the argument -lag-in-frames 0 fixes the issue. Works with both 1-pass and 2-pass encodes.

Although it's worth mentioning, in your example you're converting a png file, and that's not going to be truly lossless without a pixel format like yuv444p or gbrp (neither of which support alpha). libvpx-vp9 would need yuva444p or gbrap support, and right now the only pixel format with alpha that is supported is yuva420p.

Last edited 6 weeks ago by User (previous) (diff)

comment:3 Changed 6 weeks ago by cehoyos

  • Component changed from undetermined to avcodec
  • Keywords libvpx alpha added
  • Version changed from unspecified to git-master
Note: See TracTickets for help on using tickets.