Hands-on Video Course - "RAW Video"

1,585 views

Published on

Slides from "hands on video" course
explains the color model as well as YUV decimation and packing in theory and practice using FFMPEG, FFPROBE and YUV player

Published in: Technology, Business
0 Comments
7 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,585
On SlideShare
0
From Embeds
0
Number of Embeds
32
Actions
Shares
0
Downloads
0
Comments
0
Likes
7
Embeds 0
No embeds

No notes for slide

Hands-on Video Course - "RAW Video"

  1. 1. 1Hands-on Video CourseHands-on Video CourseYossi CohenJune 2013Lecture 2RAW Video
  2. 2. 2Hands-on Video CourseOverviewIntro to color theoryImage PackingEx1- Hands on Image packing
  3. 3. 3Hands-on Video CourseLosless CompressionModel Based CompressionModelBasedTransform/sQuantize /Prioritize ReorderEntropyCodingSample +PreProcessingBit rate control
  4. 4. 4Hands-on Video CourseCOLORRepresentationDecimationConversion
  5. 5. 5Hands-on Video CourseHuman Visual SystemThe human eye has two basic light receptors:Rods – Light Intensity receptorsCons – Colored light receptors
  6. 6. 6Hands-on Video CourseRods and Cons Frequency Reception
  7. 7. 7Hands-on Video Course4.2 Color Models in ImagesColors spaces are used to store, display, printimages.Images are represented using different:Color spacesColor DepthColor Decimation MethodsPixel/Plane Interleaving methods
  8. 8. 8Hands-on Video CourseColor Spaces Color Spaces RGB – Each pixel is provided coordinates in 3D space.Coordinates are in Red, Blue and Green. This is how weperceive color YUV – Conversion of the color to a Light (Y) based system.Y and V are Color Complements HSV – Hue, Saturation, Value YCbCr and more
  9. 9. 9Hands-on Video CourseRGB->YUV Color TransformRGBRBGYUV
  10. 10. 10Hands-on Video CourseColor matching How can we compare colorsso that the content creatorsand consumers know whatthey are seeing? Many different waysincluding CIE chromacitydiagram
  11. 11. 11Hands-on Video CourseVideo Color Transforms Largely derived from older analog methods of codingcolor for TV. Luminance is separated from colorinformation. YIQ is used to transmit TV signals in North America andJapan.This coding also makes its way into VHS videotape coding in these countries since video tapetechnologies also use YIQ. In Europe, video tape uses the PAL or SECAM codings,which are based on TV that uses a matrix transformcalled YUV. Finally, digital video mostly uses a matrix transform calledYCbCr that is closely related to YUV
  12. 12. 12Hands-on Video CourseYUV Separation
  13. 13. 13Hands-on Video CourseYUV Color Model•YUV codes a luminance signal (for gamma-correctedsignals) equal to Y , the “luma".•Chrominance refers to the difference between a colorand a reference white at the same luminance. (U and V)The transform is:
  14. 14. 14Hands-on Video CourseYIQ Color ModelYIQ is used in NTSC color TV broadcasting.Again, gray pixels generate zero (I;Q)chrominance signal.I and Q are a rotated version of U and V .The transform is:
  15. 15. 15Hands-on Video CourseYCbCr Color Model1. The Rec. 601 standard for digital video usesanother color space YCbCr which closelyrelated to the YUV transform.2. The YCbCr transform is used in JPEG imagecompression and MPEG video compression.For 8-bit coding:
  16. 16. 16Hands-on Video CourseColor DecimationRods>>ConsSpatial Representation(Light) >> SR(Color)Current Representation of light by 3 coordinatesper pixel waste space.Color Decimation is done only in Light based colorrepresentation (not in RGB)
  17. 17. 17Hands-on Video CourseColor DecimationYUV 4:4:4 – No Color decimationUsed in studio editingWiFi DisplayYUV 4:2:2 – UV are decimated by twoHigh end video codingYUV 4:2:0 – UV pixels are decimated by 4Standard video codingUY VUY VUYV
  18. 18. 18Hands-on Video CourseColor PackingWe could arrange the “Color” pixels in severalways:Packed: YUV|YUV|YUVPlaner: YYYYYY….UUUUU…..VVVVVSemi Planer: YYYYYYY UVUVUV
  19. 19. 19Hands-on Video CourseCommon Color Packing formatsFor video coding well useProgressive input (and not interleaved)YUV 4:2:0 DecimationPlaner Color Packing (yuv420p / I420)
  20. 20. 20Hands-on Video CourseCOLOR DECIMATIONPACKING AND CONVERSIONLab 1
  21. 21. 21Hands-on Video CourseOpen the file with YUVPlayerJust open it as default what do you get?
  22. 22. 22Hands-on Video CourseYUV PlayerDid you got this? Why?1. It seems that YUV file-format does not holdformat information2. There are many YUV formatsWhat to do?
  23. 23. 23Hands-on Video CoursePlay & Probe fileFFPLAY akiyo_cif.yuvCant play missing Image sizeFFPlay –s 352x288 akyo_cif.yuvffprobe.exe -video_size 352x288 akiyo_cif.yuvInput #0, rawvideo, from akiyo_cif.yuv:Duration: 00:00:12.00, start: 0.000000, bitrate: 30412 kb/sStream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p,352x288, 30412 kb/s, 25 tbr, 25 tbn, 25 tbc
  24. 24. 24Hands-on Video CoursePlay & Probe fileFFPLAY akiyo_cif.y4mFFProbe akiyo_cif.y4mInput #0, yuv4mpegpipe, from akiyo_cif.y4m:Duration: N/A, bitrate: N/AStream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p,352x288, SAR 128:117 DAR 1408:1053, 29.97 fps, 29.97tbr, 29.97 tbn, 29.97 tbc
  25. 25. 25Hands-on Video CourseBack to YUV PlayerSelect YUV420And if we need it in UYVY (YUV422 Packed)ffmpeg -s 352x288 -i akiyo_cif.yuv -pix_fmtuyvy422 akiyo_cif_uyvy.yuv
  26. 26. 26Hands-on Video CourseEx 1Create Akiyo YUV file which is opened usingYUV422 option of YUVPlayerWhat is the difference between this 4:2:2 formatand the previous one?Can we open this format using Y only setting?If not create a Y only fileIs there an option for a YUV file with headers?Save akiyo in raw YUV with headers
  27. 27. 27Hands-on Video CourseEX1 answersCheck FFMPEG –pix_fmtsffmpeg -s 352x288 -i akiyo_cif.yuv -pix_fmtyuv422p akiyo_cif_422p.yuvffmpeg -s 352x288 -i akiyo_cif.yuv -pix_fmt grayakiyo_cif_y.yuv
  28. 28. 28Hands-on Video CourseY4M filel FormatY4M is a YUV file with a header.Header statesYUV decimation and packingFrame resolutionFPS

×