A Division of Electrosonic
         MPEG for the MediaSonic Players




Orlando Moreno
omoreno@hotmail.com
408.656.2498
Only what you need to know!




                  Equation 1: Forward Discrete Cosine Transform




omoreno@hotmail.com               408.656.2498
MPEG only what you need to know!

• MPEG is a compression standard, currently we
  use MPEG2 on the Players.
• An MPEG file contains Video and Audio in
  discrete streams called ELEMENTARY streams.
  Time stamps are used to synchronize the
  streams.
• These streams are MULTIPLEXED together
  either as a PROGRAM or TRANSPORT stream.
• This is all bad news!

omoreno@hotmail.com   408.656.2498
Program / Transport

• Electrosonic SD Player uses MPEG2
  Program Streams that are designed for
  storage and playback from disk.
• MediaSonic DTV Players use MPEG2
  Transport Streams designed for
  transmission over communication systems
  like ATM and broadcast. They are
  designed to recover from error not perfect
  playback!

omoreno@hotmail.com         408.656.2498
MPEG Encoder



    Audio Data        Mpeg Encode                  Audio PES
                                                    Packet
                                                               Multiplexer   Multiplexed
                                                                              Stream

                                                   Video PES
    Video Data        Mpeg Encode
                                                     Packet




                                    System Clock




omoreno@hotmail.com                           408.656.2498
Hardware MPEG Video Encoder




                      HDSDI
 4.2.2 @ 10bit                   4.2.0 @ 8bit     DCT




         D5 is 4.2.2 – 10 bit
        HDCAM is 3.1.1 - 8 bit
omoreno@hotmail.com                408.656.2498
Color Sampling Standards
                  P              P                   P           P
Line 1           PR B           PR B                PR B        PR B
           Y         Y      Y       Y           Y       Y   Y       Y

                  P              P                   P           P
Line 2           PR B           PR B                PR B        PR B
           Y         Y      Y       Y           Y       Y   Y       Y

                                   4.2.2

Line 1
           Y            Y   Y      Y            Y      Y    Y      Y
                  P              P                   P           P
                 PR B           PR B                PR B        PR B

Line 2     Y            Y   Y      Y            Y      Y    Y      Y

                                   4.2.0
  omoreno@hotmail.com            408.656.2498
Video Compression

                                           P Frames



                                                 B Frames



                                                      I Frame




   Group of Pictures in
   Encoder Sequence

omoreno@hotmail.com         408.656.2498
Headers




 Sequence
                      Group of Pictures
   Header


             GOP
            Header

omoreno@hotmail.com              408.656.2498
Video - Things to remember.

• GOP is usually half a second long, so 15
  frames for NTSC and 12 for PAL.
• A ‘Closed’ GOP is better for random
  access and synchronous files.
• Each GOP should contain a Sequence
  header.
• Files should start on a Sequence header.

omoreno@hotmail.com   408.656.2498
Audio Compression

• MediaSonic currently only support Dolby
  AC3 Audio streams.
• The standard allows for other types of
  audio including MPEG layer 2 audio that is
  created by some software encoders
  (Heuris).
• AC3 packets are 32msec long.


omoreno@hotmail.com         408.656.2498
AC3 Audio

• A compression scheme that can carry
  anything from mono to 5.1 surround
  sound. We typically use it in either stereo
  or 5.1.
• The stereo output plays back a mix of the
  AC, although we usually only encode
  stereo since HW encoders don’t support
  surround sound.

omoreno@hotmail.com     408.656.2498
Audio – Things to remember.
• AC3 is the only supported
  audio format.
• Audio needs to be encoded
  at 384kbits.
• Audio needs to be sampled
  at 48kHzs.
• AC3 can only exist as
  complete packets of 32
  msecs.
omoreno@hotmail.com   408.656.2498
Multiplexing

  • Wraps the audio and video into a single
    stream, in our case a Transport stream.


      Audio
 Elementary


     Video
Elementary




                           Time


  omoreno@hotmail.com      408.656.2498
Multiplexing
• Data is packed into 188 byte packets each
  starting with a h47.
• A well made file should start and end on packet
  boundaries.
• Files can be viewed with a Hex viewer to check.
            Start of packet

     47 40 11 11 00 00 E4 00 00 84 C0 13 3B F4 EB E6 F1 1B F4 EB 9F BD FF FF FF FF FF FF FF FF 00
     00 01 B3 E4 00 00 84 C0 13 3B F4 EB E6 F1 1B F4 EB 9F BD FF FF FF FF FF FF FF FF 00 13 3B F4
     EB E6 F1 1B F4 EB 9F 00 01 B3 E4 00 00 84 C0 13 3B F4 EB E6 F1 1B F4 EB 9F BD FF FF FF FF FF
     FF FF FF 00 13 3B F4 84 C0 13 3B F4 EB E6 F1 1B F4 EB 9F BD FF FF FF FF FF FF FF FF 00 00 01
     B3 E4 00 00 84 C0 13 3B F4 EB E6 F1 1B F4 EB 9F BD FF FF FF FF FF FF FF FF 00 13 3B F4 EB E6
     F1 1B F4 EB 9F 00 01 B3 E4 00 00 84 C0 13 3B F4 EB E6 F1 1B F4 FF FF 01 B5 20 1E 47 00 11 12

               Start of Seq. head
                                                           End of packet


omoreno@hotmail.com                         408.656.2498
Mux – Things to remember.

• Mux is Transport and uses 188 byte
  packets.
• Mux data rate must allow for the Video +
  Audio + Overhead.
• Audio should be shorter than video.
• File should and start and end on packet
  boundaries.

omoreno@hotmail.com   408.656.2498
Software Encoders
• There are two prominent encoders available
     – PixleTools - MPEGRepair.
          •   Picture only.
          •   Takes 24 bit/pixel graphic files only (BMP or TGA).
          •   Easy to use & reliable.
          •   Makes 4.2.0 or 4.2.2 files (our player auto detect and play).
          •   Has a ‘bug’ that adds a stream terminator incorrectly in the
              built in multiplexer (used to make video only transport
              streams).
     – Heuris - MPP2.
          •   Picture only or + MPEG audio (unsupported).
          •   Takes AVI and QuickTime files (with audio).
          •   Can window into source image.
          •   Can take images directly from film scanners.
omoreno@hotmail.com               408.656.2498
Software Encoders

• Make files with clean start. They include a
  Sequence header and first frame is always an I
  frame.
• Make files with clean end. It is possible to make
  clean looping files.
    – Frame count = (GOP size) x N for clean looping files.
• Very good for 3D work.
• MPEGRepair video only files must be trimmed
  before use!

omoreno@hotmail.com         408.656.2498
Real-time Encoders

• Designed to stream ASI data to a
  transmission system.
• Data can be captured asynchronously but
  will need ‘trimmed’ for quality playback.
• Some can be switched from ‘Video Off’ to
  ‘Video On’ creating a Sequence header
  and predictable I frame.
• Can make AC3 & MPEG2 audio.
    – Typically Left & Right + back up L & R.
omoreno@hotmail.com         408.656.2498
Software Multiplexers

• Manzaneta - MP2TSME
    – Very flexible DOS based tool. A b**** to use.
• PixelTools – Transmux
    – Easy Windows tool but no video only option.


• Both use the same Manzanita engine for
  Transport streams.

omoreno@hotmail.com          408.656.2498
MPEG for Large Screens

• MPEG uses motion prediction in B and P
  frames!
• MPEG encoding looses high frequencies!
• 4.2.0 can resolve horizontal color if there
  are 2+ similar colored pixels in a row and
  vertical color if there are 2+ pixels in a
  column!


omoreno@hotmail.com    408.656.2498
MPEG for Large Screens

• SD can be up-res’d to HD giving a better
  image than SD alone.
• This allows higher bitrates than the current
  SD Players.
• Allows for small GOP’s that better deal
  with fast motion vectors.



omoreno@hotmail.com    408.656.2498
Orlando Moreno
omoreno@hotmail.com
408.656.2498




 omoreno@hotmail.com   408.656.2498

Mpeg For The Media Sonic Players

  • 1.
    A Division ofElectrosonic MPEG for the MediaSonic Players Orlando Moreno omoreno@hotmail.com 408.656.2498
  • 2.
    Only what youneed to know! Equation 1: Forward Discrete Cosine Transform omoreno@hotmail.com 408.656.2498
  • 3.
    MPEG only whatyou need to know! • MPEG is a compression standard, currently we use MPEG2 on the Players. • An MPEG file contains Video and Audio in discrete streams called ELEMENTARY streams. Time stamps are used to synchronize the streams. • These streams are MULTIPLEXED together either as a PROGRAM or TRANSPORT stream. • This is all bad news! omoreno@hotmail.com 408.656.2498
  • 4.
    Program / Transport •Electrosonic SD Player uses MPEG2 Program Streams that are designed for storage and playback from disk. • MediaSonic DTV Players use MPEG2 Transport Streams designed for transmission over communication systems like ATM and broadcast. They are designed to recover from error not perfect playback! omoreno@hotmail.com 408.656.2498
  • 5.
    MPEG Encoder Audio Data Mpeg Encode Audio PES Packet Multiplexer Multiplexed Stream Video PES Video Data Mpeg Encode Packet System Clock omoreno@hotmail.com 408.656.2498
  • 6.
    Hardware MPEG VideoEncoder HDSDI 4.2.2 @ 10bit 4.2.0 @ 8bit DCT D5 is 4.2.2 – 10 bit HDCAM is 3.1.1 - 8 bit omoreno@hotmail.com 408.656.2498
  • 7.
    Color Sampling Standards P P P P Line 1 PR B PR B PR B PR B Y Y Y Y Y Y Y Y P P P P Line 2 PR B PR B PR B PR B Y Y Y Y Y Y Y Y 4.2.2 Line 1 Y Y Y Y Y Y Y Y P P P P PR B PR B PR B PR B Line 2 Y Y Y Y Y Y Y Y 4.2.0 omoreno@hotmail.com 408.656.2498
  • 8.
    Video Compression P Frames B Frames I Frame Group of Pictures in Encoder Sequence omoreno@hotmail.com 408.656.2498
  • 9.
    Headers Sequence Group of Pictures Header GOP Header omoreno@hotmail.com 408.656.2498
  • 10.
    Video - Thingsto remember. • GOP is usually half a second long, so 15 frames for NTSC and 12 for PAL. • A ‘Closed’ GOP is better for random access and synchronous files. • Each GOP should contain a Sequence header. • Files should start on a Sequence header. omoreno@hotmail.com 408.656.2498
  • 11.
    Audio Compression • MediaSoniccurrently only support Dolby AC3 Audio streams. • The standard allows for other types of audio including MPEG layer 2 audio that is created by some software encoders (Heuris). • AC3 packets are 32msec long. omoreno@hotmail.com 408.656.2498
  • 12.
    AC3 Audio • Acompression scheme that can carry anything from mono to 5.1 surround sound. We typically use it in either stereo or 5.1. • The stereo output plays back a mix of the AC, although we usually only encode stereo since HW encoders don’t support surround sound. omoreno@hotmail.com 408.656.2498
  • 13.
    Audio – Thingsto remember. • AC3 is the only supported audio format. • Audio needs to be encoded at 384kbits. • Audio needs to be sampled at 48kHzs. • AC3 can only exist as complete packets of 32 msecs. omoreno@hotmail.com 408.656.2498
  • 14.
    Multiplexing •Wraps the audio and video into a single stream, in our case a Transport stream. Audio Elementary Video Elementary Time omoreno@hotmail.com 408.656.2498
  • 15.
    Multiplexing • Data ispacked into 188 byte packets each starting with a h47. • A well made file should start and end on packet boundaries. • Files can be viewed with a Hex viewer to check. Start of packet 47 40 11 11 00 00 E4 00 00 84 C0 13 3B F4 EB E6 F1 1B F4 EB 9F BD FF FF FF FF FF FF FF FF 00 00 01 B3 E4 00 00 84 C0 13 3B F4 EB E6 F1 1B F4 EB 9F BD FF FF FF FF FF FF FF FF 00 13 3B F4 EB E6 F1 1B F4 EB 9F 00 01 B3 E4 00 00 84 C0 13 3B F4 EB E6 F1 1B F4 EB 9F BD FF FF FF FF FF FF FF FF 00 13 3B F4 84 C0 13 3B F4 EB E6 F1 1B F4 EB 9F BD FF FF FF FF FF FF FF FF 00 00 01 B3 E4 00 00 84 C0 13 3B F4 EB E6 F1 1B F4 EB 9F BD FF FF FF FF FF FF FF FF 00 13 3B F4 EB E6 F1 1B F4 EB 9F 00 01 B3 E4 00 00 84 C0 13 3B F4 EB E6 F1 1B F4 FF FF 01 B5 20 1E 47 00 11 12 Start of Seq. head End of packet omoreno@hotmail.com 408.656.2498
  • 16.
    Mux – Thingsto remember. • Mux is Transport and uses 188 byte packets. • Mux data rate must allow for the Video + Audio + Overhead. • Audio should be shorter than video. • File should and start and end on packet boundaries. omoreno@hotmail.com 408.656.2498
  • 17.
    Software Encoders • Thereare two prominent encoders available – PixleTools - MPEGRepair. • Picture only. • Takes 24 bit/pixel graphic files only (BMP or TGA). • Easy to use & reliable. • Makes 4.2.0 or 4.2.2 files (our player auto detect and play). • Has a ‘bug’ that adds a stream terminator incorrectly in the built in multiplexer (used to make video only transport streams). – Heuris - MPP2. • Picture only or + MPEG audio (unsupported). • Takes AVI and QuickTime files (with audio). • Can window into source image. • Can take images directly from film scanners. omoreno@hotmail.com 408.656.2498
  • 18.
    Software Encoders • Makefiles with clean start. They include a Sequence header and first frame is always an I frame. • Make files with clean end. It is possible to make clean looping files. – Frame count = (GOP size) x N for clean looping files. • Very good for 3D work. • MPEGRepair video only files must be trimmed before use! omoreno@hotmail.com 408.656.2498
  • 19.
    Real-time Encoders • Designedto stream ASI data to a transmission system. • Data can be captured asynchronously but will need ‘trimmed’ for quality playback. • Some can be switched from ‘Video Off’ to ‘Video On’ creating a Sequence header and predictable I frame. • Can make AC3 & MPEG2 audio. – Typically Left & Right + back up L & R. omoreno@hotmail.com 408.656.2498
  • 20.
    Software Multiplexers • Manzaneta- MP2TSME – Very flexible DOS based tool. A b**** to use. • PixelTools – Transmux – Easy Windows tool but no video only option. • Both use the same Manzanita engine for Transport streams. omoreno@hotmail.com 408.656.2498
  • 21.
    MPEG for LargeScreens • MPEG uses motion prediction in B and P frames! • MPEG encoding looses high frequencies! • 4.2.0 can resolve horizontal color if there are 2+ similar colored pixels in a row and vertical color if there are 2+ pixels in a column! omoreno@hotmail.com 408.656.2498
  • 22.
    MPEG for LargeScreens • SD can be up-res’d to HD giving a better image than SD alone. • This allows higher bitrates than the current SD Players. • Allows for small GOP’s that better deal with fast motion vectors. omoreno@hotmail.com 408.656.2498
  • 23.