[FFmpeg-user] "More than 1000 frames duplicated" when converting JPGs to video

Eduard B war4peace at gmail.com
Sun Jun 27 09:13:31 EEST 2021


Hi list,

I am using ffmpeg to convert a large set of timelapse still frames (JPGs)
captured by my surveillance camera to a video. Using x265 library to make
the file smaller. The particular batch I have tested has 14401 JPG files in
a folder (one image captured every 6 seconds).

Command is:
ffmpeg -i /mnt/user/cctv/mjwVb9pFuK/8sHGyfFGu6_timelapse/$(date -d "-1
days" '+%Y-%m-%d')/%06d.jpg -c:v libx265 -preset medium -crf 20 -r 30 -c:a
aac -b:a 128k /mnt/user/cctv/mjwVb9pFuK/8sHGyfFGu6_timelapse/$(date -d "-1
days" '+%Y-%m-%d')_x265_correct.mp4

I wanted to convert to a 30 FPS video, the command I have been using, which
works, converts the files to a video, however it complains about duplicate
frames. While investigating, I have realized the final duplicate frames
count has 2880 frames, which is 1/5 of the total amount of still images.
Seems to me that the encoder assumes the input is recorded at 25 FPS and
tries to convert it to a video which has the same length, but with 30 FPS.
However, the input is a series of still images with no frame rate.

I have changed the command to a similar one, using 25 FPS frame rate
parameter value instead, and the complaint about duplicate frames is gone.
This means I would need to explicitly tell the encoder the input is using
30 FPS, rather than the default assumption of 25. I have been looking at
the "--fps" option, however documentation says "YUV only", I'm not sure
it's applicable.

Help would be greatly appreciated!


Full command and output below:

ffmpeg -i /mnt/user/cctv/mjwVb9pFuK/8sHGyfFGu6_timelapse/$(date -d "-1
days" '+%Y-%m-%d')/%06d.jpg -c:v libx265 -preset medium -crf 20 -r 30 -c:a
aac -b:a 128k /mnt/user/cctv/mjwVb9pFuK/8sHGyfFGu6_timelapse/$(date -d "-1
days" '+%Y-%m-%d')_x265_correct.mp4
ffmpeg version N-57736-ga501d55905-static https://johnvansickle.com/ffmpeg/
 Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 8 (Debian 8.3.0-6)
  configuration: --enable-gpl --enable-version3 --enable-static
--disable-debug --disable-ffplay --disable-indev=sndio
--disable-outdev=sndio --cc=gcc --enable-fontconfig --enable-frei0r
--enable-gnutls --enable-gmp --enable-libgme --enable-gray --enable-libaom
--enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype
--enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb
--enable-libopenjpeg --enable-librubberband --enable-libsoxr
--enable-libspeex --enable-libsrt --enable-libvorbis --enable-libopus
--enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc
--enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265
--enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzvbi
--enable-libzimg
  libavutil      57.  0.100 / 57.  0.100
  libavcodec     59.  1.101 / 59.  1.101
  libavformat    59.  3.100 / 59.  3.100
  libavdevice    59.  0.100 / 59.  0.100
  libavfilter     8.  0.102 /  8.  0.102
  libswscale      6.  0.100 /  6.  0.100
  libswresample   4.  0.100 /  4.  0.100
  libpostproc    56.  0.100 / 56.  0.100
Input #0, image2, from
'/mnt/user/cctv/mjwVb9pFuK/8sHGyfFGu6_timelapse/2021-06-26/%06d.jpg':
  Duration: 00:09:36.00, start: 0.000000, bitrate: N/A
  Stream #0:0: Video: mjpeg (Baseline), yuvj420p(pc,
bt470bg/unknown/unknown), 1920x1080, 25 fps, 25 tbr, 25 tbn
Codec AVOption b (set bitrate (in bits/s)) specified for output file #0
(/mnt/user/cctv/mjwVb9pFuK/8sHGyfFGu6_timelapse/2021-06-26_x265_correct.mp4)
has not been used for any stream. The most likely reason is either wrong
type (e.g. a video option with no video streams) or that it is a private
option of some encoder which was not actually used for any stream.
Stream mapping:
  Stream #0:0 -> #0:0 (mjpeg (native) -> hevc (libx265))
Press [q] to stop, [?] for help
x265 [info]: HEVC encoder version 3.5+1-f0c1022b6
x265 [info]: build info [Linux][GCC 8.3.0][64 bit] 8bit+10bit+12bit
x265 [info]: using cpu capabilities: MMX2 SSE2Fast LZCNT SSSE3 SSE4.2 AVX
FMA3 BMI2 AVX2
x265 [info]: Main profile, Level-4 (Main tier)
x265 [info]: Thread pool created using 8 threads
x265 [info]: Slices                              : 1
x265 [info]: frame threads / pool features       : 3 / wpp(17 rows)
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  : 25 / 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-20.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 lslices=6 deblock sao
Output #0, mp4, to
'/mnt/user/cctv/mjwVb9pFuK/8sHGyfFGu6_timelapse/2021-06-26_x265_correct.mp4':
  Metadata:
    encoder         : Lavf59.3.100
  Stream #0:0: Video: hevc (hev1 / 0x31766568), yuvj420p(pc,
bt470bg/unknown/unknown, progressive), 1920x1080, q=2-31, 30 fps, 15360 tbn
    Metadata:
      encoder         : Lavc59.1.101 libx265
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
More than 1000 frames duplicated  476672kB time=00:03:18.96
bitrate=19625.9kbits/s dup=1000 drop=0 speed=0.319x
frame=17280 fps=8.3 q=27.9 Lsize= 1870773kB time=00:09:35.90
bitrate=26611.2kbits/s dup=2880 drop=0 speed=0.275x
video:1870546kB audio:0kB subtitle:0kB other streams:0kB global headers:2kB
muxing overhead: 0.012128%
x265 [info]: frame I:     71, Avg QP:19.38  kb/s: 102281.23
x265 [info]: frame P:   5157, Avg QP:21.07  kb/s: 42347.25
x265 [info]: frame B:  12052, Avg QP:27.07  kb/s: 19419.35
x265 [info]: Weighted P-Frames: Y:9.2% UV:5.1%
x265 [info]: consecutive B-frames: 38.4% 0.7% 2.3% 9.2% 49.4%

encoded 17280 frames in 2091.15s (8.26 fps), 26602.36 kb/s, Avg QP:25.25



Virus-free. www.avg.com
<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#m_-2168814557045894416_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>


More information about the ffmpeg-user mailing list