[FFmpeg-user] Same number of frames dropped and duplicated; What does that mean?

frhun frobihun at gmail.com
Sun Oct 29 17:20:32 EET 2023


hello

I used this setting for youtube stream, but the attached link has the 
code for a plain video file, it might work for you too


< 
https://community.antmedia.io/topic/1532-youtube-saying-please-use-a-keyframe-frequency-of-four-seconds-or-less/ 
 >

the setup is:
ffmpeg -i input.mp4 -qscale 0 -g 2 outputFile.mp4

I use this option : -qscale 0 -g 2
must be written strictly before the output


R.

2023. 10. 29. 15:29 keltezéssel, Ulf Zibis írta:
> Hi,
> 
> so 18.3 % of the frames were dropped and duplicated at same time.
> 
> Does that mean, that 8063 frames of the input were dropped and then same 
> (or other) 8064 frames were duplicated to the output?
> 
> What is the sense of this?
> 
> Maybe the original didn't have the exact framerate of 25 fps ?
> 
> Would it make sense to find the original frame rate and set the output 
> frame rate to that value to avoid the duplicates?
> 
> 
> ffmpeg -i Raik\ Garve\ -\ Sinn\ des\ Lebens\ -\ Berufung\ -\ Aufgabe\ 
> der\ Deutschen.mp4 -vf scale=iw/2:ih/2 -c:v libx265 -c:a libopus 
> -movflags +faststart Raik\ Garve\ -\ Sinn\ des\ Lebens\ -\ Berufung\ -\ 
> Aufgabe\ der\ Deutschen_265.mp4
> ffmpeg version 6.0-0ubuntu1~22.04.sav3.1 Copyright (c) 2000-2023 the 
> FFmpeg developers
>    built with gcc 11 (Ubuntu 11.4.0-1ubuntu1~22.04)
>    configuration: --prefix=/usr --extra-version='0ubuntu1~22.04.sav3.1' 
> --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu 
> --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl 
> --disable-stripping --enable-amf --enable-gnutls --enable-ladspa 
> --enable-lcms2 --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-libgme --enable-libgsm 
> --enable-libjack --enable-libmp3lame --enable-libmysofa 
> --enable-libopenjpeg --enable-libopenmpt --enable-libopus 
> --enable-libpulse --enable-librabbitmq --enable-librubberband 
> --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex 
> --enable-libsrt --enable-libssh --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 
> --enable-sndio --enable-pocketsphinx --enable-librsvg --enable-avisynth 
> --enable-libilbc --enable-libjxl --enable-librist --enable-vapoursynth 
> --enable-libvmaf --enable-crystalhd --enable-libmfx --enable-libsvthevc 
> --enable-libsvtav1 --enable-libdc1394 --enable-libdrm 
> --enable-libiec61883 --enable-chromaprint --enable-frei0r 
> --enable-libx264 --enable-libplacebo --enable-librav1e --enable-shared
>    WARNING: library configuration mismatch
>    avcodec     configuration: --prefix=/usr 
> --extra-version='0ubuntu1~22.04.sav3.1' --toolchain=hardened 
> --libdir=/usr/lib/x86_64-linux-gnu 
> --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl 
> --disable-stripping --enable-amf --enable-gnutls --enable-ladspa 
> --enable-lcms2 --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-libgme --enable-libgsm 
> --enable-libjack --enable-libmp3lame --enable-libmysofa 
> --enable-libopenjpeg --enable-libopenmpt --enable-libopus 
> --enable-libpulse --enable-librabbitmq --enable-librubberband 
> --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex 
> --enable-libsrt --enable-libssh --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 
> --enable-sndio --enable-pocketsphinx --enable-librsvg --enable-avisynth 
> --enable-libilbc --enable-libjxl --enable-librist --enable-vapoursynth 
> --enable-libvmaf --enable-crystalhd --enable-libmfx --enable-libsvthevc 
> --enable-libsvtav1 --enable-libdc1394 --enable-libdrm 
> --enable-libiec61883 --enable-chromaprint --enable-frei0r 
> --enable-libx264 --enable-libplacebo --enable-librav1e --enable-shared 
> --enable-version3 --disable-doc --disable-programs --enable-libaribb24 
> --enable-libopencore_amrnb --enable-libopencore_amrwb 
> --enable-libtesseract --enable-libvo_amrwbenc --enable-libshaderc 
> --enable-liblensfun --enable-libsmbclient
>    avfilter    configuration: --prefix=/usr 
> --extra-version='0ubuntu1~22.04.sav3.1' --toolchain=hardened 
> --libdir=/usr/lib/x86_64-linux-gnu 
> --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl 
> --disable-stripping --enable-amf --enable-gnutls --enable-ladspa 
> --enable-lcms2 --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-libgme --enable-libgsm 
> --enable-libjack --enable-libmp3lame --enable-libmysofa 
> --enable-libopenjpeg --enable-libopenmpt --enable-libopus 
> --enable-libpulse --enable-librabbitmq --enable-librubberband 
> --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex 
> --enable-libsrt --enable-libssh --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 
> --enable-sndio --enable-pocketsphinx --enable-librsvg --enable-avisynth 
> --enable-libilbc --enable-libjxl --enable-librist --enable-vapoursynth 
> --enable-libvmaf --enable-crystalhd --enable-libmfx --enable-libsvthevc 
> --enable-libsvtav1 --enable-libdc1394 --enable-libdrm 
> --enable-libiec61883 --enable-chromaprint --enable-frei0r 
> --enable-libx264 --enable-libplacebo --enable-librav1e --enable-shared 
> --enable-version3 --disable-doc --disable-programs --enable-libaribb24 
> --enable-libopencore_amrnb --enable-libopencore_amrwb 
> --enable-libtesseract --enable-libvo_amrwbenc --enable-libshaderc 
> --enable-liblensfun --enable-libsmbclient
>    libavutil      58.  2.100 / 58.  2.100
>    libavcodec     60.  3.100 / 60.  3.100
>    libavformat    60.  3.100 / 60.  3.100
>    libavdevice    60.  1.100 / 60.  1.100
>    libavfilter     9.  3.100 /  9.  3.100
>    libswscale      7.  1.100 /  7.  1.100
>    libswresample   4. 10.100 /  4. 10.100
>    libpostproc    57.  1.100 / 57.  1.100
> Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Raik Garve - Sinn des Lebens - 
> Berufung - Aufgabe der Deutschen.mp4':
>    Metadata:
>      major_brand     : isom
>      minor_version   : 512
>      compatible_brands: isomiso2avc1mp41
>    Duration: 01:38:24.98, start: 0.000000, bitrate: 1377 kb/s
>    Stream #0:0[0x1](und): Video: h264 (Main) (avc1 / 0x31637661), 
> yuv420p(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], 1134 kb/s, 
> 25 fps, 300 tbr, 90k tbn (default)
>      Metadata:
>        handler_name    : VideoHandler
>        vendor_id       : [0][0][0][0]
>    Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 
> stereo, fltp, 233 kb/s (default)
>      Metadata:
>        handler_name    : VideoHandler
>        vendor_id       : [0][0][0][0]
> Stream mapping:
>    Stream #0:0 -> #0:0 (h264 (native) -> hevc (libx265))
>    Stream #0:1 -> #0:1 (aac (native) -> opus (libopus))
> Press [q] to stop, [?] for help
> [libopus @ 0x5592096a2540] No bit rate set. Defaulting to 96000 bps.
> x265 [info]: HEVC encoder version 3.5+1-f0c1022b6
> x265 [info]: build info [Linux][GCC 11.2.0][64 bit] 8bit+10bit+12bit
> x265 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.1 Cache64
> x265 [info]: Main profile, Level-2.1 (Main tier)
> x265 [info]: Thread pool created using 2 threads
> x265 [info]: Slices                              : 1
> x265 [info]: frame threads / pool features       : 1 / wpp(6 rows)
> x265 [warning]: Source height < 720p; disabling lookahead-slices
> x265 [info]: Coding QT: max CU size, min CU size : 64 / 8
> x265 [info]: Residual QT: max TU size, max depth : 32 / 1 inter / 1 intra
> x265 [info]: ME / range / subpel / merge         : hex / 57 / 2 / 3
> x265 [info]: Keyframe min / max / scenecut / bias  : 24 / 250 / 40 / 5.00
> x265 [info]: Lookahead / bframes / badapt        : 20 / 4 / 2
> x265 [info]: b-pyramid / weightp / weightb       : 1 / 1 / 0
> x265 [info]: References / ref-limit  cu / depth  : 3 / off / on
> x265 [info]: AQ: mode / str / qg-size / cu-tree  : 2 / 1.0 / 32 / 1
> x265 [info]: Rate Control / qCompress            : CRF-28.0 / 0.60
> x265 [info]: tools: rd=3 psy-rd=2.00 early-skip rskip mode=1 signhide tmvp
> x265 [info]: tools: b-intra strong-intra-smoothing deblock sao
> Output #0, mp4, to 'Raik Garve - Sinn des Lebens - Berufung - Aufgabe 
> der Deutschen_265.mp4':
>    Metadata:
>      major_brand     : isom
>      minor_version   : 512
>      compatible_brands: isomiso2avc1mp41
>      encoder         : Lavf60.3.100
>    Stream #0:0(und): Video: hevc (hev1 / 0x31766568), yuv420p(tv, bt709, 
> progressive), 640x360 [SAR 1:1 DAR 16:9], q=2-31, 25 fps, 14762200.00 
> tbn (default)
>      Metadata:
>        handler_name    : VideoHandler
>        vendor_id       : [0][0][0][0]
>        encoder         : Lavc60.3.100 libx265
>      Side data:
>        cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
>    Stream #0:1(und): Audio: opus (Opus / 0x7375704F), 48000 Hz, stereo, 
> flt, 96 kb/s (default)
>      Metadata:
>        handler_name    : VideoHandler
>        vendor_id       : [0][0][0][0]
>        encoder         : Lavc60.3.100 libopus
> [vost#0:0/libx265 @ 0x5592095da1c0] More than 1000 frames duplicated 
> 152.3kbits/s dup=1000 drop=997 speed=1.21x
> Starting second pass: moving the moov atom to the beginning of the file
> frame=147620 fps= 29 q=36.0 Lsize=  117163kB time=01:38:24.97 bitrate= 
> 162.5kbits/s dup=8064 drop=8063 speed=1.15x
> video:52009kB audio:61035kB subtitle:0kB other streams:0kB global 
> headers:2kB muxing overhead: 3.644031%
> x265 [info]: frame I:    593, Avg QP:24.72  kb/s: 5707.20
> x265 [info]: frame P:  36702, Avg QP:29.79  kb/s: 153.03
> x265 [info]: frame B: 110325, Avg QP:35.62  kb/s: 13.89
> x265 [info]: Weighted P-Frames: Y:0.1% UV:0.0%
> x265 [info]: consecutive B-frames: 1.9% 6.0% 9.4% 59.4% 23.2%
> 
> encoded 147620 frames in 5117.43s (28.85 fps), 71.35 kb/s, Avg QP:34.13
> 
> $ ffprobe -hide_banner -select_streams v:0 -count_frames -show_entries 
> stream=nb_read_frames Raik\ Garve\ -\ Sinn\ des\ Lebens\ -\ Berufung\ -\ 
> Aufgabe\ der\ Deutschen.mp4
> Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Raik Garve - Sinn des Lebens - 
> Berufung - Aufgabe der Deutschen.mp4':
>    Metadata:
>      major_brand     : isom
>      minor_version   : 512
>      compatible_brands: isomiso2avc1mp41
>    Duration: 01:38:24.98, start: 0.000000, bitrate: 1377 kb/s
>    Stream #0:0[0x1](und): Video: h264 (Main) (avc1 / 0x31637661), 
> yuv420p(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], 1134 kb/s, 
> 25 fps, 300 tbr, 90k tbn (default)
>      Metadata:
>        handler_name    : VideoHandler
>        vendor_id       : [0][0][0][0]
>    Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 
> stereo, fltp, 233 kb/s (default)
>      Metadata:
>        handler_name    : VideoHandler
>        vendor_id       : [0][0][0][0]
> [STREAM]
> nb_read_frames=147619
> [/STREAM]
> 
> -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