[FFmpeg-user] H264 VAAPI Encoder

Armin K. krejzi at email.com
Sun May 15 19:12:28 CEST 2016


On 14.05.2016 18:41, Mark Thompson wrote:
> On 13/05/16 20:43, Armin K. wrote:
>> I noticed that recently a VAAPI based H264 encoder was added to ffmpeg.
>> I built ffmpeg from git and now I have h264_vaapi listed in ffmpeg -encoders
>> output.
>>
>> However, when I try to use ffmpeg ... -vcodec h264_vaapi I get the following
>> error:
>>
>> Impossible to convert between the formats supported by the filter 'Parsed_null_0' and the filter 'auto-inserted scaler 0'
>>
>> The command I use is:
>>
>> ffmpeg -hwaccel vaapi -i <inputfile> -vcodec h264_vaapi <outfile>.mkv
> 
> Short answer:
> 
> ffmpeg -vaapi_device /dev/dri/renderD128 -i <inputfile> -vf 'format=nv12,hwupload' -c:v h264_vaapi <outfile>.mkv
> 
> 
> Longer answer:
> 
> It's somewhat awkward to use because it only accepts input as VAAPI surfaces (AV_PIX_FMT_VAAPI), with underlying format depending on the particular hardware.
> 
> "-vaapi_device" sets the hardware device to use.  It takes either a DRI device (ideally a render node, as above) or an X11 display name (only if you are actually in X).
> 
> Then we use libavfilter to get the input into the right form:
> 
> "format=nv12" forces software conversion to NV12, which is the underlying format required by the Intel driver.
> 
> "hwupload" uploads that software image into a VAAPI surface, which can then be fed into the encoder.
> 
> 
> You need a bit more trickiness to do a pure hardware transcode, see <https://wiki.libav.org/Hardware/vaapi> for additional explanation.
> 
> - Mark
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
> 
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
> 

Thanks! That seems to work just great!

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-user/attachments/20160515/731474a5/attachment.sig>


More information about the ffmpeg-user mailing list