Processing EBU's YUV files with FFmpeg
To process YUV files (i.e. raw video), you need to know:
We stumbled upon YUV8 and YUV10 files as provided by the EBU (http://www.ebu.ch/en/technical/hdtv/test_sequences.php). Every frame is a seperate file; fortunately, YUV files can be concatenated.
- YUV10 files cannot be processed by FFmpeg directly, because FFmpeg does not support 10 bits/pixel. One way to get around this is to convert it to YUV8. The following program takes YUV10 on stdin and provides YUV8 on stdout:
#include <stdio.h>
void main() {
int a,b,c,d;
unsigned int k,l,m;
for(;;) {
// read 32 bits
a = getchar();
if(a<0) return;
b = getchar();
c = getchar();
d = getchar();
// first 30 bits contain 3 x 10 bit values
k = (a << 2) | (b >> 6);
l = ((b & 0x3F) << 4) | (c >> 4);
m = ((c & 0x0F) << 6) | (d >> 2);
// crude downsample
putchar(k >> 2);
putchar(l >> 2);
putchar(m >> 2);
}
}
|