FFmpeg timelapse가 입력 이미지를 덮어씁니다.

FFmpeg timelapse가 입력 이미지를 덮어씁니다.

Python에서 RPI로 타임랩스를 수행하고 있습니다.

이미지를 촬영하여 폴더에 저장하려면: 문제가 없습니다. 하지만 FFMPEG로 비디오를 만들려면 문제가 있습니다.

X 이미지 이후 스크립트는 비디오 생성을 시작합니다. 첫 번째 프레임만 있는 비디오가 생성되고 첫 번째 프레임(?!)으로 폴더의 모든 이미지를 덮어씁니다. 오류 메시지가 없습니다.

그럼 내가 뭘 잘못하고 있는 걸까요?

system('ffmpeg -f image2 -framerate 1 -pattern_type glob -start_number %d -i /media/julien/USBKEY/capture_%d/%d/*.jpg -r 5 -c:v libx264 -pix_fmt yuv420p /media/julien/USBKEY/capture_%s/%d/out%d.mp4 -y' %( nom_premiere_image, nom_dossier, nom_sous_dossier, nom_dossier, nom_sous_dossier, nom_sous_dossier))

쉘로부터의 피드백:

ffmpeg version 4.3.4-0+deb11u1+rpt1 Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 10 (Raspbian 10.2.1-6+rpi1)

  WARNING: library configuration mismatch









  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
Input #0, image2, from '/media/julien/USBKEY/capture_1656104986/1/1656104987.jpg':
  Duration: 00:00:01.00, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 720x640, 1 tbr, 1 tbn, 1 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (mjpeg (native) -> mjpeg (native))
  Stream #0:0 -> #1:0 (mjpeg (native) -> mjpeg (native))
  Stream #0:0 -> #2:0 (mjpeg (native) -> mjpeg (native))
  Stream #0:0 -> #3:0 (mjpeg (native) -> h264 (libx264))
Press [q] to stop, [?] for help
Output #0, image2, to '/media/julien/USBKEY/capture_1656104986/1/1656104988.jpg':
  Metadata:
    encoder         : Lavf58.45.100
    Stream #0:0: Video: mjpeg, yuvj420p(pc), 720x640, q=2-31, 200 kb/s, 1 fps, 1 tbn, 1 tbc
    Metadata:
      encoder         : Lavc58.91.100 mjpeg
    Side data:
      cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: N/A
Output #1, image2, to '/media/julien/USBKEY/capture_1656104986/1/1656104989.jpg':
  Metadata:
    encoder         : Lavf58.45.100
    Stream #1:0: Video: mjpeg, yuvj420p(pc), 720x640, q=2-31, 200 kb/s, 1 fps, 1 tbn, 1 tbc
    Metadata:
      encoder         : Lavc58.91.100 mjpeg
    Side data:
      cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: N/A
Output #2, image2, to '/media/julien/USBKEY/capture_1656104986/1/1656104990.jpg':
  Metadata:
    encoder         : Lavf58.45.100
    Stream #2:0: Video: mjpeg, yuvj420p(pc), 720x640, q=2-31, 200 kb/s, 1 fps, 1 tbn, 1 tbc
    Metadata:
      encoder         : Lavc58.91.100 mjpeg
    Side data:
      cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: N/A
[swscaler @ 0xad3880] deprecated pixel format used, make sure you did set range correctly
[libx264 @ 0x73dbc0] using cpu capabilities: ARMv6 NEON
[libx264 @ 0x73dbc0] profile High, level 3.1, 4:2:0, 8-bit
[libx264 @ 0x73dbc0] 264 - core 160 r3011 cde9a93 - H.264/MPEG-4 AVC codec - Copyleft 2003-2020 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=5 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #3, mp4, to '/media/julien/USBKEY/capture_1656104986/1/out1.mp4':
  Metadata:
    encoder         : Lavf58.45.100
    Stream #3:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 720x640, q=-1--1, 5 fps, 10240 tbn, 5 tbc
    Metadata:
      encoder         : Lavc58.91.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
frame=    1 fps=0.0 q=3.1 q=3.1 q=3.1 q=0.0 size=N/A time=00:00:01.00 bitrate=N/A dup=4 drop=0 speed=1.63x    
frame=    1 fps=0.0 q=3.1 Lq=3.1 q=3.1 q=-1.0 size=N/A time=00:00:01.00 bitrate=N/A dup=4 drop=0 speed=1.08x    
video:85kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
[libx264 @ 0x73dbc0] frame I:1     Avg QP:13.53  size: 29341
[libx264 @ 0x73dbc0] frame P:1     Avg QP:16.26  size:   385
[libx264 @ 0x73dbc0] frame B:3     Avg QP:15.28  size:   147
[libx264 @ 0x73dbc0] consecutive B-frames: 20.0%  0.0%  0.0% 80.0%
[libx264 @ 0x73dbc0] mb I  I16..4:  8.7% 72.9% 18.4%
[libx264 @ 0x73dbc0] mb P  I16..4:  0.0%  0.0%  0.0%  P16..4:  9.1%  0.6%  0.2%  0.0%  0.0%    skip:90.2%
[libx264 @ 0x73dbc0] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8:  3.7%  0.1%  0.0%  direct: 0.0%  skip:96.2%  L0: 9.8% L1:90.2% BI: 0.0%
[libx264 @ 0x73dbc0] 8x8 transform intra:72.9% inter:100.0%
[libx264 @ 0x73dbc0] coded y,uvDC,uvAC intra: 82.5% 71.1% 60.1% inter: 0.7% 0.4% 0.0%
[libx264 @ 0x73dbc0] i16 v,h,dc,p: 48% 12% 18% 22%
[libx264 @ 0x73dbc0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 19%  6% 35%  8%  4%  5%  3% 16%  4%
[libx264 @ 0x73dbc0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 25% 10% 24% 10%  6%  7%  5% 10%  3%
[libx264 @ 0x73dbc0] i8c dc,h,v,p: 56% 14% 19% 11%
[libx264 @ 0x73dbc0] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x73dbc0] ref B L0: 95.0%  5.0%
[libx264 @ 0x73dbc0] ref B L1: 98.4%  1.6%
[libx264 @ 0x73dbc0] kb/s:241.34 

콘솔을 직접 사용하는 경우에도 마찬가지입니다.

julien@raspberrypi:~ $ ffmpeg -f image2 -framerate 1 -pattern_type glob -start_number 1656104991 -i /media/julien/USBKEY/capture_1/1/*.jpg -r 5 -c:v libx264 -pix_fmt yuv420p /media/julien/USBKEY/capture_1/1/out1.mp4 -y
ffmpeg version 4.3.4-0+deb11u1+rpt1 Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 10 (Raspbian 10.2.1-6+rpi1)
  configuration: --prefix=/usr --extra-version=0+deb11u1+rpt1 --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --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-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg --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-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-mmal --enable-neon --enable-rpi --enable-v4l2-request --enable-libudev --enable-epoxy --enable-pocketsphinx --enable-libdc1394 --enable-libdrm --enable-vout-drm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared --libdir=/usr/lib/arm-linux-gnueabihf --cpu=arm1176jzf-s --arch=arm
  WARNING: library configuration mismatch
  avutil      configuration: --prefix=/usr --extra-version=0+deb11u1+rpt1 --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --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-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg --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-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-mmal --enable-neon --enable-rpi --enable-v4l2-request --enable-libudev --enable-epoxy --enable-pocketsphinx --enable-libdc1394 --enable-libdrm --enable-vout-drm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --libdir=/usr/lib/arm-linux-gnueabihf/neon/vfp --cpu=cortex-a7 --arch=armv6t2 --disable-thumb --enable-shared --disable-doc --disable-programs
  avcodec     configuration: --prefix=/usr --extra-version=0+deb11u1+rpt1 --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --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-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg --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-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-mmal --enable-neon --enable-rpi --enable-v4l2-request --enable-libudev --enable-epoxy --enable-pocketsphinx --enable-libdc1394 --enable-libdrm --enable-vout-drm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --libdir=/usr/lib/arm-linux-gnueabihf/neon/vfp --cpu=cortex-a7 --arch=armv6t2 --disable-thumb --enable-shared --disable-doc --disable-programs
  avformat    configuration: --prefix=/usr --extra-version=0+deb11u1+rpt1 --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --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-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg --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-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-mmal --enable-neon --enable-rpi --enable-v4l2-request --enable-libudev --enable-epoxy --enable-pocketsphinx --enable-libdc1394 --enable-libdrm --enable-vout-drm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --libdir=/usr/lib/arm-linux-gnueabihf/neon/vfp --cpu=cortex-a7 --arch=armv6t2 --disable-thumb --enable-shared --disable-doc --disable-programs
  avdevice    configuration: --prefix=/usr --extra-version=0+deb11u1+rpt1 --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --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-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg --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-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-mmal --enable-neon --enable-rpi --enable-v4l2-request --enable-libudev --enable-epoxy --enable-pocketsphinx --enable-libdc1394 --enable-libdrm --enable-vout-drm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --libdir=/usr/lib/arm-linux-gnueabihf/neon/vfp --cpu=cortex-a7 --arch=armv6t2 --disable-thumb --enable-shared --disable-doc --disable-programs
  avfilter    configuration: --prefix=/usr --extra-version=0+deb11u1+rpt1 --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --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-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg --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-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-mmal --enable-neon --enable-rpi --enable-v4l2-request --enable-libudev --enable-epoxy --enable-pocketsphinx --enable-libdc1394 --enable-libdrm --enable-vout-drm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --libdir=/usr/lib/arm-linux-gnueabihf/neon/vfp --cpu=cortex-a7 --arch=armv6t2 --disable-thumb --enable-shared --disable-doc --disable-programs
  avresample  configuration: --prefix=/usr --extra-version=0+deb11u1+rpt1 --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --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-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg --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-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-mmal --enable-neon --enable-rpi --enable-v4l2-request --enable-libudev --enable-epoxy --enable-pocketsphinx --enable-libdc1394 --enable-libdrm --enable-vout-drm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --libdir=/usr/lib/arm-linux-gnueabihf/neon/vfp --cpu=cortex-a7 --arch=armv6t2 --disable-thumb --enable-shared --disable-doc --disable-programs
  swscale     configuration: --prefix=/usr --extra-version=0+deb11u1+rpt1 --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --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-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg --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-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-mmal --enable-neon --enable-rpi --enable-v4l2-request --enable-libudev --enable-epoxy --enable-pocketsphinx --enable-libdc1394 --enable-libdrm --enable-vout-drm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --libdir=/usr/lib/arm-linux-gnueabihf/neon/vfp --cpu=cortex-a7 --arch=armv6t2 --disable-thumb --enable-shared --disable-doc --disable-programs
  swresample  configuration: --prefix=/usr --extra-version=0+deb11u1+rpt1 --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --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-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg --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-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-mmal --enable-neon --enable-rpi --enable-v4l2-request --enable-libudev --enable-epoxy --enable-pocketsphinx --enable-libdc1394 --enable-libdrm --enable-vout-drm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --libdir=/usr/lib/arm-linux-gnueabihf/neon/vfp --cpu=cortex-a7 --arch=armv6t2 --disable-thumb --enable-shared --disable-doc --disable-programs
  postproc    configuration: --prefix=/usr --extra-version=0+deb11u1+rpt1 --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --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-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg --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-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-mmal --enable-neon --enable-rpi --enable-v4l2-request --enable-libudev --enable-epoxy --enable-pocketsphinx --enable-libdc1394 --enable-libdrm --enable-vout-drm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --libdir=/usr/lib/arm-linux-gnueabihf/neon/vfp --cpu=cortex-a7 --arch=armv6t2 --disable-thumb --enable-shared --disable-doc --disable-programs
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
Input #0, image2, from '/media/julien/USBKEY/capture_1/1/1656104991.jpg':
  Duration: 00:00:01.00, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 720x640 [SAR 1:1 DAR 9:8], 1 tbr, 1 tbn, 1 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (mjpeg (native) -> mjpeg (native))
  Stream #0:0 -> #1:0 (mjpeg (native) -> mjpeg (native))
  Stream #0:0 -> #2:0 (mjpeg (native) -> mjpeg (native))
  Stream #0:0 -> #3:0 (mjpeg (native) -> h264 (libx264))
Press [q] to stop, [?] for help
Output #0, image2, to '/media/julien/USBKEY/capture_1/1/1656104992.jpg':
  Metadata:
    encoder         : Lavf58.45.100
    Stream #0:0: Video: mjpeg, yuvj420p(pc), 720x640 [SAR 1:1 DAR 9:8], q=2-31, 200 kb/s, 1 fps, 1 tbn, 1 tbc
    Metadata:
      encoder         : Lavc58.91.100 mjpeg
    Side data:
      cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: N/A
Output #1, image2, to '/media/julien/USBKEY/capture_1/1/1656104993.jpg':
  Metadata:
    encoder         : Lavf58.45.100
    Stream #1:0: Video: mjpeg, yuvj420p(pc), 720x640 [SAR 1:1 DAR 9:8], q=2-31, 200 kb/s, 1 fps, 1 tbn, 1 tbc
    Metadata:
      encoder         : Lavc58.91.100 mjpeg
    Side data:
      cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: N/A
Output #2, image2, to '/media/julien/USBKEY/capture_1/1/1656104994.jpg':
  Metadata:
    encoder         : Lavf58.45.100
    Stream #2:0: Video: mjpeg, yuvj420p(pc), 720x640 [SAR 1:1 DAR 9:8], q=2-31, 200 kb/s, 1 fps, 1 tbn, 1 tbc
    Metadata:
      encoder         : Lavc58.91.100 mjpeg
    Side data:
      cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: N/A
[swscaler @ 0x1b52780] deprecated pixel format used, make sure you did set range correctly
[libx264 @ 0x17bb9f0] using SAR=1/1
[libx264 @ 0x17bb9f0] using cpu capabilities: ARMv6 NEON
[libx264 @ 0x17bb9f0] profile High, level 3.1, 4:2:0, 8-bit
[libx264 @ 0x17bb9f0] 264 - core 160 r3011 cde9a93 - H.264/MPEG-4 AVC codec - Copyleft 2003-2020 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=5 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #3, mp4, to '/media/julien/USBKEY/capture_1/1/out1.mp4':
  Metadata:
    encoder         : Lavf58.45.100
    Stream #3:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 720x640 [SAR 1:1 DAR 9:8], q=-1--1, 5 fps, 10240 tbn, 5 tbc
    Metadata:
      encoder         : Lavc58.91.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
frame=    1 fps=0.0 q=3.1 q=3.1 q=3.1 q=0.0 size=N/A time=00:00:01.00 bitrate=N/frame=    1 fps=0.0 q=3.1 Lq=3.1 q=3.1 q=-1.0 size=N/A time=00:00:01.00 bitrate=N/A dup=4 drop=0 speed=   1x    
video:85kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
[libx264 @ 0x17bb9f0] frame I:1     Avg QP:13.46  size: 29096
[libx264 @ 0x17bb9f0] frame P:1     Avg QP:16.32  size:   363
[libx264 @ 0x17bb9f0] frame B:3     Avg QP:14.14  size:   139
[libx264 @ 0x17bb9f0] consecutive B-frames: 20.0%  0.0%  0.0% 80.0%
[libx264 @ 0x17bb9f0] mb I  I16..4:  9.2% 73.0% 17.8%
[libx264 @ 0x17bb9f0] mb P  I16..4:  0.0%  0.0%  0.0%  P16..4:  9.4%  0.6%  0.0%  0.0%  0.0%    skip:90.1%
[libx264 @ 0x17bb9f0] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8:  3.8%  0.1%  0.0%  direct: 0.0%  skip:96.1%  L0:10.3% L1:89.7% BI: 0.0%
[libx264 @ 0x17bb9f0] 8x8 transform intra:73.0% inter:100.0%
[libx264 @ 0x17bb9f0] coded y,uvDC,uvAC intra: 79.4% 74.1% 62.8% inter: 0.4% 0.6% 0.0%
[libx264 @ 0x17bb9f0] i16 v,h,dc,p: 52% 17% 16% 15%
[libx264 @ 0x17bb9f0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 19%  6% 34%  3%  9% 16%  4%  6%  4%
[libx264 @ 0x17bb9f0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 24%  8% 22%  5% 12% 14%  4%  6%  4%
[libx264 @ 0x17bb9f0] i8c dc,h,v,p: 52% 16% 24%  8%
[libx264 @ 0x17bb9f0] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x17bb9f0] ref B L1: 99.5%  0.5%
[libx264 @ 0x17bb9f0] kb/s:239.02

나는 이것을 시도했고 모든 것이 괜찮습니다.https://lindevs.com/install-ffmpeg-on-raspberry-pi/

답변1

빠른 해결 방법: 입력 파일 이름을 작은따옴표( ffmpeg … -i '…/*.jpg' …)로 묶습니다.

더 긴 설명: 문제는 *ffmpeg가 파일 이름을 보기도 전에 쉘에 의해 파일 이름 목록으로 확장된다는 것입니다.

따라서 원래 명령이 잘못되었습니다.

ffmpeg -f image2 -framerate 1 -pattern_type glob -start_number %d \
  -i /media/julien/USBKEY/capture_%d/%d/*.jpg \
  -r 5 -c:v libx264 -pix_fmt yuv420p \
  /media/julien/USBKEY/capture_%s/%d/out%d.mp4 -y

ffmpeg는 기본적으로 이미지 목록과 함께 호출됩니다.

-i image1.jpg image2.jpg …

ffmpeg의 경우 두 번째 이미지 파일은 출력 파일 이름으로 해석됩니다. 를 통과했으므로 -yffmpeg는 이 이미지를 기꺼이 덮어쓸 것입니다. ( -y전역 옵션은 인수 목록에서 첫 번째로 와야 합니다.)

당신이해야 할 일은와일드카드를 인용해 보세요. 이렇게 하면 쉘이 이를 해석하지 않고 ffmpeg로 전달하여 내부적으로 와일드카드를 폴더의 이미지 목록으로 확장합니다.

ffmpeg -f image2 -framerate 1 -pattern_type glob -start_number %d \
  -i '/media/julien/USBKEY/capture_%d/%d/*.jpg' \
  -r 5 -c:v libx264 -pix_fmt yuv420p \
  /media/julien/USBKEY/capture_%s/%d/out%d.mp4 -y

예제도 참조하세요여기.

프로그램 코드의 경우 다음을 subprocess직접 호출하는 대신 Python 형식 문자열을 사용하고 모듈 을 활용하는 것이 좋습니다 system.

import subprocess

subprocess.check_output(
    f"ffmpeg -y -f image2 -framerate 1 -pattern_type glob -start_number {nom_premiere_image} -i '/media/julien/USBKEY/capture_{nom_dossier}/{nom_sous_dossier}/*.jpg' -r 5 -c:v libx264 -pix_fmt yuv420p /media/julien/USBKEY/capture_{nom_dossier}/{nom_sous_dossier}/out{nom_sous_dossier}.mp4", shell=True
)

더 좋은 방법은 명령의 모든 내용을 목록에 넣고 전달하는 것입니다.

subprocess.check_output([
   "ffmpeg", "-y", "-f", "image2", "-framerate", "1", "-pattern_type", "glob", "-start_number", nom_premiere_image,
    "-i", f"'/media/julien/USBKEY/capture_{nom_dossier}/{nom_sous_dossier}/*.jpg'",
    "-r", "5", "-c:v", "libx264", "-pix_fmt", "yuv420p",
    f"/media/julien/USBKEY/capture_{nom_dossier}/{nom_sous_dossier}/out{nom_sous_dossier}.mp4",
])

관련 정보