[FFmpeg-user] webm encoded from individual frames is not as long as input when using '-lossless 1'
Rob Hallam
ffmpeg at roberthallam.com
Thu Apr 30 20:05:21 EEST 2020
Hello all, thanks in advance for reading and providing help.
I am creating a yuva420p webm file from 300 RGBA PNG images. I intend to
have a framerate of 60, and so have a clip exactly 5 seconds long. However
this is not the case; the resulting file has (ffprobe) DURATION of 4.934
seconds. Visually checking the video output, it does not end on the
expended frame but a few frames early. Based on the DURATION I would guess
it is 4 frames short.
I have earlier in the day created another webm instead with 60 and 180
frames, each has a DURATION to an exact second and with the correct ending
frame.
The same command without '-lossless 1' produces a file with the correct
duration. However specifying a 'Constant Quality' (in this case, 30) causes
it to end prematurely with a different DURATION.
Why would this happen? I am not terribly familiar with webm encoding, so I
am presumably missing something.
Command lines and full console outputs appended.
Cheers,
Rob
---
I am using the latest ffmpeg package provided in the Arch repos; I am not
set up for compiling ffmpeg from git at present however I can try if that
would make a difference in this case.
Lossless:
$ ffmpeg -framerate 60 -f image2 -i 4frame%04d.png -c:v libvpx-vp9
-lossless 1 -pix_fmt yuva420p -an spacestinger5b.webm
ffmpeg version n4.2.2 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 9.3.0 (Arch Linux 9.3.0-1)
configuration: --prefix=/usr --disable-debug --disable-static
--disable-stripping --enable-fontconfig --enable-gmp --enable-gnutls
--enable-gpl --enable-ladspa --enable-libaom --enable-libass
--enable-libbluray --enable-libdav1d --enable-libdrm --enable-libfreetype
--enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libjack
--enable-libmfx --enable-libmodplug --enable-libmp3lame
--enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg
--enable-libopus --enable-libpulse --enable-libsoxr --enable-libspeex
--enable-libsrt --enable-libssh --enable-libtheora --enable-libv4l2
--enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp
--enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2
--enable-libxvid --enable-nvdec --enable-nvenc --enable-omx --enable-shared
--enable-version3
libavutil 56. 31.100 / 56. 31.100
libavcodec 58. 54.100 / 58. 54.100
libavformat 58. 29.100 / 58. 29.100
libavdevice 58. 8.100 / 58. 8.100
libavfilter 7. 57.100 / 7. 57.100
libswscale 5. 5.100 / 5. 5.100
libswresample 3. 5.100 / 3. 5.100
libpostproc 55. 5.100 / 55. 5.100
Input #0, image2, from '4frame%04d.png':
Duration: 00:00:05.00, start: 0.000000, bitrate: N/A
Stream #0:0: Video: png, rgba(pc), 1920x1080 [SAR 2835:2835 DAR 16:9],
60 fps, 60 tbr, 60 tbn, 60 tbc
Stream mapping:
Stream #0:0 -> #0:0 (png (native) -> vp9 (libvpx-vp9))
Press [q] to stop, [?] for help
[libvpx-vp9 @ 0x555782769d00] v1.8.2
Output #0, webm, to 'spacestinger5b.webm':
Metadata:
encoder : Lavf58.29.100
Stream #0:0: Video: vp9 (libvpx-vp9), yuva420p, 1920x1080 [SAR 1:1 DAR
16:9], q=-1--1, 200 kb/s, 60 fps, 1k tbn, 60 tbc
Metadata:
encoder : Lavc58.54.100 libvpx-vp9
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
frame= 300 fps=1.9 q=0.0 Lsize= 151542kB time=00:00:04.91
bitrate=252426.0kbits/s speed=0.0308x
video:45087kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: 236.109558%
and ffprobe reports:
$ ffprobe spacestinger5b.webm
ffprobe version n4.2.2 Copyright (c) 2007-2019 the FFmpeg developers
built with gcc 9.3.0 (Arch Linux 9.3.0-1)
configuration: --prefix=/usr --disable-debug --disable-static
--disable-stripping --enable-fontconfig --enable-gmp --enable-gnutls
--enable-gpl --enable-ladspa --enable-libaom --enable-libass
--enable-libbluray --enable-libdav1d --enable-libdrm --enable-libfreetype
--enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libjack
--enable-libmfx --enable-libmodplug --enable-libmp3lame
--enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg
--enable-libopus --enable-libpulse --enable-libsoxr --enable-libspeex
--enable-libsrt --enable-libssh --enable-libtheora --enable-libv4l2
--enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp
--enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2
--enable-libxvid --enable-nvdec --enable-nvenc --enable-omx --enable-shared
--enable-version3
libavutil 56. 31.100 / 56. 31.100
libavcodec 58. 54.100 / 58. 54.100
libavformat 58. 29.100 / 58. 29.100
libavdevice 58. 8.100 / 58. 8.100
libavfilter 7. 57.100 / 7. 57.100
libswscale 5. 5.100 / 5. 5.100
libswresample 3. 5.100 / 3. 5.100
libpostproc 55. 5.100 / 55. 5.100
Input #0, matroska,webm, from 'spacestinger5b.webm':
Metadata:
ENCODER : Lavf58.29.100
Duration: 00:00:04.93, start: 0.000000, bitrate: 251607 kb/s
Stream #0:0: Video: vp9 (Profile 0), yuv420p(tv), 1920x1080, lossless,
SAR 1:1 DAR 16:9, 60 fps, 60 tbr, 1k tbn, 1k tbc (default)
Metadata:
alpha_mode : 1
ENCODER : Lavc58.54.100 libvpx-vp9
DURATION : 00:00:04.934000000
CRF 30:
$ ffmpeg -framerate 60 -f image2 -i 4frame%04d.png -c:v libvpx-vp9 -pi
x_fmt yuva420p -an -crf 30 -b:v 0 spacestinger8.webm
ffmpeg version n4.2.2 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 9.3.0 (Arch Linux 9.3.0-1)
configuration: --prefix=/usr --disable-debug --disable-static
--disable-stripping --enable-fontconfig --enable-gmp
--enable-gnutls --enable-gpl --enable-ladspa --enable-libaom
--enable-libass --enable-libbluray --enable-libdav1d -
-enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm
--enable-libiec61883 --enable-libjack --enab
le-libmfx --enable-libmodplug --enable-libmp3lame
--enable-libopencore_amrnb --enable-libopencore_amrwb --enable-lib
openjpeg --enable-libopus --enable-libpulse --enable-libsoxr
--enable-libspeex --enable-libsrt --enable-libssh --ena
ble-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvorbis
--enable-libvpx --enable-libwebp --enable-libx
264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid
--enable-nvdec --enable-nvenc --enable-omx --
enable-shared --enable-version3
libavutil 56. 31.100 / 56. 31.100
libavcodec 58. 54.100 / 58. 54.100
libavformat 58. 29.100 / 58. 29.100
libavdevice 58. 8.100 / 58. 8.100
libavfilter 7. 57.100 / 7. 57.100
libswscale 5. 5.100 / 5. 5.100
libswresample 3. 5.100 / 3. 5.100
libpostproc 55. 5.100 / 55. 5.100
Input #0, image2, from '4frame%04d.png':
Duration: 00:00:05.00, start: 0.000000, bitrate: N/A
Stream #0:0: Video: png, rgba(pc), 1920x1080 [SAR 2835:2835 DAR 16:9],
60 fps, 60 tbr, 60 tbn, 60 tbc
Stream mapping:
Stream #0:0 -> #0:0 (png (native) -> vp9 (libvpx-vp9))
Press [q] to stop, [?] for help
[libvpx-vp9 @ 0x56298095a7c0] v1.8.2
Output #0, webm, to 'spacestinger8.webm':
Metadata:
encoder : Lavf58.29.100
Stream #0:0: Video: vp9 (libvpx-vp9), yuva420p, 1920x1080 [SAR 1:1 DAR
16:9], q=-1--1, 60 fps, 1k tbn, 60 tbc
Metadata:
encoder : Lavc58.54.100 libvpx-vp9
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
frame= 300 fps=0.8 q=0.0 Lsize= 36659kB time=00:00:04.93
bitrate=60864.8kbits/s speed=0.0132x
video:1012kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: 3521.110596%
$ ffprobe spacestinger8.webm
ffprobe version n4.2.2 Copyright (c) 2007-2019 the FFmpeg developers
built with gcc 9.3.0 (Arch Linux 9.3.0-1)
configuration: --prefix=/usr --disable-debug --disable-static
--disable-stripping --enable-fontconfig --enable-gmp --enable-gnutls
--enable-gpl --enable-ladspa --enable-libaom --enable-libass
--enable-libbluray --enable-libdav1d --enable-libdrm --enable-libfreetype
--enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libjack
--enable-libmfx --enable-libmodplug --enable-libmp3lame
--enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg
--enable-libopus --enable-libpulse --enable-libsoxr --enable-libspeex
--enable-libsrt --enable-libssh --enable-libtheora --enable-libv4l2
--enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp
--enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2
--enable-libxvid --enable-nvdec --enable-nvenc --enable-omx --enable-shared
--enable-version3
libavutil 56. 31.100 / 56. 31.100
libavcodec 58. 54.100 / 58. 54.100
libavformat 58. 29.100 / 58. 29.100
libavdevice 58. 8.100 / 58. 8.100
libavfilter 7. 57.100 / 7. 57.100
libswscale 5. 5.100 / 5. 5.100
libswresample 3. 5.100 / 3. 5.100
libpostproc 55. 5.100 / 55. 5.100
Input #0, matroska,webm, from 'spacestinger8.webm':
Metadata:
ENCODER : Lavf58.29.100
Duration: 00:00:04.95, start: 0.000000, bitrate: 60668 kb/s
Stream #0:0: Video: vp9 (Profile 0), yuv420p(tv), 1920x1080, SAR 1:1
DAR 16:9, 60 fps, 60 tbr, 1k tbn, 1k tbc (default)
Metadata:
alpha_mode : 1
ENCODER : Lavc58.54.100 libvpx-vp9
DURATION : 00:00:04.950000000
No CRF/bitrate specified:
$ ffmpeg -framerate 60 -f image2 -i 4frame%04d.png -c:v libvpx-vp9 -
pix_fmt yuva420p -an spacestinger7.webm
ffmpeg version n4.2.2 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 9.3.0 (Arch Linux 9.3.0-1)
configuration: --prefix=/usr --disable-debug --disable-static
--disable-stripping --enable-fontconfig --enable-gmp
--enable-gnutls --enable-gpl --enable-ladspa --enable-libaom
--enable-libass --enable-libbluray --enable-libdav1d -
-enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm
--enable-libiec61883 --enable-libjack --enab
le-libmfx --enable-libmodplug --enable-libmp3lame
--enable-libopencore_amrnb --enable-libopencore_amrwb --enable-lib
openjpeg --enable-libopus --enable-libpulse --enable-libsoxr
--enable-libspeex --enable-libsrt --enable-libssh --ena
ble-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvorbis
--enable-libvpx --enable-libwebp --enable-libx
264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid
--enable-nvdec --enable-nvenc --enable-omx --
enable-shared --enable-version3
libavutil 56. 31.100 / 56. 31.100
libavcodec 58. 54.100 / 58. 54.100
libavformat 58. 29.100 / 58. 29.100
libavdevice 58. 8.100 / 58. 8.100
libavfilter 7. 57.100 / 7. 57.100
libswscale 5. 5.100 / 5. 5.100
libswresample 3. 5.100 / 3. 5.100
libpostproc 55. 5.100 / 55. 5.100
Input #0, image2, from '4frame%04d.png':
Duration: 00:00:05.00, start: 0.000000, bitrate: N/A
Stream #0:0: Video: png, rgba(pc), 1920x1080 [SAR 2835:2835 DAR 16:9],
60 fps, 60 tbr, 60 tbn, 60 tbc
Stream mapping:
Stream #0:0 -> #0:0 (png (native) -> vp9 (libvpx-vp9))
Press [q] to stop, [?] for help
[libvpx-vp9 @ 0x558fa8e7dcc0] v1.8.2
Output #0, webm, to 'spacestinger7.webm':
Metadata:
encoder : Lavf58.29.100
Stream #0:0: Video: vp9 (libvpx-vp9), yuva420p, 1920x1080 [SAR 1:1 DAR
16:9], q=-1--1, 200 kb/s, 60 fps, 1k tbn,
60 tbc
Metadata:
encoder : Lavc58.54.100 libvpx-vp9
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
frame= 300 fps=3.1 q=0.0 Lsize= 281kB time=00:00:04.98 bitrate=
461.3kbits/s speed=0.0507x
video:154kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: 81.890671%
$ ffprobe spacestinger7.webm
ffprobe version n4.2.2 Copyright (c) 2007-2019 the FFmpeg developers
built with gcc 9.3.0 (Arch Linux 9.3.0-1)
configuration: --prefix=/usr --disable-debug --disable-static
--disable-stripping --enable-fontconfig --enable-gmp
--enable-gnutls --enable-gpl --enable-ladspa --enable-libaom
--enable-libass --enable-libbluray --enable-libdav1d -
-enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm
--enable-libiec61883 --enable-libjack --enab
le-libmfx --enable-libmodplug --enable-libmp3lame
--enable-libopencore_amrnb --enable-libopencore_amrwb --enable-lib
openjpeg --enable-libopus --enable-libpulse --enable-libsoxr
--enable-libspeex --enable-libsrt --enable-libssh --ena
ble-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvorbis
--enable-libvpx --enable-libwebp --enable-libx
264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid
--enable-nvdec --enable-nvenc --enable-omx --
enable-shared --enable-version3
libavutil 56. 31.100 / 56. 31.100
libavcodec 58. 54.100 / 58. 54.100
libavformat 58. 29.100 / 58. 29.100
libavdevice 58. 8.100 / 58. 8.100
libavfilter 7. 57.100 / 7. 57.100
libswscale 5. 5.100 / 5. 5.100
libswresample 3. 5.100 / 3. 5.100
libpostproc 55. 5.100 / 55. 5.100
Input #0, matroska,webm, from 'spacestinger7.webm':
Metadata:
ENCODER : Lavf58.29.100
Duration: 00:00:05.00, start: 0.000000, bitrate: 459 kb/s
Stream #0:0: Video: vp9 (Profile 0), yuv420p(tv), 1920x1080, SAR 1:1
DAR 16:9, 60 fps, 60 tbr, 1k tbn, 1k tbc (d
efault)
Metadata:
alpha_mode : 1
ENCODER : Lavc58.54.100 libvpx-vp9
DURATION : 00:00:05.000000000
More information about the ffmpeg-user
mailing list