我们使用下面的 ffmpeg 命令来创建 mp4。输出显示像素化。我已更改命令中的多个参数,但像素化并未减少。我想将比特率保持恒定为 2000kbps。
请查看以下命令的完整输出..
C:\Users\Iplay>"D:\DG\FFAStrans0.9.2 (1)\Processors\ffmpeg\x64\ffmpeg.exe" -i "D:\AFSAR_BITIYA_EP159_CREATIVE_MASTER - Copy.mxf" -c:v libx264 -s 1920x1080 -r 25 -aspect 16:9 -b:v 2000k -minrate 2000k -maxrate 2000k -bufsize 78000k -preset veryslow -vprofile high -vlevel 4.1 -crf 1 -coder 1 -pix_fmt yuv420p -movflags +faststart -g 30 -bf 2 -c:a aac -b:a 320k -write_tmcd 0 -map 0:0 -map 0:1 -af "pan=stereo|c0=c6|c1=c7" -vf "drawtext=fontfile=/Windows/Fonts/arial.ttf:fontsize=80:x=800:y=900:box=1:[email protected]:rate='25000/1001':fontcolor=white:timecode='09\:59\:55\:00" "D:\test.mp4"ffmpeg version N-91398-gd08d4a8c73 Copyright (c) 2000-2018 the FFmpeg developers built with gcc 7.3.0 (GCC)configuration: --disable-static --enable-shared --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth libavutil 56. 18.102 / 56. 18.102 libavcodec 58. 20.104 / 58. 20.104 libavformat 58. 17.101 / 58. 17.101 libavdevice 58. 4.101 / 58. 4.101 libavfilter 7. 25.100 / 7. 25.100 libswscale 5. 2.100 / 5. 2.100 libswresample 3. 2.100 / 3. 2.100 libpostproc 55. 2.100 / 55. 2.100[mxf @ 0000000001e65e80] Stream #0: not enough frames to estimate rate; consider increasing probesize Guessed Channel Layout for Input Stream #0.1 : 7.1Input #0, mxf, from 'D:\AFSAR_BITIYA_EP159_CREATIVE_MASTER - Copy.mxf':Metadata:
uid : 682d6935-8748-11e8-bc3a-6cab31f179f2
generation_uid : 682d6936-8748-11e8-9e20-6cab31f179f2
company_name : Adobe Systems Incorporated
product_name : Adobe Media Encoder
product_version : 12.0.0
application_platform: Mac OS X
product_uid : 0c3919fe-46e8-11e5-a151-feff819cdc9f
modification_date: 2018-07-14T09:29:29.000000Z
material_package_umid: 0x060A2B340101010501010D1113000000A8600902138305BA6E516CAB31F179F2
timecode : 09:59:55:00 Duration: 00:20:19.76, start: 0.000000, bitrate: 123289 kb/s
Stream #0:0: Video: h264 (High 4:2:2 Intra), yuv422p10le(pc, bt709, top first), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 25 tbn, 50 tbc
Metadata:
file_package_umid: 0x060A2B340101010501010D12130F8533A8600902138305BA70266CAB31F179F2
file_package_name: Source Package
track_name : Track 1
Stream #0:1: Audio: pcm_s24le, 48000 Hz, 7.1, s32 (24 bit), 9216 kb/s
Metadata:
file_package_umid: 0x060A2B340101010501010D12130F8533A8600902138305BA70266CAB31F179F2
file_package_name: Source Package
track_name : Track 2 File 'D:\test.mp4' already exists. Overwrite ? [y/N] y Stream mapping:Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264)) Stream #0:1 -> #0:1 (pcm_s24le (native) -> aac (native)) Press [q] to stop, [?] for help [Parsed_pan_0 @ 0000000002dbfd80] Pure channel mapping detected: 6 7[libx264 @ 0000000001e6e9c0] using SAR=1/1[libx264 @ 0000000001e6e9c0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2[libx264 @ 0000000001e6e9c0] profile High, level 4.1[libx264 @ 0000000001e6e9c0] 264 - core 155 r2901 7d0ff22 - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html - options:cabac=1 ref=4 deblock=1:0:0 analyse=0x3:0x133 me=umh subme=10 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=24 chroma_me=1 trellis=2 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=34 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=2 b_pyramid=2 b_adapt=2 b_bias=0 direct=3 weightb=1 open_gop=0 weightp=2 keyint=30 keyint_min=3 scenecut=40 intra_refresh=0 rc_lookahead=60 rc=crf mbtree=1 crf=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 vbv_maxrate=2000 vbv_bufsize=78000 crf_max=0.0 nal_hrd=none filler=0 ip_ratio=1.40 aq=1:1.00 Output #0, mp4, to 'D:\test.mp4':Metadata:uid : 682d6935-8748-11e8-bc3a-6cab31f179f2
generation_uid : 682d6936-8748-11e8-9e20-6cab31f179f2
company_name : Adobe Systems Incorporated
product_name : Adobe Media Encoder
product_version : 12.0.0
application_platform: Mac OS X
product_uid : 0c3919fe-46e8-11e5-a151-feff819cdc9f
modification_date: 2018-07-14T09:29:29.000000Z
material_package_umid: 0x060A2B340101010501010D1113000000A8600902138305BA6E516CAB31F179F2
timecode : 09:59:55:00
encoder : Lavf58.17.101
Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 2000 kb/s, 25 fps, 12800 tbn, 25 tbc Metadata:
file_package_umid: 0x060A2B340101010501010D12130F8533A8600902138305BA70266CAB31F179F2
file_package_name: Source Package
track_name : Track 1
encoder : Lavc58.20.104 libx264
Side data:
cpb: bitrate max/min/avg: 2000000/0/2000000 buffer size: 78000000 vbv_delay: -1
Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp (24 bit), 320 kb/s
Metadata:
file_package_umid: 0x060A2B340101010501010D12130F8533A8600902138305BA70266CAB31F179F2
file_package_name: Source Package
track_name : Track 2
encoder : Lavc58.20.104 aac[mp4 @ 000000000302e6c0] Starting second pass: moving the moov atom to the beginning of the fileframe=29387 fps= 23 q=-1.0 Lsize= 327414kB time=00:19:36.06 bitrate=2280.6kbits/s speed=0.915x video:290809kB audio:35787kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.250163% [libx264 @ 0000000001e6e9c0] frame I:1175 Avg QP:28.61 size: 68899b[libx264 @ 0000000001e6e9c0] frame P:10535 Avg QP:32.59 size: 13694 [libx264 @ 0000000001e6e9c0] frame B:17677 Avg QP:35.32 size: 4105 [libx264 @ 0000000001e6e9c0] consecutive B-frames: 6.1% 14.7% 79.2% [libx264 @ 0000000001e6e9c0] mb I I16..4: 28.2% 65.6% 6.2% [libx264 @ 0000000001e6e9c0] mb P I16..4: 3.6% 5.1% 0.1% P16..4: 34.1% 3.0% 5.6% 0.0% 0.0% skip:48.4% [libx264 @ 0000000001e6e9c0] mb B I16..4: 0.2% 0.3% 0.0% B16..8: 36.6% 1.0% 0.2% direct: 0.5% skip:61.2% L0:41.1% L1:57.9% BI: 1.1% [libx264 @ 0000000001e6e9c0] 8x8 transform intra:61.9% inter:80.2% [libx264 @ 0000000001e6e9c0] direct mvs spatial:98.2% temporal:1.8% [libx264 @ 0000000001e6e9c0] coded y,uvDC,uvAC intra: 38.1% 42.5% 10.9% inter: 3.3% 3.7% 0.1% [libx264 @ 0000000001e6e9c0] i16 v,h,dc,p: 21% 21% 12% 47% [libx264 @ 0000000001e6e9c0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 11% 6% 11% 11% 15% 13% 12% 11% 10% [libx264 @ 0000000001e6e9c0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 17% 7% 4% 11% 13% 15% 11% 11% 11%[libx264 @ 0000000001e6e9c0] i8c dc,h,v,p: 38% 34% 18% 10% [libx264 @ 0000000001e6e9c0] Weighted P-Frames: Y:1.8% UV:1.3 [libx264 @ 0000000001e6e9c0] ref P L0: 60.2% 14.2% 19.9% 5.5% 0.1% 0.0% [libx264 @ 0000000001e6e9c0] ref B L0: 83.9% 14.1% 2.1%[libx264 @ 0000000001e6e9c0] kb/s:2026.66[aac @ 0000000001e97200] Qavg: 65535.969
—迪内什
答案1
您的视频分辨率相当高 (1920x1080),比特率相对较低 (2Mbps)。压缩后的视频会出现像素化,尤其是在嵌入文本周围,因为您无法在 2 兆比特的数据中每秒容纳那么多细节。如果不增加比特率,您将无法从中榨取更多内容。
答案2
对于 h264 来说,最佳压缩比似乎在 14 倍左右徘徊。
未压缩的 RGB 8 位每通道视频的吞吐量的基本计算是面积尺寸乘以 3 个颜色通道乘以帧速率。如果您将该结果(以字节为单位)转换为 kb,然后除以 14,您将得到接近主观最佳压缩率的结果。
许多计算器使用 1(低)- 4(高)的运动因子而不是通道数来解释应用压缩的方式,然后乘以.07
。请注意,1 /.07
约为 14。
您的输出建议为 25fps @ 1920 x 1080,因此1080 * 1920 * 3 * 25 / 1024 / 14
在第一种情况下或(假设中高运动)1080 * 1920 * 3 * 25 / 1024 * .07
在第二种情况下。
显然,由于我选择的运动系数为 3,结果非常接近:大约 10,000kps。如果运动系数为 2,则约为 7,000。因此,正如评论和其他答案所暗示的那样,您的 2,000 目标有点低。
答案3
正如其他人提到的,2 Mbit/s 对于 1080p 的高质量 H.264 视频来说有点低。如果您拥有不错的编码器和足够的时间或 CPU 资源进行编码,并且内容易于编码,那么它可能看起来仍然可接受,而不会出现大量失真。
您可以尝试在 veryslow 预设下进行两次编码:
ffmpeg -y -i input -c:v libx264 -b:v 2000k -pass 1 -preset veryslow -an -f mp4 /dev/null
ffmpeg -i input -c:v libx264 -b:v 2000k -pass 2 -preset veryslow -c:a aac -b:a 128k output.mp4
在 Windows 上,替换/dev/null
为NUL
。请参阅H.264 维基百科条目了解更多信息。
对于您的特定命令,您添加了-crf 1
设置,如果您同时指定目标比特率,该设置将毫无用处。因此,请-crf 1
从您的命令中删除。