[FFmpeg-user] Unexpected additional frames while stream copy
Ferdi Scholten
ferdi at sttc-nlp.nl
Mon Oct 2 00:25:22 EEST 2023
On 01-10-2023 19:28, Ulf Zibis wrote:
> Hi,
>
> I have a video, grabbed from screen with "-c:v libx264rgb -crf 0
> -preset ultrafast".
>
> When I re-encode a small scene out of it, it counts 576 frames. (Same
> number of images, when I extract all frames as JPEG.)
>
> But when I just do a stream copy, I get 761 frames, even when I use
> "-fps_mode:v passthrough", which should be superfluous.
>
> Can one explain this miracle?
Stream copying can only cut on key-frames as far as I know. That might
be your difference?
>
>
> $ ffmpeg -ss 1:24:43 -t 50 -i roh_de.mkv -fps_mode:v passthrough -c:v
> libx264rgb -crf 0 -preset veryslow -c:a copy roh_de_slow.mkv
> ffmpeg version 5.1.1-1ubuntu2.1 Copyright (c) 2000-2022 the FFmpeg
> developers
> built with gcc 12 (Ubuntu 12.2.0-3ubuntu1)
> configuration: --prefix=/usr --extra-version=1ubuntu2.1
> --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu
> --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl
> --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom
> --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca
> --enable-libcdio --enable-libcodec2 --enable-libdav1d
> --enable-libflite --enable-libfontconfig --enable-libfreetype
> --enable-libfribidi --enable-libglslang --enable-libgme
> --enable-libgsm --enable-libjack --enable-libmp3lame
> --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt
> --enable-libopus --enable-libpulse --enable-librabbitmq
> --enable-librist --enable-librubberband --enable-libshine
> --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt
> --enable-libssh --enable-libsvtav1 --enable-libtheora
> --enable-libtwolame --enable-libvidstab --enable-libvorbis
> --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2
> --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi
> --enable-lv2 --enable-omx --enable-openal --enable-opencl
> --enable-opengl --enable-sdl2 --disable-sndio --enable-pocketsphinx
> --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm
> --enable-libiec61883 --enable-chromaprint --enable-frei0r
> --enable-libx264 --enable-libplacebo --enable-shared
> libavutil 57. 28.100 / 57. 28.100
> libavcodec 59. 37.100 / 59. 37.100
> libavformat 59. 27.100 / 59. 27.100
> libavdevice 59. 7.100 / 59. 7.100
> libavfilter 8. 44.100 / 8. 44.100
> libswscale 6. 7.100 / 6. 7.100
> libswresample 4. 7.100 / 4. 7.100
> libpostproc 56. 6.100 / 56. 6.100
> Input #0, matroska,webm, from 'roh_de.mkv':
> Metadata:
> ENCODER : Lavf59.27.100
> Duration: 02:34:59.82, start: 0.000000, bitrate: 80644 kb/s
> Stream #0:0: Video: h264 (High 4:4:4 Predictive), gbrp(pc,
> gbr/unknown/unknown, progressive), 1680x888 [SAR 1:1 DAR 70:37], 25
> fps, 25 tbr, 1k tbn
> Metadata:
> DURATION : 02:34:59,760000000
> Stream #0:1: Audio: aac (LC), 48000 Hz, stereo, fltp
> Metadata:
> DURATION : 02:34:59,818000000
> Stream mapping:
> Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264rgb))
> Stream #0:1 -> #0:1 (copy)
> Press [q] to stop, [?] for help
> [libx264rgb @ 0x558efa1dde80] using SAR=1/1
> [libx264rgb @ 0x558efa1dde80] using cpu capabilities: MMX2 SSE2Fast
> SSSE3 SSE4.1 Cache64
> [libx264rgb @ 0x558efa1dde80] profile High 4:4:4 Predictive, level
> 5.0, 4:4:4, 8-bit
> [libx264rgb @ 0x558efa1dde80] 264 - core 164 r3095 baee400 -
> H.264/MPEG-4 AVC codec - Copyleft 2003-2022 -
> http://www.videolan.org/x264.html - options: cabac=1 ref=16
> deblock=1:0:0 analyse=0x3:0x133 me=umh subme=9 psy=0 mixed_ref=1
> me_range=24 chroma_me=1 trellis=0 8x8dct=1 cqm=0 deadzone=21,11
> fast_pskip=0 chroma_qp_offset=0 threads=3 lookahead_threads=1
> sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0
> constrained_intra=0 bframes=0 weightp=2 keyint=250 keyint_min=25
> scenecut=40 intra_refresh=0 rc=cqp mbtree=0 qp=0
> Output #0, matroska, to 'roh_de_slow.mkv':
> Metadata:
> encoder : Lavf59.27.100
> Stream #0:0: Video: h264 (H264 / 0x34363248), rgb24(pc,
> gbr/unknown/unknown, progressive), 1680x888 [SAR 1:1 DAR 70:37],
> q=2-31, 25 fps, 1k tbn
> Metadata:
> DURATION : 02:34:59,760000000
> encoder : Lavc59.37.100 libx264rgb
> Side data:
> cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
> Stream #0:1: Audio: aac (LC) ([255][0][0][0] / 0x00FF), 48000 Hz,
> stereo, fltp
> Metadata:
> DURATION : 02:34:59,818000000
> frame= 576 fps=0.7 q=-1.0 Lsize= 620554kB time=00:00:50.01
> bitrate=101645.2kbits/s speed=0.064x
> video:619584kB audio:944kB subtitle:0kB other streams:0kB global
> headers:0kB muxing overhead: 0.004287%
> [libx264rgb @ 0x558efa1dde80] frame I:48 Avg QP: 0.00 size:899822
> [libx264rgb @ 0x558efa1dde80] frame P:528 Avg QP: 0.00 size:1119814
> [libx264rgb @ 0x558efa1dde80] mb I I16..4..PCM: 46.5% 17.4% 36.1% 0.0%
> [libx264rgb @ 0x558efa1dde80] mb P I16..4..PCM: 25.9% 10.3% 23.3%
> 0.0% P16..4: 7.4% 2.3% 10.1% 5.7% 8.7% skip: 6.4%
> [libx264rgb @ 0x558efa1dde80] 8x8 transform intra:17.4% inter:16.2%
> [libx264rgb @ 0x558efa1dde80] coded y,u,v intra: 88.7% 84.4% 90.1%
> inter: 80.2% 79.4% 80.7%
> [libx264rgb @ 0x558efa1dde80] i16 v,h,dc,p: 47% 53% 0% 0%
> [libx264rgb @ 0x558efa1dde80] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 49% 47%
> 2% 0% 1% 0% 0% 0% 0%
> [libx264rgb @ 0x558efa1dde80] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 42% 44%
> 1% 2% 3% 3% 3% 2% 1%
> [libx264rgb @ 0x558efa1dde80] Weighted P-Frames: Y:66.1% UV:64.6%
> [libx264rgb @ 0x558efa1dde80] ref P L0: 41.8% 5.3% 9.1% 14.8% 7.2%
> 6.2% 3.8% 2.9% 1.8% 1.9% 1.3% 1.2% 0.6% 1.1% 0.5% 0.4%
> [libx264rgb @ 0x558efa1dde80] kb/s:101512.49
>
>
> $ ffmpeg -ss 1:24:43 -t 50 -i roh_de.mkv -c copy -fps_mode:v
> passthrough roh_de_fast.mkv
> ffmpeg version 5.1.1-1ubuntu2.1 Copyright (c) 2000-2022 the FFmpeg
> developers
> built with gcc 12 (Ubuntu 12.2.0-3ubuntu1)
> configuration: --prefix=/usr --extra-version=1ubuntu2.1
> --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu
> --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl
> --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom
> --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca
> --enable-libcdio --enable-libcodec2 --enable-libdav1d
> --enable-libflite --enable-libfontconfig --enable-libfreetype
> --enable-libfribidi --enable-libglslang --enable-libgme
> --enable-libgsm --enable-libjack --enable-libmp3lame
> --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt
> --enable-libopus --enable-libpulse --enable-librabbitmq
> --enable-librist --enable-librubberband --enable-libshine
> --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt
> --enable-libssh --enable-libsvtav1 --enable-libtheora
> --enable-libtwolame --enable-libvidstab --enable-libvorbis
> --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2
> --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi
> --enable-lv2 --enable-omx --enable-openal --enable-opencl
> --enable-opengl --enable-sdl2 --disable-sndio --enable-pocketsphinx
> --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm
> --enable-libiec61883 --enable-chromaprint --enable-frei0r
> --enable-libx264 --enable-libplacebo --enable-shared
> libavutil 57. 28.100 / 57. 28.100
> libavcodec 59. 37.100 / 59. 37.100
> libavformat 59. 27.100 / 59. 27.100
> libavdevice 59. 7.100 / 59. 7.100
> libavfilter 8. 44.100 / 8. 44.100
> libswscale 6. 7.100 / 6. 7.100
> libswresample 4. 7.100 / 4. 7.100
> libpostproc 56. 6.100 / 56. 6.100
> Input #0, matroska,webm, from 'roh_de.mkv':
> Metadata:
> ENCODER : Lavf59.27.100
> Duration: 02:34:59.82, start: 0.000000, bitrate: 80644 kb/s
> Stream #0:0: Video: h264 (High 4:4:4 Predictive), gbrp(pc,
> gbr/unknown/unknown, progressive), 1680x888 [SAR 1:1 DAR 70:37], 25
> fps, 25 tbr, 1k tbn
> Metadata:
> DURATION : 02:34:59,760000000
> Stream #0:1: Audio: aac (LC), 48000 Hz, stereo, fltp
> Metadata:
> DURATION : 02:34:59,818000000
> Output #0, matroska, to 'roh_de_fast.mkv':
> Metadata:
> encoder : Lavf59.27.100
> Stream #0:0: Video: h264 (High 4:4:4 Predictive) (H264 /
> 0x34363248), gbrp(pc, gbr/unknown/unknown, progressive), 1680x888 [SAR
> 1:1 DAR 70:37], q=2-31, 25 fps, 25 tbr, 1k tbn
> Metadata:
> DURATION : 02:34:59,760000000
> Stream #0:1: Audio: aac (LC) ([255][0][0][0] / 0x00FF), 48000 Hz,
> stereo, fltp
> Metadata:
> DURATION : 02:34:59,818000000
> Stream mapping:
> Stream #0:0 -> #0:0 (copy)
> Stream #0:1 -> #0:1 (copy)
> Press [q] to stop, [?] for help
> frame= 761 fps=9.6 q=-1.0 Lsize= 876100kB time=00:00:50.01
> bitrate=143502.8kbits/s speed=0.633x
> video:875127kB audio:944kB subtitle:0kB other streams:0kB global
> headers:0kB muxing overhead: 0.003238%
>
>
> -Ulf
>
>
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
More information about the ffmpeg-user
mailing list