Record raw video with ffmpeg keeping the full color range
In this case, the problem didn't come from ffmpeg/avconv.

The rawvideo source I use offers different color formats to be used:


argb32
rgb24
bgr24
yuv444
yuv420
[...]


When I extract a png file (which was fine), the bgr24 color format is used.
When I capture a video, avconv automatically chose one of the yuv formats.
I guess the clamping to (16..235) did happen in the driver itself, that's why I couldn't influence it.

By giving the parameter -input_format bgr24 to the input device, I chose the unclamped value range and the capturing worked fine.

Final command line, with yuv420p as target format which produces even a Windows Media Player complatible output:

avconv -f video4linux2 -input_format bgr24 -i /dev/video0 -vcodec libx264 -pix_fmt yuv420p -color_range 2 -crf 14 -t 120 -y out.mp4