Download presentation
Presentation is loading. Please wait.
Published byDoris Higgins Modified over 9 years ago
1
CS 414, MP1 Help Session, Spring 09 Presented by Hoang Nguyen
2
Overview Some logistics Top-down approach –Start with a well-known tool (ffmpeg) –Identify relevant APIs and examples –Extract and modify code for the project –More examples to get started, but less control Bottom-up approach –Start with basic building block(s) –Create your own custom code almost from scratch –Fewer examples, but more control Big picture (design decisions) Reminders
3
Logistics Group Setup –Group Number (1-7) –Group Directory MP hints updated (walkthrough) –http://www.cs.uiuc.edu/class/sp09/cs414/help/cs414Hin ts.htmhttp://www.cs.uiuc.edu/class/sp09/cs414/help/cs414Hin ts.htm –Java Media Framework is NOT available due to 64- bit incompatibility –Install ffmpeg on your home/group directory + common errors –ALSA configuration on csil-0216 machines http://alsa.opensrc.org/index.php?title=FAQ026 http://alsa.opensrc.org/index.php?title=FAQ026 TA OH: 3-4pm Thu/Fri, SC 0207
4
Top-down ffmpeg/SDL –Read libavcodec and libavformat docs –Follow tutorial “How to write Video Player in Less than 1000 lines’ http://dranger.com/ffmpeg/http://dranger.com/ffmpeg/ Need to use video formats and data structures defined by tools Need to figure out relevant APIs and examples!!!
5
Top-down (cont.) Tutorial01.c: Basic Tutorial02.c: output to the screen as fast as possible –Need to figure out how to display at the correct frame rate Tutorial05.c: Rate control –packet->dts is always available for MJPEG (I-frames only) –“ ffmpeg –i input.X ” also gives frame rate information –SDL_Delay() –Keep in mind: Processing delay needs to be taken into account for a correct frame rate display Tutorial07.c: av_seek_frame()av_seek_frame() –av_seek_frame() may be useful for fast forward/rewind Tutorial03.c: Playing audio
6
Bottom-up Frame 1Frame 2Frame 3Frame 4… JPEG 1JPEG 2JPEG 3JPEG 4… MPEG/AVI Image sequence For (I) Buf = Read_JPEG(I) Display_JPEG(Buf) Delay(…) Size of JPEG 1 JPEG 1 Size of JPEG 2 JPEG 2 Pos. of JPEG 1 Pos. of JPEG 2 JPEG 1 JPEG 2 …. Store Convert
7
Bottom-up (cont.) Design and implement your own simple motion JPEG format –Video header (e.g., number of frames) followed by sequence of JPEGs with JPEG headers (e.g., frame size) Create JPEGs from video format X ffmpeg -i $1 -t 10 -f image2 -vcodec mjpeg img%d.jpg Combine all the JPEGs into your own motion JPEG with appropriate headers for overall video and individual frames
8
Bottom-up (cont.) Start with basic building blocks –E.g. assume function display_jpeg() that can display single JPEG image from buffer Create thread that reads video data from disk to a buffer –Later MPs will require thread to read video data from the network Create thread that displays video from the buffer E.g.: http://www.csee.umbc.edu/~pmundur/courses/CMSC691C /Client.html http://www.csee.umbc.edu/~pmundur/courses/CMSC691C /Client.html Producer/Consumer
9
Producer-Consumer ProducerConsumer Disk/Net frames produce()/put() consume()/get() Buffer Display/Net Thread Tutorial05.c: PacketQueue, packet_queue_put(), packet_queue_get() Java: http://www.java2s.com/Code/Java/Threads/ProducerConsumerTest.htmhttp://www.java2s.com/Code/Java/Threads/ProducerConsumerTest.htm C/pthread: http://procrastinationrising.com/pthread-producer-consumer-example- in-c/http://procrastinationrising.com/pthread-producer-consumer-example- in-c/
10
Big picture Fast forward & rewind –Access individual frames –Create index file for video Media streaming over network (MP3) –Players should read from buffers and another thread should write to the buffer (either from disk or network) Synchronization (MP4) –Timestamp audio and video frames
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.