我一直尝试用我的 GoPro 拍摄(夜间)延时摄影,然后用 把这些图像拼接起来ffmpeg
,但我找不到一个好的设置。我所有的尝试都以某种瑕疵告终。
ffmpeg 命令:
ffmpeg -r 100 -pattern_type glob -i '*.JPG' -vcodec libx264 -crf 18 -pix_fmt yuv420p -preset veryfast timelapse18.mp4
我也尝试过慢速和不同的-crf
。高数字(较低质量)产生的伪影较少,但图像也较差。
编辑:完整日志
$ ffmpeg -r 100 -pattern_type glob -i '*.JPG' -vcodec libx264 -crf 18 -pix_fmt yuv420p -preset veryfast timelapse18.mp4
ffmpeg version 4.2.1 Copyright (c) 2000-2019 the FFmpeg developers
built with Apple clang version 11.0.0 (clang-1100.0.33.8)
configuration: --prefix=/usr/local/Cellar/ffmpeg/4.2.1_2 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags='-I/Library/Java/JavaVirtualMachines/adoptopenjdk-13.jdk/Contents/Home/include -I/Library/Java/JavaVirtualMachines/adoptopenjdk-13.jdk/Contents/Home/include/darwin -fno-stack-check' --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libmp3lame --enable-libopus --enable-librubberband --enable-libsnappy --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libsoxr --enable-videotoolbox --disable-libjack --disable-indev=jack
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
libavresample 4. 0. 0 / 4. 0. 0
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 '*.JPG':
Duration: 00:04:32.20, start: 0.000000, bitrate: N/A
Stream #0:0: Video: mjpeg (Baseline), yuvj422p(pc, bt470bg/unknown/unknown), 4000x3000, 25 fps, 25 tbr, 25 tbn, 25 tbc
Stream mapping:
Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[swscaler @ 0x1104c3000] deprecated pixel format used, make sure you did set range correctly
[libx264 @ 0x7f8f62002a00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x7f8f62002a00] profile High, level 6.1
[libx264 @ 0x7f8f62002a00] 264 - core 155 r2917 0a84d98 - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html - options: cabac=1 ref=1 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=2 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=6 lookahead_threads=2 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=1 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=10 rc=crf mbtree=1 crf=18.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'timelapse18.mp4':
Metadata:
encoder : Lavf58.29.100
Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 4000x3000, q=-1--1, 100 fps, 12800 tbn, 100 tbc
Metadata:
encoder : Lavc58.54.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
frame= 6808 fps=6.2 q=-1.0 Lsize= 1018519kB time=00:01:08.05 bitrate=122611.3kbits/s dup=3 drop=0 speed=0.0616x
video:1018436kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.008126%
[libx264 @ 0x7f8f62002a00] frame I:29 Avg QP:19.68 size:529355
[libx264 @ 0x7f8f62002a00] frame P:2320 Avg QP:22.51 size:196487
[libx264 @ 0x7f8f62002a00] frame B:4459 Avg QP:23.38 size:128207
[libx264 @ 0x7f8f62002a00] consecutive B-frames: 12.5% 0.4% 0.6% 86.5%
[libx264 @ 0x7f8f62002a00] mb I I16..4: 32.3% 56.5% 11.1%
[libx264 @ 0x7f8f62002a00] mb P I16..4: 31.0% 37.4% 0.1% P16..4: 10.2% 2.4% 1.9% 0.0% 0.0% skip:17.1%
[libx264 @ 0x7f8f62002a00] mb B I16..4: 14.3% 22.3% 0.0% B16..8: 12.1% 2.6% 0.1% direct:14.6% skip:34.1% L0:43.4% L1:49.7% BI: 6.9%
[libx264 @ 0x7f8f62002a00] 8x8 transform intra:57.8% inter:34.6%
[libx264 @ 0x7f8f62002a00] coded y,uvDC,uvAC intra: 38.0% 9.4% 0.0% inter: 14.4% 13.5% 0.0%
[libx264 @ 0x7f8f62002a00] i16 v,h,dc,p: 35% 21% 39% 6%
[libx264 @ 0x7f8f62002a00] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 13% 13% 52% 4% 4% 4% 4% 3% 3%
[libx264 @ 0x7f8f62002a00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 16% 12% 16% 7% 15% 11% 10% 6% 8%
[libx264 @ 0x7f8f62002a00] i8c dc,h,v,p: 76% 12% 12% 0%
[libx264 @ 0x7f8f62002a00] Weighted P-Frames: Y:18.3% UV:4.1%
[libx264 @ 0x7f8f62002a00] kb/s:122547.38
答案1
简化命令,消除工件,然后才尝试重新引入一些选项。
省略-crf
、-pix_fmt
、 和-preset
。
使用更常见的费率,例如-r 30
。
或者,如果你迫切需要的话,可以使用不同的编码器:
cat *.JPG | ffmpeg -f image2pipe -framerate 30 -c:v mjpeg -i - out.mov