ffmpeg -hwaccel vaapi -vaapi_device /dev/dri/renderD128 -i rtsp://admin:admin@192.168.1.162/1/1 -vf "format=nv12,hwupload" -y -c:v h264_vaapi 1.mp4

ffmpeg version N-103896-ged65498 Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.12) 20160609
  configuration: --enable-vaapi --disable-x86asm --enable-nonfree
  libavutil      57.  7.100 / 57.  7.100
  libavcodec     59.  9.101 / 59.  9.101
  libavformat    59.  5.100 / 59.  5.100
  libavdevice    59.  0.101 / 59.  0.101
  libavfilter     8.  9.100 /  8.  9.100
  libswscale      6.  1.100 /  6.  1.100
  libswresample   4.  0.100 /  4.  0.100
Guessed Channel Layout for Input Stream #0.1 : mono
Input #0, rtsp, from 'rtsp://admin:admin@192.168.1.162/1/1':
  Metadata:
    title           : SDP Descrption
    comment         : SDP Description
  Duration: N/A, start: 0.000000, bitrate: N/A
  Stream #0:0: Video: h264 (High), yuvj420p(pc, bt709, progressive), 2560x1440, 25 fps, 25 tbr, 90k tbn
  Stream #0:1: Audio: pcm_alaw, 8000 Hz, mono, s16, 64 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (h264_vaapi))
  Stream #0:1 -> #0:1 (pcm_alaw (native) -> aac (native))
Press [q] to stop, [?] for help

vainfo --display drm | grep H264.*Enc
libva info: VA-API version 1.13.0
libva info: Trying to open /usr/local/lib/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_13
libva info: va_openDriver() returns 0

  VAProfileH264ConstrainedBaseline:    VAEntrypointEncSlice
  VAProfileH264Main               :    VAEntrypointEncSlice
  VAProfileH264High               :    VAEntrypointEncSlice

使用以下几种方法都可以硬解

ffmpeg -hwaccel vaapi -c:v h264 -i rtsp://admin:admin@192.168.1.162/1/1 -f null -
ffmpeg -hwaccel vaapi -i rtsp://admin:admin@192.168.1.162/1/1 -f null -
ffmpeg -hwaccel vaapi -vaapi_device /dev/dri/renderD128 -i rtsp://admin:admin@192.168.1.162/1/1 -f null -
ffmpeg -init_hw_device vaapi=vaapi:/dev/dri/renderD128 -filter_hw_device vaapi -i rtsp://admin:admin@192.168.1.162:554/1/1 -f null -
软解:
ffmpeg -i rtsp://admin:admin@192.168.1.162/1/1 -f null -

查看CPU占用情况,一下就看出来了。

本文链接地址:https://const.net.cn/444.html

标签: ffmpeg

添加新评论