I have some raw H.264 10bit videos need to convert to HEVC format, but the encoder only takes some frames (600/170000) to encode, and the video is full of noise. What is the correct way to encode those videos?

The command I used:

x265 --input video.h264 --fps 24 --input-res 1920x1080 --output video.hevc

EDIT #1: I just tried to use ffmpeg but give me following error

Truncating packet of size 24883200 to 538208
[rawvideo @ 0x1561e80] Invalid buffer size, packet size 538207 < expected frame_size 24883200 Error while decoding stream #0:0: Invalid argument

EDIT #2: ffmpeg cmd

 ffmpeg -f rawvideo -vcodec rawvideo -s 1920x1080 -pix_fmt yuv420p10le -i video.h264 -c:v libx265 -crf 18 -preset medium -x265-params profile=main10:level-idc=50:high-tier:vbv-bufsize=100000:vbv-maxrate=100000 video.hevc
  • What's your ffmpeg cmd? Note that for x265, infile can be YUV or Y4M – Gyan Feb 22 '17 at 10:51
  • @Mulvya I updated the post with the ffmpeg cmd. In x265 part, my source is YUV but I don't know how to convert it to Y4M. – Hartman Feb 22 '17 at 23:34

Your source is neither YUV nor Y4M, going by the extension (and also the FFmpeg error you received). x265 is referring to a raw uncompressed bitstream by those extensions, not simply the pixel format. A .h264 is a raw H.264-encoded bitstream.

To use ffmpeg only, start the cmd like this:

ffmpeg -f h264 -i video.h264 -c:v libx265 ....

To use the x265 standalone encoder, use

ffmpeg -f h264 -i video.h264 -f yuv4mpegpipe - | x265 --input - --fps 24 ....
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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