ffmpeg -framerate 500/21 -i %d.png -i audio.wav -c:v libx264 -crf 0 -pix_fmt yuv422p10le -c copy output.mkv

I have the above command for converting a PNG sequence of images into 10 bit h.264 video file.

I want to know: how do I modify it to render my PNG sequences as a 12 bit h.265 video? Or do I need a completely different command and what would that be?

Aside: I noticed it in Handbrake, but I see a lot of complaints that Handbrake isn't as clean an encode as raw ffmpeg? I don't know if there's any basis to that or if I should just do it in Handbrake instead.

  • BTW your command, as written, isn't converting the images to H264 but simply storing them in the MKV. This is due to the -c copy at the end. Place it immediately after audio.wav
    – Gyan
    Nov 17, 2018 at 5:49
  • oh okay I guess that makes sense. There any drawback to storing the images in the mkv? is it just large file size?
    – kite
    Nov 17, 2018 at 5:52
  • File size and playability on some players.
    – Gyan
    Nov 17, 2018 at 5:53

1 Answer 1



ffmpeg -framerate 500/21 -i %d.png -i audio.wav -c:v libx265 -x265-params lossless=1 -pix_fmt yuv422p12le -c:a copy output.mkv

You'll need a ffmpg with a libx265 that supports a bit depth of 12. At this time, I can't find such a precompiled binary so you'll have to compile ffmpeg using the auto-build script at https://github.com/jb-alvarado/media-autobuild_suite

  • Why is it like -x265-params lossless=1? Can I use -crf 0 instead? or is h.265 a bit different? also i was always told to use -c copy instead of -c:a or any of the other copy audio variants.
    – kite
    Nov 17, 2018 at 5:49
  • For x265, this is the syntax for lossless encoding.
    – Gyan
    Nov 17, 2018 at 5:50
  • I'm getting an error and its changing to 10bit: Incompatible pixel format 'yuv422p12le' for codec 'libx265', auto-selecting form at 'yuv422p10le
    – kite
    Nov 17, 2018 at 6:51
  • Get the latest ffmpeg binary from ffmpeg.zeranoe.com/builds
    – Gyan
    Nov 17, 2018 at 6:59
  • Getting same problem unfortunately. Testing on a sequence of seven 16 bit png numbered 1.png...etc without the audio bit: ffmpeg -framerate 24 -i %d.png -c:v libx265 -x265-params lossless=1 -pix_fmt yuv422p12le test.mkv
    – kite
    Nov 17, 2018 at 7:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.