<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
     xmlns:admin="http://webns.net/mvcb/"
     xmlns:content="http://purl.org/rss/1.0/modules/content/"
     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
	<channel> 

	<title>Comments on: decoding 10bit video</title>
	<link>http://ask.metafilter.com/95398/decoding-10bit-video/</link>
	<description>Comments on Ask MetaFilter post decoding 10bit video</description>
	<pubDate>Mon, 30 Jun 2008 11:41:22 -0800</pubDate>
	<lastBuildDate>Mon, 30 Jun 2008 11:41:22 -0800</lastBuildDate>
	<language>en-us</language>
	<docs>http://blogs.law.harvard.edu/tech/rss</docs>
	<ttl>60</ttl>

	<item>
		<title>Question: decoding 10bit video</title>
		<link>http://ask.metafilter.com/95398/decoding-10bit-video</link>	
		<description>Decoding a 10bit video file ain&apos;t easy... &lt;br /&gt;&lt;br /&gt; I own an &lt;a href=&quot;http://www.reel-stream.com/andromeda.php&quot;&gt;HD camera mod&lt;/a&gt; that records uncompressed 8bit and 10bit video files directly to a Mac&apos;s HDD. The camera company provided software to capture and render the video files. The rendering software never worked correctly with the 10bit files and we were waiting for an updated release. The company was &lt;a href=&quot;http://dvinfo.net/conf/showthread.php?t=109186&quot;&gt;sold&lt;/a&gt; and the rendering software was *not* updated and is now no longer supported. &lt;br&gt;
&lt;br&gt;
:(&lt;br&gt;
&lt;br&gt;
I wondered how hard it would be to write a Quicktime component under OS X 10.4 to directly read both the 8bit and 10bit files. &lt;br&gt;
&lt;br&gt;
I bought some red, green and blue felt from the art store and recorded 8bit and 10bit clips of each color on an overcast day.&lt;br&gt;
&lt;br&gt;
Starting with the 8bit files, I used a hex viewer to examine the &quot;red&quot; video file, and saw numbers like this (converted to decimal):&lt;br&gt;
&lt;br&gt;
114 31 32 112 29 32 [...]&lt;br&gt;
&lt;br&gt;
Well, that was easy. A quick check of the &quot;green&quot; video file confirmed that the byte order of each pixel is stored R G B. And indeed, my codec can now open successfully open an 8bit file. Hooray! But wait...&lt;br&gt;
&lt;br&gt;
Using the same hex viewer I peek at the 10bit &quot;red&quot; video file, which was recorded using the same exposure as the 8bit file so I kind of know what numbers to expect, and I get this (again converted to decimal):&lt;br&gt;
&lt;br&gt;
212 245 129 137 &lt;em&gt;120&lt;/em&gt; 123 44 130 156 &lt;em&gt;32&lt;/em&gt; 142 136 71 200 &lt;em&gt;34&lt;/em&gt; [...]&lt;br&gt;
&lt;br&gt;
The italics are mine, they are (kinda) the R G B values I&apos;m looking for, I just didn&apos;t expect them to show up like that. I&apos;ve seen examples of how 10bit DPX image files are packed but the pattern I see in my files just doesn&apos;t make sense to me.&lt;br&gt;
&lt;br&gt;
Do they make sense to anyone else? I really want to use these 10bit files, and if I can figure out the R G B pattern I&apos;ll be good to go.&lt;br&gt;
&lt;br&gt;
For the record I did email the rendering software&apos;s developer asking for a hint. He did not reply.</description>
		<guid isPermaLink="false">post:ask.metafilter.com,2008:site.95398</guid>
		<pubDate>Mon, 30 Jun 2008 11:14:58 -0800</pubDate>
		<dc:creator>shino-boy</dc:creator>
		
			<category>video</category>
		
			<category>10bit</category>
		
			<category>Mac</category>
		
			<category>packing</category>
		
			<category>format</category>
		
			<category>technical</category>
		
	</item> <item>
		<title>By: pombe</title>
		<link>http://ask.metafilter.com/95398/decoding-10bit-video#1392668</link>	
		<description>It&apos;s not clear from your post how you did the 10 bit -&amp;gt; decimal conversion, but I can imagine a couple different ways to store the 10 bit data.  &lt;br&gt;
&lt;br&gt;
1. Packed so that every 10 bits is a value; no alignment between bytes and 10 bit values (i.e. the first 10 bits are red, the next 10 green, etc.&lt;br&gt;
&lt;br&gt;
2. Zero padded so that the 10 bit chunks align with byte boundaries (i.e. 6 zeros followed by 10 bits).&lt;br&gt;
&lt;br&gt;
3. Zero padded the other way (10 bits followed by 6 zeros).&lt;br&gt;
&lt;br&gt;
4. Some more complicated encoding....&lt;br&gt;
&lt;br&gt;
If you look at the binary you should be able to tell if it&apos;s one of the first three possibilities pretty quickly.  Maybe posting some of the binary data here would help?</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.95398-1392668</guid>
		<pubDate>Mon, 30 Jun 2008 11:41:22 -0800</pubDate>
		<dc:creator>pombe</dc:creator>
	</item><item>
		<title>By: demiurge</title>
		<link>http://ask.metafilter.com/95398/decoding-10bit-video#1392673</link>	
		<description>I&apos;ve dealt with 12 bit scanner data and all of that was encoded using a 16 bit format that only had some of the bits being used.  If this data is uncompressed and you know the number of frames and size of each frame, you can estimate the file size and see if this is true.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.95398-1392673</guid>
		<pubDate>Mon, 30 Jun 2008 11:46:10 -0800</pubDate>
		<dc:creator>demiurge</dc:creator>
	</item><item>
		<title>By: rajbot</title>
		<link>http://ask.metafilter.com/95398/decoding-10bit-video#1392750</link>	
		<description>It looks like you messed up when you did your hex-&amp;gt;decimal conversion for the 10-bit sequence. You should be seeing peaks around 1023 for the red channel, and it looks like you just pasted your hex editor&apos;s 8-bit decimal representation. If you expand out what you pasted (assuming RGB packing order) into 10 bits, you get something like (&apos;1101010011b&apos;, &apos;1101011000b&apos;, &apos;0001100010b&apos;) or (851, 856, 98). That&apos;s probably not right, but if you post your files we can peak at them. BTW, are these .mov files, or raw bitstreams? If they are mov files, are you sure you are looking in the right place (mdat atom)?&lt;br&gt;
&lt;br&gt;
In answer to your question &quot;I wondered how hard it would be to write a Quicktime component&quot;, as someone who used to write QT compentents for a living, I would say it if farily complicated. The learning curve is *huge*. I imagine it would take at least a couple weeks for someone who doesn&apos;t know the QT ecosystem to just get up to speed.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.95398-1392750</guid>
		<pubDate>Mon, 30 Jun 2008 12:47:31 -0800</pubDate>
		<dc:creator>rajbot</dc:creator>
	</item><item>
		<title>By: shino-boy</title>
		<link>http://ask.metafilter.com/95398/decoding-10bit-video#1392839</link>	
		<description>Thank you for your answers so far. I can post some data from the &quot;red&quot; file tonight, after I get home from work.&lt;br&gt;
&lt;br&gt;
rajobt:&lt;br&gt;
The video files are raw bitsreams; there&apos;s no header or other information in there at all. It did take me several months to get the 8bit component working, being a hobbyist and all.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.95398-1392839</guid>
		<pubDate>Mon, 30 Jun 2008 13:55:12 -0800</pubDate>
		<dc:creator>shino-boy</dc:creator>
	</item><item>
		<title>By: shino-boy</title>
		<link>http://ask.metafilter.com/95398/decoding-10bit-video#1392840</link>	
		<description>Pardon me, it should be &quot;rajbot&quot;.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.95398-1392840</guid>
		<pubDate>Mon, 30 Jun 2008 13:55:51 -0800</pubDate>
		<dc:creator>shino-boy</dc:creator>
	</item><item>
		<title>By: shino-boy</title>
		<link>http://ask.metafilter.com/95398/decoding-10bit-video#1393289</link>	
		<description>To do the hex-&amp;gt;decimal conversion I just read the decimal values from the &lt;a href=&quot;http://www.suavetech.com/0xed/0xed.html&quot;&gt;hex viewer&lt;/a&gt; that I&apos;ve been using.&lt;br&gt;
&lt;br&gt;
I uploaded the &quot;red&quot; 10bit video file to my website :&lt;br&gt;
&lt;br&gt;
&lt;a href=&quot;http://www.curtstewart.com/red.dvx1&quot;&gt;red.dvx1&lt;/a&gt;&lt;br&gt;
(right click to download)&lt;br&gt;
&lt;br&gt;
I&apos;m trying your suggestions now but am making a lot of mistakes because it&apos;s late and I&apos;ve had a long day.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.95398-1393289</guid>
		<pubDate>Tue, 01 Jul 2008 00:13:19 -0800</pubDate>
		<dc:creator>shino-boy</dc:creator>
	</item><item>
		<title>By: filmgeek</title>
		<link>http://ask.metafilter.com/95398/decoding-10bit-video#1393332</link>	
		<description>I&apos;d absolutely email two guys; first the guy who does the &lt;a href=&quot;http://www.gluetools.com/&quot;&gt;Glue tools&lt;/a&gt; for quicktime, and the second would be Graham &lt;a href=&quot;http://nattress.com/&quot;&gt;Nattress&lt;/a&gt;.&lt;br&gt;
&lt;br&gt;
Both these guys might be able to provide strong insights on how to develop a codec (both have done serious decoding for film, the Phantom Camera and the Red camera.)&lt;br&gt;
&lt;br&gt;
(I&apos;d have posted any other file other than the &apos;red&apos; one, so there&apos;d be no confusion of what the file is that you have up.)</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.95398-1393332</guid>
		<pubDate>Tue, 01 Jul 2008 03:43:28 -0800</pubDate>
		<dc:creator>filmgeek</dc:creator>
	</item><item>
		<title>By: jepler</title>
		<link>http://ask.metafilter.com/95398/decoding-10bit-video#1393440</link>	
		<description>Looking at the file in 15-byte chunks in binary there is a clear repetitive structure.  (15 bytes is the smallest number of bytes which is a multiple of 30 bits).  &lt;br&gt;
&lt;pre&gt;110101001111010110000001100010010111100001111011001011001000001010011100001000001000111010001000010001111100100000100010&lt;br&gt;
110011110000010110110010110010000111100010000000000011000100001011011101001000011000011001101100111001111000011100100001&lt;br&gt;
110010101111100100110001110010000111100001111011000100001001001001011101001000001001000001011100101101111100011100100000&lt;br&gt;
111001101111100111100001110010000111000110000110001101001100001000011101000111111000010001000000110001111100011100100000&lt;br&gt;
111000001111100100010001010010010111010101111000111001000100000100011110001000001000100001101100000001110000100000100101&lt;br&gt;
110110110000000100000010010010000111110010000011010011001010001011011101001000011000110101101100100101111000100000100011&lt;br&gt;
110101111111000111010001010010000111110110000011000011001011001011011011000111011000100001011100000101111100100000100000&lt;br&gt;
110100011110110101110001010010000111010001111101010011001101001010011100000111110111110110100100110001111000011100100100&lt;br&gt;
101110001111010110010001100010000111011001111110000010001101001010011100001000011001000111011000111001111100011100100000&lt;br&gt;
^^                               ^^^                               ^^                                ^^^&lt;/pre&gt;15*8=120 bits should be 4 pixels, but looking at 10-bit or 30-bit chunks didn&apos;t immediately jump out like pixels for me.&lt;pre&gt;110101001111010110000001100010 010111100001111011001011001000 001010011100001000001000111010 001000010001111100100000100010&lt;br&gt;
110011110000010110110010110010 000111100010000000000011000100 001011011101001000011000011001 101100111001111000011100100001&lt;br&gt;
110010101111100100110001110010 000111100001111011000100001001 001001011101001000001001000001 011100101101111100011100100000&lt;br&gt;
&lt;br&gt;
1101010011 1101011000 0001100010 0101111000 0111101100 1011001000 0010100111 0000100000 1000111010 0010000100 0111110010 0000100010&lt;br&gt;
1100111100 0001011011 0010110010 0001111000 1000000000 0011000100 0010110111 0100100001 1000011001 1011001110 0111100001 1100100001&lt;br&gt;
1100101011 1110010011 0001110010 0001111000 0111101100 0100001001 0010010111 0100100000 1001000001 0111001011 0111110001 1100100000&lt;br&gt;
1110011011 1110011110 0001110010 0001110001 1000011000 1101001100 0010000111 0100011111 1000010001 0000001100 0111110001 1100100000&lt;br&gt;
1110000011 1110010001 0001010010 0101110101 0111100011 1001000100 0001000111 1000100000 1000100001 1011000000 0111000010 0000100101&lt;br&gt;
1101101100 0000010000 0010010010 0001111100 1000001101 0011001010 0010110111 0100100001 1000110101 1011001001 0111100010 0000100011&lt;br&gt;
1101011111 1100011101 0001010010 0001111101 1000001100 0011001011 0010110110 1100011101 1000100001 0111000001 0111110010 0000100000&lt;br&gt;
1101000111 1011010111 0001010010 0001110100 0111110101 0011001101 0010100111 0000011111 0111110110 1001001100 0111100001 1100100100&lt;br&gt;
1011100011 1101011001 0001100010 0001110110 0111111000 0010001101 0010100111 0000100001 1001000111 0110001110 0111110001 1100100000&lt;br&gt;
&lt;/pre&gt;The bits of each pixel must be interleaved in some way that is not yet apparent.&lt;br&gt;
&lt;br&gt;
How many pixels do you expect in the image?  The size of the file is enough for 2505289.8666666667 pixels, which is more than 1920*1200.  That the file size is not a multiple of 15 bytes is interesting, too (in fact, the file length of 9394837 bytes is a prime number)</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.95398-1393440</guid>
		<pubDate>Tue, 01 Jul 2008 08:00:47 -0800</pubDate>
		<dc:creator>jepler</dc:creator>
	</item><item>
		<title>By: shino-boy</title>
		<link>http://ask.metafilter.com/95398/decoding-10bit-video#1393539</link>	
		<description>I&apos;m sorry, I should have posted more information about the video file:&lt;br&gt;
&lt;br&gt;
red.dvx1&lt;br&gt;
770x392 pixels / frame&lt;br&gt;
R G B channels / pixel (no alpha)&lt;br&gt;
progressive (should not be interleaved)&lt;br&gt;
&lt;br&gt;
I&apos;m going to try the following method when I get home tonight - &lt;br&gt;
At 10bits I&apos;m expecting the *typical* red pixel value to be, in decimal and R G B order:&lt;br&gt;
&lt;br&gt;
458 125 128&lt;br&gt;
&lt;br&gt;
I&apos;ll convert these values to binary and pack them with my best guess, and see if I can spot a pattern in the real file.&lt;br&gt;
&lt;br&gt;
Thanks again for all your suggestions.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.95398-1393539</guid>
		<pubDate>Tue, 01 Jul 2008 09:33:58 -0800</pubDate>
		<dc:creator>shino-boy</dc:creator>
	</item><item>
		<title>By: rajbot</title>
		<link>http://ask.metafilter.com/95398/decoding-10bit-video#1393933</link>	
		<description>Something still seems wrong. The size of a frame in bits should be (770*392*10*3). The file you posted doesn&apos;t seem to have an integer number of frames:&lt;br&gt;
&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; 9394837.0*8/(770*392*10*3)&lt;br&gt;
8.3000591925081721..</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.95398-1393933</guid>
		<pubDate>Tue, 01 Jul 2008 13:39:39 -0800</pubDate>
		<dc:creator>rajbot</dc:creator>
	</item><item>
		<title>By: bdc34</title>
		<link>http://ask.metafilter.com/95398/decoding-10bit-video#1394904</link>	
		<description>I don&apos;t want to hold you up on your project and the fun/learning it will provide, but have you considered MEncoder?&lt;br&gt;
&lt;br&gt;
Here&apos;s an option from the man page:&lt;br&gt;
&lt;br&gt;
&#8722;rawvideo &lt;option1&gt;&lt;br&gt;
    This option lets you play raw video files. You have to use &#8722;demuxer rawvideo as well.&lt;br&gt;
    Available options are:	&lt;br&gt;
&lt;br&gt;
    fps=&lt;value&gt;	&lt;br&gt;
    rate in frames per second (default: 25.0)	&lt;br&gt;
&lt;br&gt;
    sqcif|qcif|cif|4cif|pal|ntsc	&lt;br&gt;
    set standard image size&lt;br&gt;
	&lt;br&gt;
    w=&lt;value&gt;	&lt;br&gt;
   image width in pixels&lt;br&gt;
	&lt;br&gt;
    h=&lt;value&gt;	&lt;br&gt;
    image height in pixels&lt;br&gt;
	&lt;br&gt;
    i420|yv12|yuy2|y8	&lt;br&gt;
    set colorspace&lt;br&gt;
	&lt;br&gt;
    format=&lt;value&gt;	&lt;br&gt;
    colorspace (fourcc) in hex or string constant. Use &#8722;rawvideo format=help for a list of possible strings.&lt;br&gt;
	&lt;br&gt;
    size=&lt;value&gt;	&lt;br&gt;
    frame size in Bytes&lt;br&gt;
	&lt;br&gt;
   EXAMPLE:&lt;br&gt;
	&lt;br&gt;
    mplayer foreman.qcif -demuxer rawvideo -rawvideo qcif	&lt;br&gt;
    Play the famous &quot;foreman&quot; sample video.&lt;br&gt;
	&lt;br&gt;
    mplayer sample-720x576.yuv -demuxer rawvideo -rawvideo w=720:h=576	&lt;br&gt;
    Play a raw YUV sample.&lt;/option1&gt;&lt;/value&gt;&lt;/value&gt;&lt;/value&gt;&lt;/value&gt;&lt;/value&gt;</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.95398-1394904</guid>
		<pubDate>Wed, 02 Jul 2008 09:06:57 -0800</pubDate>
		<dc:creator>bdc34</dc:creator>
	</item><item>
		<title>By: shino-boy</title>
		<link>http://ask.metafilter.com/95398/decoding-10bit-video#1394981</link>	
		<description>!&lt;br&gt;
&lt;br&gt;
I use mplayer at work but never knew it could play raw files. I&apos;m hoping I can use it to test different raw settings and will try it tonight, thanks.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.95398-1394981</guid>
		<pubDate>Wed, 02 Jul 2008 10:06:23 -0800</pubDate>
		<dc:creator>shino-boy</dc:creator>
	</item>
	</channel>
</rss>
