我正在一个网站上处理视频,要求材料可以向前和向后搜索。这类似于苹果在其页面上使用的效果新款 MacBook Pro。如果您观察最顶部的笔记本电脑图像,它具有根据您的滚动位置播放的动态视频。
现在,通过在 Adobe Media Encoder 中将关键帧距离设置为 1,我已经能够创建一个可以向前和向后播放且几乎没有卡顿的 mp4 视频:
我还没有使用 CLI 和 ffmpeg 进行复制。我尝试运行以下命令:
ffmpeg -i Vulkano-HD_1.mp4 -vcodec libx264 -x264-params keyint=96:min-keyint=96:scenecut=-1 -an out2.mp4
源是 4s,我试图强制 96 个关键帧(4*24fps),但无法正常工作。使用 Adobe Media Encoder 创建的文件大小为 4.7MB,而使用 cli 创建的文件大小为 1.6MB,所以肯定出了问题。
知道我在这里做错了什么吗?
完整日志
ffmpeg version 3.0.2 Copyright (c) 2000-2016 the FFmpeg developers
built with Apple LLVM version 7.3.0 (clang-703.0.29)
configuration: --prefix=/usr/local/Cellar/ffmpeg/3.0.2 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-opencl --enable-libx264 --enable-libmp3lame --enable-libxvid --enable-vda
libavutil 55. 17.103 / 55. 17.103
libavcodec 57. 24.102 / 57. 24.102
libavformat 57. 25.100 / 57. 25.100
libavdevice 57. 0.101 / 57. 0.101
libavfilter 6. 31.100 / 6. 31.100
libavresample 3. 0. 0 / 3. 0. 0
libswscale 4. 0.100 / 4. 0.100
libswresample 2. 0.101 / 2. 0.101
libpostproc 54. 0.100 / 54. 0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Vulkano-HD_1.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: mp42mp41
creation_time : 2016-12-19 13:33:58
Duration: 00:00:04.04, start: 0.000000, bitrate: 9382 kb/s
Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x816, 9358 kb/s, 24 fps, 24 tbr, 24k tbn, 48 tbc (default)
Metadata:
creation_time : 2016-12-19 13:33:58
handler_name : Alias Data Handler
encoder : AVC Coding
[libx264 @ 0x7fc67d807000] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 @ 0x7fc67d807000] profile High, level 4.0
[libx264 @ 0x7fc67d807000] 264 - core 148 r2668 fd2c324 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - 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=12 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=2 keyint=96 keyint_min=49 scenecut=0 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 #0, mp4, to 'out2.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: mp42mp41
encoder : Lavf57.25.100
Stream #0:0(eng): Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 1920x816, q=-1--1, 24 fps, 12288 tbn, 24 tbc (default)
Metadata:
creation_time : 2016-12-19 13:33:58
handler_name : Alias Data Handler
encoder : Lavc57.24.102 libx264
Side data:
unknown side data type 10 (24 bytes)
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Press [q] to stop, [?] for help
frame= 57 fps=0.0 q=28.0 size= 27kB time=-00:00:00.04 bitrate=N/A speed=Nframe= 80 fps= 78 q=28.0 size= 343kB time=00:00:00.91 bitrate=3062.6kbits/frame= 97 fps= 63 q=28.0 size= 638kB time=00:00:01.62 bitrate=3215.4kbits/frame= 97 fps= 35 q=-1.0 Lsize= 1598kB time=00:00:03.95 bitrate=3306.2kbits/s speed=1.43x
video:1596kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.086879%
[libx264 @ 0x7fc67d807000] frame I:2 Avg QP:21.50 size: 28347
[libx264 @ 0x7fc67d807000] frame P:86 Avg QP:22.75 size: 17547
[libx264 @ 0x7fc67d807000] frame B:9 Avg QP:22.97 size: 7561
[libx264 @ 0x7fc67d807000] consecutive B-frames: 81.4% 18.6% 0.0% 0.0%
[libx264 @ 0x7fc67d807000] mb I I16..4: 26.4% 69.2% 4.5%
[libx264 @ 0x7fc67d807000] mb P I16..4: 19.2% 26.8% 0.8% P16..4: 29.9% 4.8% 1.0% 0.0% 0.0% skip:17.6%
[libx264 @ 0x7fc67d807000] mb B I16..4: 2.8% 3.3% 0.0% B16..8: 37.6% 3.9% 0.2% direct: 1.9% skip:50.2% L0:43.2% L1:53.1% BI: 3.6%
[libx264 @ 0x7fc67d807000] 8x8 transform intra:57.8% inter:94.6%
[libx264 @ 0x7fc67d807000] coded y,uvDC,uvAC intra: 24.4% 40.6% 2.3% inter: 13.1% 24.4% 0.0%
[libx264 @ 0x7fc67d807000] i16 v,h,dc,p: 32% 17% 15% 36%
[libx264 @ 0x7fc67d807000] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 35% 14% 27% 4% 4% 6% 3% 4% 2%
[libx264 @ 0x7fc67d807000] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 36% 13% 16% 4% 10% 10% 5% 4% 2%
[libx264 @ 0x7fc67d807000] i8c dc,h,v,p: 56% 17% 23% 4%
[libx264 @ 0x7fc67d807000] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x7fc67d807000] ref P L0: 74.1% 10.4% 11.4% 4.1%
[libx264 @ 0x7fc67d807000] ref B L0: 83.1% 16.9%
[libx264 @ 0x7fc67d807000] kb/s:3233.87