[FFmpeg-user] Trying to use the same range of colors in output?

Carl Eugen Hoyos ceffmpeg at gmail.com
Thu Sep 15 16:35:54 EEST 2016

2016-09-15 15:14 GMT+02:00 stigma <istigma0 at gmail.com>:
> I'm trying to put the same range of colors that sdl uses.
> When I put this code on ffmpeg, I can capture my PCI TV card with
> an preview to see what happens, and I notice that hte sdl preview has
> a range of 16-235 instead of 0-255 that the output puts. Here's the
> code that I'm using and an screenshot:
> Code:
> ffmpeg -framerate 29.97 -vsync 1 -video_size 720x480 -f dshow
> -rtbufsize 250000k -crossbar_video_input_pin_number 1 -i
> video="713x BDA Analog Capture":audio="Line (VIA High Definition Audio"
> -t 1:16:00 -vf "yadif=0:0:1,format=rgb24" -c:v libx264 -preset medium
> -crf 15 -maxrate 1800k -bufsize 3500k -preset medium -c:a aac -b:a 192k
> -strict -2 -r 29.97 "ttt.mp4" -c:v copy -an -f sdl "VHS"

Complete, uncut console output missing.

I suspect -framerate 30000/1001 should improve the timing of the
output video.
Are you sure that the video you are recording is not telecined but
interlaced? It is a very bad idea to put telecined video through
the yadif filter, there are several inverse telecine filters...
Why are you using "format=rgb24"? The libx264 encoder does
not support rgb24, so afaict, you are starting several colour space
conversions (that can affect video quality), just avoid any
format option.
The option "-strict -2" should not be necessary anymore: The
native aac encoder was declared stable.

You write video to an mp4 file with libx264 video. This video definitely
uses limited range (16-235) unless you force the x264 encoder to
use full range (which is incompatible with most playback software).

Since you are using -vcodec copy for the sdl output, the range cannot
be adjusted. (I do not know if sdl 1 supports setting the range but the
output device doesn't do it afaics.)

Imo, the important question is:
Does the dshow input use the correct colourspace?
You could test with:
$ ffmpeg -f dshow -i ... -vcodec copy -f rawivdeo -vframes 1 out
and see if what the range inside the output file is and which
pix_fmt is shown on the console.

Carl Eugen

More information about the ffmpeg-user mailing list