如何在ffmpeg中实现4K编码的1倍写入速度?

时间:2017-10-03 13:08:51

标签: video ffmpeg

是否有可能以1倍的写入速度编码4K资产?

以下是我们的编码命令以及CPU,源资产和编码命令输出的详细信息:

编码命令

ffmpeg -i 4K_Source.mp4 -c:v libx265 -preset ultrafast
    -x265-params fps=60:profile=main:min-keyint=60:crf=19 -vf "scale=3840:2160"
    -sc_threshold 0 4K_UF_3840x2160_CRF19.mp4

来源资产详情

Overall bit rate mode      : Constant
Overall bit rate           : 51.6 Mb/s
Format                     : HEVC
Format/Info                : High Efficiency Video Coding
Format profile             : Main 10@L5.1@High
Duration                   : 1 min 33 s
Width                      : 3 840 pixels
Height                     : 2 160 pixels
Display aspect ratio       : 16:9
Frame rate                 : 59.940 (60000/1001) FPS

CPU详细信息

Intel(R) Xeon(R) CPU E7-8870 v3 @ 2.10GHz (144 core)

FFMPEG命令输出

ffmpeg version 3.2.4-static http://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 5.4.1 (Debian 5.4.1-5) 20170205
  configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-5 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gray --enable-libass --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libzimg
  libavutil      55. 34.101 / 55. 34.101
  libavcodec     57. 64.101 / 57. 64.101
  libavformat    57. 56.101 / 57. 56.101
  libavdevice    57.  1.100 / 57.  1.100
  libavfilter     6. 65.100 /  6. 65.100
  libswscale      4.  2.100 /  4.  2.100
  libswresample   2.  3.100 /  2.  3.100
  libpostproc    54.  1.100 / 54.  1.100
[mpegts @ 0x3a2b600] start time for stream 1 is not set in estimate_timings_from_pts
[mpegts @ 0x3a2b600] Could not find codec parameters for stream 1 (Audio:  
aac ([15][0][0][0] / 0x000F), 0 channels, fltp): unspecified sample rate
Consider increasing the value for the 'analyzeduration' and 'probesize'   
options
Input #0, mpegts, from 'Samsung_SUHD_Colorful_Food.mp4':
  Duration: 00:01:33.11, start: 1.050044, bitrate: 52076 kb/s
  Program 1
    Stream #0:0[0x101]: Video: hevc (Main 10) ([36][0][0][0] / 0x0024), yuv420p10le(tv), 3840x2160 [SAR 1:1 DAR 16:9], 59.94 fps, 59.94 tbr, 90k  
 tbn, 59.94 tbc
    Stream #0:1[0x102](und): Audio: aac ([15][0][0][0] / 0x000F), 0 channels, fltp
[libx265 @ 0x3a53d40] Unknown option: profile.
x265 [info]: HEVC encoder version 2.2+35-fe2f2dd96f8c
x265 [info]: build info [Linux][GCC 5.4.1][64 bit] 10bit
x265 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX AVX2 FMA3 LZCNT BMI2
x265 [info]: Main 10 profile, Level-5.1 (Main tier)
x265 [info]: Thread pool 0 using 64 threads on numa nodes 0,1,2,3
x265 [info]: Thread pool 1 using 64 threads on numa nodes 0,1,2,3
x265 [info]: Slices                              : 1
x265 [info]: frame threads / pool features       : 8 / wpp(68 rows)
x265 [info]: Coding QT: max CU size, min CU size : 32 / 16
x265 [info]: Residual QT: max TU size, max depth : 32 / 1 inter / 1 intra
x265 [info]: ME / range / subpel / merge         : dia / 57 / 0 / 2
x265 [info]: Keyframe min / max / scenecut / bias: 60 / 250 / 0 / 5.00
x265 [info]: Lookahead / bframes / badapt        : 5 / 3 / 0
x265 [info]: b-pyramid / weightp / weightb       : 1 / 0 / 0
x265 [info]: References / ref-limit  cu / depth  : 1 / off / off
x265 [info]: AQ: mode / str / qg-size / cu-tree  : 1 / 0.0 / 32 / 1
x265 [info]: Rate Control / qCompress            : CRF-19.0 / 0.60
x265 [info]: tools: rd=2 psy-rd=2.00 early-skip rskip tmvp fast-intra
x265 [info]: tools: strong-intra-smoothing lslices=8 deblock
Output #0, mp4, to 'Samsung_UF_3840x2160_CRF19.mp4':
  Metadata:
    encoder         : Lavf57.56.101
    Stream #0:0: Video: hevc (libx265) ([35][0][0][0] / 0x0023), yuv420p10le, 3840x2160 [SAR 1:1 DAR 16:9], q=2-31, 59.94 fps, 60k tbn, 59.94 tbc
    Metadata:
      encoder         : Lavc57.64.101 libx265
Stream mapping:
  Stream #0:0 -> #0:0 (hevc (native) -> hevc (libx265))
Press [q] to stop, [?] for help
frame= 5581 fps= 20 q=-0.0 Lsize=  212585kB time=00:01:33.05
bitrate=18713.8kbits/s speed=0.336x
video:212514kB audio:0kB subtitle:0kB other streams:0kB global headers:2kB muxing overhead: 0.033184%
x265 [info]: frame I:     23, Avg QP:24.29  kb/s: 133747.47
x265 [info]: frame P:   1401, Avg QP:26.43  kb/s: 31994.19
x265 [info]: frame B:   4157, Avg QP:29.67  kb/s: 13602.20
x265 [info]: consecutive B-frames: 1.3% 1.4% 1.5% 95.9%
encoded 5581 frames in 276.59s (20.18 fps), 18714.28 kb/s, Avg QP:28.83 

我们获得的编码速度仅为0.3x。我们正在尝试将HEVC编解码器资产编码为HEVC编解码器本身,具有4K分辨率,写入速度为1倍。

我们是否缺少ffmpeg命令中可以调整编码速度的任何参数?

1 个答案:

答案 0 :(得分:2)

我相信你基本上想要在2:00分钟的总持续时间内执行2:00分钟长的文件编码 - 换句话说,以本机帧速率读取输入。

如果是这样;尝试添加-re之前/之后(我不记得)-i,如下所示:

ffmpeg -re -i 4K_Source.mp4 -c:v libx265 -preset ultrafast -x265-params fps=60:profile=main:min-keyint=60:crf=19 -vf "scale=3840:2160" -sc_threshold 0 4K_UF_3840x2160_CRF19.mp4

详细了解-re here