4

I am trying to encode some videos but when I use the libx264 they don't work but change the codec to h264_nvenc and they play.

If I change the profile to baseline when using the libx264 the videos play.

what is the difference? I could use the h264_nvenc but I want to use the libx264 for the better quality for storage.

My code

bin\ffmpeg -i "Input-File" -c:v h264_nvenc -bf 3 -b_strategy 2 -temporal-aq 1 -rc-lookahead 20 -profile:v high -preset slow -rc vbr_hq -rc:v vbr_hq -qmin 0 -cq:v 19 -b:v 900k -maxrate:v 5000k -bufsize 2000K -c:a aac -ar 48000 -b:a 128k "Output-File.mp4"
Jonathan Morrall
  • 43
  • 1
  • 2
  • 5
  • Your player has does it support the default encoding by x264, but it happens to support the default encoding by h264_nvenc. Most likely, the better quality you want to achieve is not compatible with your player. – Alex Cohn Aug 17 '19 at 05:28
  • @AlexCohn this was my though. After many hours of playing around with smoke and mirrors i came up with `bin\ffmpeg -i inputfile.ext -c:v libx264 -coder ac -refs 4 -me_range 24 -qblur 0.5 -chromaoffset -3 -x264-params deblock=-1,-1:fast_pskip=0:cplxblur=20.0:psy_rd=1.00,0.15:analyse=0x3,0x133 -crf 19 -b:v 1M -minrate 500k -maxrate 2M -bufsize 2M -preset slower -profile:v high422 -level 4.1 -pix_fmt yuv420p -c:a aac -ar 48000 -b:a 128k -movflags +faststart output-file.mp4` Might be over engineered but it works. – Jonathan Morrall Sep 25 '19 at 12:04
  • The question is whether after these adjustments you still get some improvement using libx264 vs h264_nvenc – Alex Cohn Sep 25 '19 at 19:09
  • 1
    With the adjustments using libx264 is better for faster moving scenes. – Jonathan Morrall Sep 27 '19 at 10:22

1 Answers1

14

h264_nvenc uses the NVidia hardware assisted H.264 video encoder. libx264 is a software (CPU) based H.264 encoder.

I would guess that libx264 delivers better quality than h264_nvenc for the same bitrate.

h264_nvenc is probably faster and uses less power. h264_nvenc is only available on NVIDIA hardware.

Markus Schumann
  • 7,636
  • 1
  • 21
  • 27
  • 1
    `I would guess that libx264 delivers better quality than h264_nvenc for the same bitrate.` <- True `h264_nvenc is probably faster and uses less power` <- Also True – szatmary Aug 16 '19 at 19:02
  • Yes. Nvenc makes large files by comparison. Like 10x as large for equivalent quality in our case. – PRMan Jan 05 '22 at 18:17