user20856: I am creating a tool that generates frames of RGBA video and pipes it to ffmpeg to create an .mp4 video. Here is the command that I give ffmpeg:
ffmpeg -y -f rawvideo -vcodec rawvideo -s 960x540 -pix_fmt rgba -r 60 -i - 
-an -c:v libx264 -pix_fmt yuv420p -b:v 995328k vigeo_demo.mp4

However, the quality is very, very, poor. The video consists of around 2-px wide lines being drawn across the screen at various angles. The lines are very blurry and blocky. What could be the cause of this and how do I fix it?
Things I've tried:

-q:v 0
crf 1 (crf 0 gives me an error)


user1871: You are downsampling the chroma, so thin lines will lose definition. Either use full chroma sampling
ffmpeg -y -f rawvideo -s 960x540 -pix_fmt rgba -framerate 60 -i - 
       -c:v libx264 -pix_fmt yuv444p -crf 0 video_demo.mp4

or keep pixels as RGB.
ffmpeg -y -f rawvideo -s 960x540 -pix_fmt rgba -framerate 60 -i - 
       -c:v libx264rgb -crf 0 video_demo.mp4


20856: <p>I am creating a tool that generates frames of RGBA video and pipes it to ffmpeg to create an .mp4 video. Here is the command that I give ffmpeg:</p>

<pre><code>ffmpeg -y -f rawvideo -vcodec rawvideo -s 960x540 -pix_fmt rgba -r 60 -i - 
-an -c:v libx264 -pix_fmt yuv420p -b:v 995328k vigeo_demo.mp4
</code></pre>

<p>However, the quality is very, very, poor. The video consists of around 2-px wide lines being drawn across the screen at various angles. The lines are very blurry and blocky. What could be the cause of this and how do I fix it?</p>

<p>Things I've tried:</p>

<ul>
<li><code>-q:v 0</code></li>
<li><code>crf 1</code> (<code>crf 0</code> gives me an error)</li>
</ul>
 1871: <p>You are downsampling the chroma, so thin lines will lose definition. Either use full chroma sampling</p>

<pre><code>ffmpeg -y -f rawvideo -s 960x540 -pix_fmt rgba -framerate 60 -i - 
       -c:v libx264 -pix_fmt yuv444p -crf 0 video_demo.mp4
</code></pre>

<p>or keep pixels as RGB.</p>

<pre><code>ffmpeg -y -f rawvideo -s 960x540 -pix_fmt rgba -framerate 60 -i - 
       -c:v libx264rgb -crf 0 video_demo.mp4
</code></pre>
