Bài giảng Đa phương tiện và các ứng dụng giải trí - Chương V: Video

pdf 79 trang ngocly 1080
Bạn đang xem 20 trang mẫu của tài liệu "Bài giảng Đa phương tiện và các ứng dụng giải trí - Chương V: Video", để tải tài liệu gốc về máy bạn click vào nút DOWNLOAD ở trên

Tài liệu đính kèm:

  • pdfbai_giang_da_phuong_tien_va_cac_ung_dung_giai_tri_chuong_v_v.pdf

Nội dung text: Bài giảng Đa phương tiện và các ứng dụng giải trí - Chương V: Video

  1. IT4440 Đa phương tiện và các ứng dụng giải trí (MULTIMEDIA AND GAMES)
  2. Nội dung môn học Tuần Chủ đề Số tiết 1 Giới thiệu về môn học 1 – 5 Phần I. Tổng quan về thông tin đa phương tiện và các kỹ thuật xử lý 15 1 Chương I: Nhập môn Multimedia 1 1 Chương II: Một số kiến thức cơ bản 1 2 Chương III: Ảnh 4 3 Chương IV: Màu 3 4 Chương V: Video 3 5 Chương VI: Audio 3 6 – Phần II. Một số ứng dụng đa phương tiện Chương V: Multimedia- ứng dụng và giải trí Chương VI: Ứng dụng web Chương VII: Ứng dụng mobile Chương VIII: Ứng dụng 3D Chương IX: Ứng dụng Game Bảo vệ Bài tập lớn, Tổng kết ôn tập
  3. Nội dung môn học Tuần Chủ đề Số tiết 1 Giới thiệu về môn học 1 – 5 Phần I. Tổng quan về thông tin đa phương tiện và các kỹ thuật xử lý 15 1 Chương I: Nhập môn Multimedia 1 1 Chương II: Một số kiến thức cơ bản 1 2 Chương III: Ảnh 4 3 Chương IV: Màu 3 4 Chương V: Video 3 5 Chương VI: Audio 3 6 – Phần II. Một số ứng dụng đa phương tiện Chương V: Multimedia- ứng dụng và giải trí Chương VI: Ứng dụng web Chương VII: Ứng dụng mobile Chương VIII: Ứng dụng 3D Chương IX: Ứng dụng Game Bảo vệ Bài tập lớn, Tổng kết ôn tập
  4. Chương V: Video Mục tiêu của chương Một số khái niệm Video là gì ? Thu nhận video như thế nào ? Các chuẩn video Nén video Soạn thảo và xử lý video Truyền video Tổng kết chương Tài liệu tham khảo
  5. V.1 Mục tiêu của chương Người học sẽ: Được trang bị kiến thức về cách thức tạo, biểu diễn, lưu trữ video Được giới thiệu nguyên lý và phương pháp nén, soạn thảo, xử lý và truyền video Sau khi kết thúc chương, người học : Nắm được kiến thức cơ bản video Biết vận dụng một số kỹ thuật, công cụ xử lý ảnh để tạo và soạn thảo video
  6. Video là gì ? Video là gì ? Một chuỗi các ảnh / khung hình tạo cảm giác về sự chuyển động khi được trình chiếu / hiển thị một cách liên tiếp Video là kết hợp của chuyển động và âm thanh
  7. Một số khái niệm liên quan Frame: Một ảnh trong video Shot: chuỗi các frames được ghi lại trong một thao tác camera Scene: Tập các shots tạo ra một cảnh có nghĩa (khái niệm, thời gian, địa điểm) Video: 20/30 fps
  8. Hiển thị video trên máy tính Bao nhiêu khung hình trên giây là đủ ? Khi hiển thị trên máy tính, việc hiện thị ở tốc độ 12-15 fps là đủ mịn
  9. Thu nhận video Thu nhận video như thế nào ? Nếu sử dụng Camrecorder tương tự: • ___ are recorded • Must convert it to digital BEFORE we can put it on our computer to edit. • To convert analog video to digital video we need a ___ . Camrecorder số: • Information is sent as 0s and 1s • Thus no need ___ !
  10. Video tương tự - video số Analog vs. Digital Analog Video Video card camera Software: Connecting Capturing, Leads: Editing, Digital Firewire or Outputting camera USB cable
  11. Analog vs. Digital 1983 1994 DIGITAL (Newer Technology) ANALOG (Older Technology ) Solid State • Records a binary code (string Media Card • Records ___ - Memory of 1s and 0s) compressed on Sticks signals/pulses directly onto a magnetic tape or other media medium (like a tape) with a magnetic encoding. • Adv: No image ___ • Disadv: Picture loses quality Plug your video camera directly into your computer via a ___ needed ___ (aka i.Link) or to convert video from analog USB connection. to digital for your computer These are digital connections and allow you to "dump" footage straight from the camera to hard drive. 11
  12. Analog vs. Digital Video USB •S video (better quality) cables •Yellow RCA Audio Firewire Video Capture Card Plugs directly • Converts video Firewire (4 pin) from USB ANALOG TO DIGITAL 12
  13. Số hóa video tương tự Để sử dụng trong các ứng dụng đa phương tiện, cần thiết phải số hóa video
  14. Các bước chính để tạo video
  15. Các bước chính để tạo video Edit Digital Video Output (using Computer, Digital Video software Video Capture ex. Adobe Premiere, Avid) •Output to Video  Edit it different •Download  Add all kinds of cool titles file formats video from  Filters, transitions •Back out to camcorder  Superimpose clips tape, the to  Synchronize audio with Web, CD, computer video DVD  Authoring software: create menus and interactivity 15
  16. Chương V: Video Mục tiêu của chương Một số khái niệm Video là gì ? Thu nhận video như thế nào ? Các chuẩn video Nén video Soạn thảo và xử lý video Delivery Tổng kết chương Tài liệu tham khảo
  17. V.3 Các chuẩn video Các chuẩn video số thường kế thừa các đặc trưng của truyền hình tương tự Mỗi khung hình được chia thành hai trường: dòng chẵn và dòng lẻ, được truyền cái này nối tiếp cái kia, và được hiển thị một cách xen kẽ
  18. Các chuẩn thông dụng của truyền hình NTSC Standard: (National Television System Committee) • Chuẩn truyền hình tương tự NTSC được bắt đầu tại Mỹ năm 1939 và tồn tại cho đến ngày nay • Ban đầu, số khung hình / s là 30fps sau đó công nghệ TV màu đòi hỏi giảm xuống_ 24fps___ fps để phù hợp với thông tin màu sắc. PAL Standard: (Phase Alternating Line) • PAL là chuẩn truyền hình được sử dụng rộng rãi ở châu Âu những năm 60. • Số khung hình / s là __25__ fps
  19. Các chuẩn thông dụng của truyền hình NTSC: Một frame có 525 dòng, trong đó 480 dòng dùng để hiển thị ảnh, được hiển thị trên 59.94 trường (29.97 frames) trên giay (525/59.94 thường xấp xỉ bởi 525/60). PAL: Mỗi frame có 625 dòng, trong đó 576 dòng dùng để hiển thị ảnh (active lines), được hiển thị trên 50 fields (25 frames) trên giây (625/50).
  20. Các chuẩn thông dụng của truyền hình Các thử nghiệm với TV HD bắt đầu từ những năm 40-50 nhưng chỉ đưa vào sử dụng từ năm 1996. Trước năm 1996, tất cả TV đều sử dụng công nghệ hiển thị xen kẽ theo trường chẵn lẻ Các đặc trưng của truyền hình truyền thống được thừa kế trong các chuẩn video số sau này
  21. TV truyền thống hoạt động như thế nào Our eyes see phosphor dots on the screen. An electron beam (gun) activates the dots. The gun scans through the dots horizontally A complete scan is when the gun starts at the top left and scans several times horizontally till it gets to the bottom right
  22. TV truyền thống hoạt động như thế nào  The scan only draws every OTHER line (1,3, 5, 7, 9 479) then starts back at the top and draws the even lines (2,4, 480).  Thus two passes  Each pass is called a field  This way it can cheat the eye, while the phosphor dots are disappearing, it is drawing the line underneath.
  23. TV truyền thống hoạt động như thế nào ?
  24. TV truyền thống hoạt động như thế nào ? The Frame Size of High Definition for NTSC: Standard DV Frame:  1440 X 1080 For NTSC 720 X 480 pixels For Pal 720 X 576 pixels  1280 X 720  Frame Aspect Ratio Pixels are distorted (not square) because 720:480 is actually 3:2  1440:1080 ratio is 1.333 ratio  1280:720 ratio is 16:9 Frame aspect ratio is the ratio of width to height of the image frame. 4:3 Frame aspect ratio 16:9 Frame aspect ratio
  25. CRT vs. Flat screen CRT DISPLAY HIGH DEFINITION: FLAT SCREEN Ảnh hiển thị như thế nào trên màn hình CRT và Flat Screen ? Lower resolution Higher resolution 25
  26. CRT vs. Flat screen Older TVs 480 Scan Lines (interlaced) New Plasma, Flat Screen 720 or 1080 lines progressive OLDER PLASMA or TECHNOLOGY LCD -Screen Screen resolution 480 resolutions of: 720p or 1080p -Electron gun beam activates Flat grid of the dots pixels
  27. TV ngày nay Question: On a newer HD TV, what does the circled area mean? 720p, and 1080p displays all of the lines of resolution sequentially Result: smoother, cleaner image, especially with sports and other motion- intensive content
  28. Chương V: Video Mục tiêu của chương Một số khái niệm Video là gì ? Thu nhận video như thế nào ? Các chuẩn video Nén video Soạn thảo và xử lý video Delivery Tổng kết chương Tài liệu tham khảo
  29. V.4 Nén video Tại sao cần nén video ?
  30. Vì sao cần nén video ? One movie video without compression 720 x 480 pixels per frame 30 frames per second Total 90 minutes Full color => The total quantity of data = 167.96 GB High-Definition Television (HDTV) 1920x1080 30 frames per second (full motion) 8 bits for each three primary colors (RGB) Total 1.5 Gb/sec! Cable TV: each cable channel is 6 MHz Max data rate of 19.2 Mb/sec Reduced to 18 Mb/sec w/audio + control Compression rate must be ~ 80:1!
  31. Vì sao cần nén video ? Assume we have video that is: 1440 X 1080 pixels 1,555,200 pixels per frame FACT 24-bit colour, 30 fps S 1 second long, Audio is stereo so 2 channels Audio is 48,000Hz and 16 bit = 48,000*1sec*16bits/sample*2=1,536,000bits Video 1,555,200 X 24 bits per pixel (for color) = 37,324,800 bits per frame 37,324,800 * 30 frames per second * 1 second= 1,119,744,000 bits/8 = 139,968,000 bytes =133MB Audio 1,536,000bits/8 188 KB Total 133MB + 188KB =~ 133MB Không gian lưu trữ lớn cho 1 s video THUS a DVD could hold 35 seconds of uncompressed video, Not a very long movie 
  32. V.4 Nén video Sự khác biệt giữa nén video và nén ảnh là gì Sự dư thừa theo thời gian Phương pháp nào được sử dụng để loại bỏ thông tin dư thừa Intraframe coding: loại bỏ dư thừa thông tin trong không gian Interframe coding: loại bỏ dư thừa thông tin theo thời gian
  33. V.4 Nén video Dư thừa trong không gian: tính đến sự tương tự của các pixel lân cận
  34. Loaị bỏ dư thừa thông tin trong không gian “Intra-Frame Encoded” Quantization Zig-Zag Scan, • major reduction Run-length • controls ‘quality’ coding
  35. V.4 Nén video Khi nào thì việc loại bỏ dư thừa thông tin trong không gian không còn hiệu quả ? High-resolution images and displays . May appear ‘coarse’ Đối với loại ảnh / Video nào ? A varied image or ‘busy’ scene . Many colors, few adjacent
  36. V.4 Nén video: dư thừa theo thời gian Xem xét sự tương tự giữa các frame liên tiếp 950 951 952
  37. V.4 Nén video: dư thừa theo thời gian Temporal activity of a Talking Head
  38. Loại bỏ dư thừa theo thời gian
  39. Loại bỏ dư thừa theo thời gian
  40. Loại bỏ dư thừa theo thời gian I frames are independently encoded P frames are based on previous I, P frames Can send motion vector plus changes B frames are based on previous and following I and P frames In case something is uncovered
  41. Group of Pictures (GOP) Một video thường được mã hóa bởi nhóm các ảnh Group of Pictures (GOP). Nếu B-pictures được sử dụng, một GOP có thể phải sắp xếp lại theo thứ tự hiển thị lúc giải mã. Một GOP sẽ Bắt đầu với một I-frame Kết thúc với frame bên phải trước I-frame kế tiếp “Open” kết thúc ở B-frame, “Closed” ở P-frame (What is the difference?) MPEG Encoding a parameter, but ‘typical’: I B B P B B P B B I I B B P B B P B B P B B I Why not have all P and B frames after initial I?
  42. Group of Pictures
  43. V.4 Nén video Khi nào sự loại bỏ dư thừa theo thời gian không còn hiệu quả nữa Many scene changes High motion
  44. Non-Temporal Redundancy Many scene changes vs. few scene changes
  45. Non-Temporal Redundancy Sometimes high motion
  46. Các chuẩn nén videos 5-point 1D DCT 6-point 1D DCT 5-point 1D DCT 6-point 1D DCT 5-point 1D DCT 6-point 1D DCT 2008/12/26 Digital Video Compression Fundamentals and Standards
  47. Các tham số của nén MPEG
  48. Typical Compress. Performance Type Size Compression I 18 KB 7:1 P 6 KB 20:1 B 2.5 KB 50:1 Avg 4.8 KB 27:1 Note, results are Variable Bit Rate, even if frame rate is constant
  49. MPEG Today MPEG video compression widely used digital television set-top boxes HDTV decoders DVD players video conferencing Internet video
  50. MPEG Today MPEG-2 Super-set of MPEG-1 Rates up to 10 Mbps (720x486) Can do HDTV (no MPEG-3) MPEG-4 Around Objects, not Frames Lower bandwidth Has some built-in repair (header redundancy) MPEG-7 New standard Allows content-description (ease of searching) MP3, for audio MPEG Layer-3
  51. MPEG Tools MPEG tools at: plateau.cs.berkeley.edu/mpeg/index.html MPEG streaming at: FFMPEG html
  52. Chương V: Video Mục tiêu của chương Một số khái niệm Video là gì ? Thu nhận video như thế nào ? Các chuẩn video Nén video Soạn thảo và xử lý video Delivery Tổng kết chương Tài liệu tham khảo
  53. Capture Video (using video capture QUESTIONS TO CONSIDER card ) when preparing a video: from camcorder to computer Where will I be putting my video? • On the web (bandwidth is an issue) Edit • On CD-Rom (playback speed is an issue) Digital Video • DVD video (must be in mpeg2 format) (using Computer, Digital Video software ex. Adobe Premiere, Avid) Who is my audience?  Edit it • Will they be on different platforms  Add all kinds of cool titles (PC,Mac)  Filters, transitions and FX • How old will their computer be,  Superimpose clips how old will their CD or DVD player be?  Synchronize audio with video  Output in different file formats Will I still need to edit it later on? Output Should I compress it at all? Video (back out to tape, the Web, CD, DVD)
  54. V.5 Soạn thảo và xử lý video Soạn thảo video là quá trình tạo một video hoàn chỉnh từ một tập các video clips hay các cảnh, kết hợp với âm thanh nếu cần Xử lý video có mục đích tạo ra sự thay đổi cho video, sử dụng các phép xử lý giống như thao tác với ảnh
  55. Soạn thảo video
  56. Soạn thảo video In post-production, the values of effects’ parameters may vary over time
  57. Soạn thảo video Chroma keying, luma keying and mattes are used when combining tracks.
  58. Soạn thảo video RECAP: In order for video to be used in a multimedia application: • Video must be in a digital form Issue: Optimize Download speed What things do you think we should think about optimizing to decrease video file size? HOW?  One thing to think Reduce File Size about: what we did to an image to make it smaller
  59. Truyền video trên WEB 3 main ways to get video/audio (media) from a website onto your computer so you can view it: Download Progressive Streaming (aka Progressive) Download Packets sent down & After part of video is immediately starts Entire video clip must downloaded, it begins playing be downloaded to play before it plays - Video is NOT stored on - Permanently stored on end user system - Permanently stored end user system on end user system
  60. Truyền video trên WEB Download aka True Download, Progressive • Usually uses HTTP protocol • Downloads the Video from the host (server) to the user’s computer in its entirety and then plays the clip • User must wait for the download process to end before video can be played • Data is permanently stored on the end machine Advantages: • Video can be played repeatedly once downloaded to end system • Can be copied if necessary • Higher quality video because we don’t have to compress to improve streaming Disadvantages: Suitable for small video clips (short ones)
  61. Progressive Download Progressive download means that the movie starts playing when the time taken to download the remaining frames is less than the time it will take to play the whole movie
  62. Truyền video trên WEB Progressive Download • A click begins the download, but AFTER some portion of the file has been downloaded, the video will start to play • The player (e.g. Windows Media Player) calculates the speed of the download and guesses when to start playing it. • Data that is sent is permanently stored on the end machine. Advantages: • Same as downloads • Get to watch video earlier than true download Disadvantage: • Interrupts occur while watching video (has to play “catch-up time”
  63. Streaming When video is streamed, each frame is played as it arrives. Streaming allows live video and does not require a file to be saved on the user’s disk, but it does require sufficient bandwidth to deliver frames fast enough to be played. A multimedia architecture provides an API for capture, playback and compression; a container format; a streaming server; and software tools, such as a player.
  64. Streaming Streaming (uses RTSP protocol) aka as Webcasting • File played directly from server – thus some delay • the file is never permanently saved to the users computer • Media begins to play as soon as it gets a packet • Needs a special server using a Real Time Streaming Protocol RTSP • Video is broadcast to user and after displayed, discarded • Streaming is either On-Demand or Live • On demand – videos are stored on server for a long time and streamgased on a user request • Live – used for a sporting event, election results etc. • Example: Streaming Media that is Advantages: Fastest but requires the server be a constantly streaming server, received by and - Reduces waiting time for user displayed to an - Doesn’t take up disk storage, end user while - great for long videos being delivered Drawback: congestions may cause the media to stall if by a streaming the download process can’t keep up with the playback provider
  65. Streaming Can’t fast forward, only pause or rewind Streaming either On-Demand or Live On Demand: • streaming or progressive download. • saves the file to a hard disk and then is played from that location. • often saved to hard disks and servers for extended amounts of time. Live: • while the live streams are only available at one time only (e.g. during the Football game). • sends the information straight to the computer or device without saving the file to a hard disk
  66. • small buffer space is created on the user's computer • data starts downloading into it. • as soon as the buffer is full (usually just a matter of seconds), the file starts to play
  67. Streaming In order to do streaming video, you need two things: • A streaming web server (RTSP) – Real Server • A video that has been converted to be streamed (.rm) (aka real file in diagram) RealServer serves media clips to clients. It allows users to stream, rather than download, the media clips. Web server delivers pages to Web CONTINUOUS browsers over the Internet
  68. Converting the video: Because streaming involves passing lots of data very quickly you need to do LOTS of compression. The conversion program allows you to control this:
  69. Extension .rm (a stream file created) HTML webpage links to a .ram file Ram file (.ram) launches the RealPlayer and links to the clip
  70. Streaming Lots of Data  Unicast vs. Multicast Unicast each user gets his/her own stream of video, the server has to send out A LOT of data if several users are watching at once Multicast send the same stream to a bunch of users but then they lose the ability to pause, rewind, etc. bandwidth_and_storage
  71. What streaming service has completely changed the Internet (and the lives of many people)?
  72. YouTube To submit a video to Anyone can watch most of the videos. YouTube: • accepts video in the Registered users can upload videos. following formats: Only those over 18 can watch videos • .WMV, .AVI, .MOV, containing potentially offensive content MPEG and .MP4 Uploading of porn is prohibited. • then converts them to Defamation, harassment, commercial the flv format (Flash advertizing format) • and uses the Sorenson Question: There is software that Spark H.263 video codec checks the video to see if it might • Flash is moving to a contain pornographic material, can newer format f4v anyone guess how it does it? because of limitations in streaming with flv and some codecs
  73. YouTube Quality Standard (original) format 320X240 pixels, mono audio March 2008 up to 864X480 pixels and stereo sound Nov 2008 1280X720pHD added, changed ratio from 4:3 to 16:9 Nov 2009 1080p HD support ubecompfull.png
  74. Video in Multimedia Applications Things to consider when using video in your site: Source • Quality is tied to colour, resolution, fps, compression format, frame size. Appropriateness • If the quality of the video is going to be bad (because of required compression), perhaps we should just use images or animations instead? Playback Systems • Will the user have the required playback software? (will they need to be directed to download a plugin?) User Controls • Let the user have ability to pause/stop/loop/control volume
  75. Review 1. What file format does YouTube use? What newer file format is Flash Player pushing? 2. .avi is a container file format. a) True b) False 3. .avi files will always use the same codec to play them. a) True b) False 4. Name 3 ways of reducing the file size of a piece of video before moving it onto your website.
  76. Định dạng video trên máy tính Color Graphics Adapter (CGA): Độ phân giải: 320x200 Biểu diễn 4 màu Ảnh: 320x200 pixels x 2bits/pixel = 128000 bit = 16000 bytes per image Enhanced Graphic Adapter (EGA) Độ phân giải: 640x350 Biểu diễn: 16 màu Ảnh: 112000bytes per images Video graphic Array (VGA) Độ phân giải: 640x480 256 màu RGB output 307.200 bytes per image Super Video Graphic Array (SGVA) Resolution: 1024x768 24bits / pixel 2.359.296 bytes / image 78
  77. IV.6 Tài liệu tham khảo của chương ectures.html %27s_handbook_intro2.pdf Course: Multimedia systems video – CSC 461 / 561 R. Steinmetz and K. Nahrstedt, Multimedia Fundamentals, Vol. 1, Prentice-Hall, 2002. darmstadt.de/mm-book Bài giảng Video Summarization, Ben Wing, 2008