Answers.Body: <p>Your source is neither YUV nor Y4M, going by the extension (and also the FFmpeg error you received). x265 is referring to a raw <strong>uncompressed</strong> bitstream by those extensions, not simply the pixel format. A <code>.h264</code> is a raw H.264-encoded bitstream.</p>
  
  <p>To use ffmpeg only, start the cmd like this:</p>
  
  <pre><code>ffmpeg -f h264 -i video.h264 -c:v libx265 ....
  </code></pre>
  
  <p>To use the x265 standalone encoder, use</p>
  
  <pre><code>ffmpeg -f h264 -i video.h264 -f yuv4mpegpipe - | x265 --input - --fps 24 ....
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-02-23T05:44:05.257Z
Answers.LastActivityDate: 2017-02-23T06:38:26.057Z
Answers.LastEditDate: 2017-02-23T06:38:26.057Z
Answers.UserDisplayName: Gyan
Body: <p>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?</p>
  
  <p>The command I used: </p>
  
  <pre><code>x265 --input video.h264 --fps 24 --input-res 1920x1080 --output video.hevc
  </code></pre>
  
  <p>EDIT #1: I just tried to use ffmpeg but give me following error</p>
  
  <blockquote>
    <p>Truncating packet of size 24883200 to 538208<br>
    [rawvideo @ 0x1561e80] Invalid buffer size, packet size 538207 &lt; expected frame_size 24883200
    Error while decoding stream #0:0: Invalid argument</p>
  </blockquote>
  
  <p>EDIT #2: ffmpeg cmd</p>
  
  <pre><code> 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
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-02-22T10:51:53.797Z
Comments.Text: What's your ffmpeg cmd? Note that for x265, `infile can be YUV or Y4M`
Comments.UserDisplayName: Gyan
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-02-22T23:34:01.240Z
Comments.Text: @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.
Comments.UserDisplayName: Hartman
Tags: <encoding><h.265>
Title: How to encode with x265 cli
UserDisplayName: Hartman
ThreadText: # How to encode with x265 cli
  
  (Asked by: username_0 on 2017-02-22)
  
  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
  
  ```
  
  **Tags:** encoding, h.265
  
  > **Comments:**
  > **username_1**: What's your ffmpeg cmd? Note that for x265, `infile can be YUV or Y4M`  
  > **username_0**: @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.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2017-02-23. Score: 2 | Accepted answer
  
  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 ....
  
  ```
  
  
  ---
  
  