如何在ffmpeg中优化解码器性能?

时间:2018-03-14 22:53:47

标签: ffmpeg

您好我正在尝试使用ffmpeg命令将未解码的h264格式用于其他客户端应用程序。消费者应用程序只是读取h264。现在我如何优化以下命令?我的机器有GPU,我看到只使用了CPU,有什么我可以添加的吗?

 ffmpeg -pix_fmt yuv420p -hide_banner  -y -f v4l2 -vcodec h264 -video_size 1280x1020 -i /dev/video0 out.h264

打印参考的详细信息粘贴在下面 -

user@ubuntu$  ffmpeg -pix_fmt yuv420p -hide_banner  -y -f v4l2 -vcodec h264 -video_size 1280x1020 -i /dev/video0 out.h264
    [video4linux2,v4l2 @ 0x17e0a20] The V4L2 driver changed the video from 1280x1020 to 1280x720
    Input #0, video4linux2,v4l2, from '/dev/video0':
      Duration: N/A, start: 871.695509, bitrate: N/A
        Stream #0:0: Video: h264 (Constrained Baseline), yuvj420p(pc), 1280x720 [SAR 1:1 DAR 16:9], -5 kb/s, 30 fps, 30 tbr, 1000k tbn, 60 tbc
    No pixel format specified, yuvj420p for H.264 encoding chosen.
    Use -pix_fmt yuv420p for compatibility with outdated media players.
    [libx264 @ 0x1b80ac0] using SAR=1/1
    [libx264 @ 0x1b80ac0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
    [libx264 @ 0x1b80ac0] profile High, level 3.1
    Output #0, h264, to 'out.h264':
      Metadata:
        encoder         : Lavf56.40.101
        Stream #0:0: Video: h264 (libx264), yuvj420p(pc), 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 30 fps, 30 tbn, 30 tbc
        Metadata:
          encoder         : Lavc56.60.100 libx264
    Stream mapping:
      Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
    Press [q] to stop, [?] for help
    frame= 1242 fps= 30 q=-1.0 Lsize=    4092kB time=00:00:41.33 bitrate= 811.1kbits/s dup=0 drop=4    
    video:4092kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000000%
    [libx264 @ 0x1b80ac0] frame I:5     Avg QP:17.23  size: 59416
    [libx264 @ 0x1b80ac0] frame P:341   Avg QP:20.29  size:  8344
    [libx264 @ 0x1b80ac0] frame B:896   Avg QP:24.94  size:  1170
    [libx264 @ 0x1b80ac0] consecutive B-frames:  3.4%  1.1%  0.5% 95.0%
    [libx264 @ 0x1b80ac0] mb I  I16..4: 21.7% 46.7% 31.6%
    [libx264 @ 0x1b80ac0] mb P  I16..4:  1.8%  1.9%  0.4%  P16..4: 33.2%  5.0%  3.9%  0.0%  0.0%    skip:53.8%
    [libx264 @ 0x1b80ac0] mb B  I16..4:  0.1%  0.1%  0.0%  B16..8: 18.8%  0.6%  0.1%  direct: 0.5%  skip:79.8%  L0:41.7% L1:55.6% BI: 2.7%
    [libx264 @ 0x1b80ac0] 8x8 transform intra:46.9% inter:56.0%
    [libx264 @ 0x1b80ac0] coded y,uvDC,uvAC intra: 33.9% 42.8% 12.2% inter: 3.0% 5.9% 0.1%
    [libx264 @ 0x1b80ac0] i16 v,h,dc,p: 14% 44% 12% 30%
    [libx264 @ 0x1b80ac0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 17% 32% 29%  2%  4%  3%  5%  2%  5%
    [libx264 @ 0x1b80ac0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 25% 30% 13%  4%  8%  6%  7%  3%  5%
    [libx264 @ 0x1b80ac0] i8c dc,h,v,p: 57% 23% 17%  2%
    [libx264 @ 0x1b80ac0] Weighted P-Frames: Y:1.8% UV:0.0%
    [libx264 @ 0x1b80ac0] ref P L0: 65.9%  4.5% 21.6%  8.0%  0.1%
    [libx264 @ 0x1b80ac0] ref B L0: 88.2% 10.0%  1.9%
    [libx264 @ 0x1b80ac0] ref B L1: 95.6%  4.4%
    [libx264 @ 0x1b80ac0] kb/s:809.79

1 个答案:

答案 0 :(得分:0)

我找到了一种使用此文档优化它的方法 - https://developer.nvidia.com/ffmpeg