0

I recorded a game using fraps. The recorded video looked great.

Then I edited the video and encoded it with Huffyuv lossless codec. The video looked great.

Finally, I encoded the video with x264 in FFmpeg and the colors looked washed out.

Screenshots:

Huffyuv (looks great):

Original

x264 (looks washed out):

Copy

x264 settings:

ffmpeg -y -i "D:\Project\TestHuffyuv.avi" -c:v libx264 -b:v 1000k -pass 1 -passlogfile D:\Project\Stats -f mp4 NUL
ffmpeg -y -i "D:\Project\TestHuffyuv.avi" -c:v libx264 -b:v 1000k -pass 2 -passlogfile D:\Project\Stats D:\Project\FFmpeg_MP4.mp4

When I was encoding with x264, I got the following warning:

No pixel format specified, yuv444p for H.264 encoding chosen.
Use -pix_fmt yuv420p for compatibility with outdated media players.

How do I fix the colors so they look the same as in the original video?

UPDATE:

Tried Mulvya's x264 settings (colors still looks washed out):

ffmpeg -y -color_range 2 -i "D:\Project\TestHuffyuv.avi" -vf scale=in_range=full:out_range=tv -c:v libx264 -b:v 1000k -color_range 1 -pass 1 -passlogfile D:\Project\Stats -f mp4 NUL
ffmpeg -y -color_range 2 -i "D:\Project\TestHuffyuv.avi" -vf scale=in_range=full:out_range=tv -c:v libx264 -b:v 1000k -color_range 1 -pass 2 -passlogfile D:\Project\Stats D:\Project\FFmpeg_MP4.mp4

Mulvya

tried "-pix_fmt yuv420p" x264 switch (image looks darker, colors still washed out):

ffmpeg -y -i "D:\Project\TestHuffyuv.avi" -c:v libx264 -pix_fmt yuv420p -b:v 1000k -pass 1 -passlogfile D:\Project\Stats -f mp4 NUL
ffmpeg -y -i "D:\Project\TestHuffyuv.avi" -c:v libx264 -pix_fmt yuv420p -b:v 1000k -pass 2 -passlogfile D:\Project\Stats D:\Project\FFmpeg_MP4.mp4

-pix_fmt yuv420p

tried "-pix_fmt yuvj420p" x264 switch (Image looks darker than the original):

ffmpeg -y -i "D:\Project\TestHuffyuv.avi" -c:v libx264 -pix_fmt yuvj420p -b:v 1000k -pass 1 -passlogfile D:\Project\Stats -f mp4 NUL
ffmpeg -y -i "D:\Project\TestHuffyuv.avi" -c:v libx264 -pix_fmt yuvj420p -b:v 1000k -pass 2 -passlogfile D:\Project\Stats D:\Project\FFmpeg_MP4.mp4

pix_fmt yuvj420p

Full console output: http://pastebin.com/3cJNvVjL

2 Answers2

1

Try

ffmpeg -y -color_range 2 -i "D:\Project\TestHuffyuv.avi" -vf scale=in_range=full:out_range=tv -c:v libx264 -b:v 1000k -color_range 1 -pass 1 -passlogfile D:\Project\Stats -f mp4 NUL
ffmpeg -y -color_range 2 -i "D:\Project\TestHuffyuv.avi" -vf scale=in_range=full:out_range=tv -c:v libx264 -b:v 1000k -color_range 1 -pass 2 -passlogfile D:\Project\Stats D:\Project\FFmpeg_MP4.mp4

It could also be an issue of colorspace but let's see if this doesn't work.

Gyan
  • 38,955
0

There's a thing called color compression. Full RGB is what you want to select to maintain all the color. YUV422 or YUV420 will noticeably take away a lot of color (YUV444 does a little but nearly indistinguishable). The reason why it looked fine on Fraps and HuffYuv is because RGB is their default color space meaning no color compression. In x264 there ought to be YUV 420, 422, 444, RGB, and even this GREY option. Yes the video codec can easily keep all the colors if you set it that way.