ffmpeg/avconv 使用 vaapi 的一些测试记录

来源:互联网 发布:英语口语学习软件推荐 编辑:程序博客网 时间:2024/06/06 10:47

一、vaapi 解码 h264

问题一、

ffmpeg -hwaccel vaapi -i h264_100fps.h264 -vcodec h264_vaapi output.yuv


Input #0, h264, from 'h264_100fps.h264':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: h264 (Main), yuvj420p(pc, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 100 fps, 100 tbr, 1200k tbn, 200 tbc
Impossible to convert between the formats supported by the filter 'Parsed_null_0' and the filter 'auto-inserted scaler 0'


测试使用 hwaccel vaapi 硬件加速 解码,并且使用 libx264 进行编码

ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -i h264_100fps.avi -c:v libx264 output.avi

但是提示下面的错误

Error while decoding stream #0:0: Invalid data found when processing input[AVHWDeviceContext @ 0x7ff088047e60] No VA display found for device: /dev/dri/renderD128.[vaapi @ 0x15afb20] Failed to create a VAAPI devicevaapi hwaccel requested for input stream #0:0, but cannot be initialized.[h264 @ 0x2596860] decode_slice_header error[h264 @ 0x2596860] no frame!Error while decoding stream #0:0: Invalid data found when processing input 




设置vaapi 硬件解码输出的格式为 YUV420p,(该格式为x264 编码的输入格式),这样会比上面的速度快一些;

ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format yuv420p -i h264_100fps.avi -c:v libx264  test.avi

还是上面的问题没有解决;



DRM render node:

在类unix世界中还有一个DRM即The Direct Rendering Manager,它是DRI(Direct Rendering Infrastructure)框架的一个组件。而DRI的作用是为类Unix系统提供高效视频加速(很重要的用途是可以对3D渲染提供加速效果)。

http://blog.csdn.net/chrisniu1984/article/details/6619713



二、vaapi 硬件编码

注意: 这个硬件加速只能是 vaapi 格式(a vaapi format frame),yuv420p 格式不能进行编码;


Encode a random input file with default options:

ffmpeg -vaapi_device /dev/dri/renderD128 -i input.mp4 -an -vf 'format=nv12,hwupload' -c:v h264_vaapi output.mp4













最新版的ffmpeg中发现了一个新的东西:avconv,而且ffmpeg.c与avconv.c一个模样,一研究才发现是libav下把ffmpeg改名为avconv了.

http://club.tgfcer.net/thread-6555590-1-1.html

http://blog.csdn.net/zww_sap111/article/details/8670239

原来这么多的资料都在 avconv上,


N、参考资料

https://wiki.libav.org/Hardware/vaapi  // ffmpeg 官网硬件加速

http://ffmpeg-users.933282.n4.nabble.com/H264-VAAPI-Encoder-td4676054.html

https://www.libav.org/documentation/avconv.html

https://tvheadend.org/issues/3831 //

https://www.reddit.com/r/linux/comments/4q5qns/using_vaapis_hardware_accelerated_video_encoding/


0 0
原创粉丝点击