0

When I use ffmpeg and vaapi encoder, I know I can specify "profile" in a commandline:

ffmpeg ... -i input.wmv -c:v h264_vaapi -profile:v PROFILE_NUMBER output.mp4

Since this I am using vaapi, I know I need to take a look at what kind of profile does my Intel CPU actually support by typing

$ vainfo|grep -i enc|grep 264
libva info: VA-API version 1.13.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_13
libva info: va_openDriver() returns 0
      VAProfileH264Main               : VAEntrypointEncSlice
      VAProfileH264Main               : VAEntrypointEncSliceLP
      VAProfileH264High               : VAEntrypointEncSlice
      VAProfileH264High               : VAEntrypointEncSliceLP
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSliceLP

From this output, I know my Intel support Main, High and ConstrainedBaseLine profiles

(by the way, I have no idea what "VAEntrypointEncSlice" and "VAEntrypointEncSliceLP" means)

By cross-reference wikipage https://en.wikipedia.org/wiki/Advanced_Video_Coding#Profiles

the corresponding "profile number" are 77 100 and 66

The problem is that specifying specific profile has no effect whatsover. In other word

ffmpeg ... -i input.wmv -c:v h264_vaapi -profile:v 77 output-77.mp4

ffmpeg ... -i input.wmv -c:v h264_vaapi -profile:v 100 output-100.mp4

ffmpeg ... -i input.wmv -c:v h264_vaapi -profile:v 66 output-66.mp4

yields output file of exact same size.

My question is: what went wrong? It is rather obvious that I've invoked the right profile or ffmpeg will complain that the profile is not supported. but if the encoding profile has been properly invoked, why it has no effect to the output file?

Thanks in advance

  • Have you tried to specify profile not by the number but by the name? Also: what's your output of `ffmpeg -help encoder=h264_vaapi`? If your version of FFmpeg supports this encoder then this command should list all options for it. – Lex Feb 12 '22 at 03:59
  • I have completely forgotten about `ffmpeg -h encoder`. Since I didn't compile ffmpeg myself, I forgot to double check the ffmpeg binary. It turned out that the ffmpeg binary I have doesn't support all h/w accelerated profiles. By specify a profile that is both supported by the hardware AND compiled to the binary, I managed to specify the profile without issue. But the profile didn't make any visible differences in my case. Specifying -qp made huge differences in perceived quality. On the other hand, my original goal was to shrink the video, so I am back to square one. thx – Harvey King Feb 13 '22 at 23:14

0 Answers0