[FFmpeg-user] How can I determine if a 10bit videofile has full 10bit video data or 8bit (+ 2bits zeros) data

Dave Rice dave at dericed.com
Fri Jan 16 16:40:17 CET 2015

Hi Christoph,

> On Jan 16, 2015, at 10:03 AM, Moritz Barsnick <barsnick at gmx.net> wrote:
> On Fri, Jan 16, 2015 at 14:10:38 +0100, Christoph Gerstbauer wrote:
>> I am searching for a possibility to check if a 10bit 4:2:2 videofile 
>> (v210 codec or ffvhuff codec) has
>> a) 8bit+2empty bits or
>> b) full 10bit data
>> in the video stream.
> You'll probably need to export it to raw YUV or RGB (depending on the
> input color space) and inspect the least significant bits. This might
> be easier with a small libav* program than ffmpeg. My first shot would
> be trying to understand the raw output formats, and to parse them with
> a pipe to a perl one-liner using unpack(). ;-)

I pipe the data to xxd for this, such as:
ffmpeg -i v210.mov -c:v rawvideo -f rawvideo - | xxd -c 2 -b

Since the rawvideo of v210 is 16 bits, I use -c 2 to show the output in 2 bytes per row (-c 2). You’ll get an output that looks like this:

008322e: 11011101 00000001
0083230: 01001000 00000010

In the case I’ll see the last two (right most) bits of the first byte toggling indicated that it is actually using 10 bits of detail. If the v210 was 8 plus two zeros then the last two bits of the first byte would always be zero. Unfortunately there is a lot of video hardware that works as 8 bits so often those who are intending to digitize analog video to 10 bit are actually creating 10 bit files with the least significant bits simply being padding. Some digital videotapes also decode to 8 bit but are received over 10 bit SDI so this same process can be used to verify if the SDI contains actual 10 bit video or some amount of padding.
Best Regards,
Dave Rice

More information about the ffmpeg-user mailing list