FFmpeg UHD encoding (piping to x265)

7k views Asked by At

Update based on the good answers:

Source: Prores HQ 4:2:2 10bit 4kp25 REC:2020

Heres my syntax now:

ffmpeg -pix_fmt yuv422p10 -i JUNGLES_PLUTO_UHD_HDR_HLG.mov -pix_fmt yuv420p10 -f yuv4mpegpipe - | x265 --y4m - --input-res 3840x2160 --fps 25 --preset veryslow --b-adapt 2 --ref 4 --no-open-gop --keyint 50 --min-keyint 50 --no-scenecut --profile main --level-idc 5 --no-high-tier --sar 1:1 --colorprim bt709 --transfer bt709 --colormatrix bt709 --bframes 3 --hrd --vbv-bufsize 25000 --bitrate 25000 --vbv-maxrate 25000 --aud --no-info --b-pyramid -o test.h265

output: Option pixel_format not found. 

Target: (non-hdr UHD STB)

hevc.file 
rec:709
  • Question 1: How does one pipe correctly from ffmpeg to x265 ?
  • Question 2: How can one make sure the cpus are all taxed? I have 16vcores, but im getting like 2-3% usage on all
  • Question 3: Any suggestions on the parameters to increase the quality?
  • Question 4: Since the content is BT2020, but my target device is not currently able to display/render BT2020, but BT709.. how would i change the syntax to enable this in the best way..(downscale it) Would :

    --colorprim bt2020 --transfer bt2020 --colormatrix bt709

be correct?

1

There are 1 answers

2
llogan On

Option pixel_format not found.

Remove the -pix_fmt yuv422p10 input option. This isn't needed because your input is not rawvideo and ffmpeg can automatically detect it from your input file.

Question 1: How does one pipe correctly from ffmpeg to x265 ?

Avoiding the piping

If your ffmpeg supports libx265 then you don't even need to pipe:

ffmpeg -i input.mov -c:v libx265 -crf 28 output.mp4

Using a pipe

You didn't provide any output from ffmpeg. When piping you can use - as the output.

ffmpeg -i input.mov -f yuv4mpegpipe - | x265 --y4m - -o output.265
  • The input is MOV, so this container has the pixel format, size, and frame rate info included, so you can omit all of your input options. Also, as Andrey mentioned in a comment, you won't need -f rawvideo either because it will override the automatic selection of the MOV demuxer.

  • If the you are actually inputting rawvideo then you would need the additional options, but they should be changed: -pxt_fmt to -pixel_format, -s to -video_size, and -r to -framerate as shown in the rawvideo demuxer documentation.

  • Use -f yuv4mpegpipe not -t yuv4mpegpipe.

  • You don't need to declare --input-res or --fps with Y4M inputs for x265.

Question 2: How can one make sure the cpus are all taxed? I have 16vcores, but im getting like 2-3% usage on all

You can run multiple encoding instances at once.

Question 3: Any suggestions on the parameters to increase the quality?

Use --crf instead of --bitrate. A lower value is a higher quality. Range is 0-51. See FFmpeg Wiki: H.265.

Question 4: Since the content is BT2020, but my target device is not currently able to display/render BT2020, but BT709.. how would i change the syntax to enable this in the best way..(downscale it)

You can downscale with ffmpeg: -vf scale=-2:1080