Tech Tips - Pan and Scan

Overview

PixelTools products can add Pan and Scan information to MPEG streams during encoding or even to an existing stream.  This information instructs a decoder what subsection or supersection of each MPEG decoded frame to display. Pan and Scan information is added to the stream as two parts.  The MPEG Sequence Extension should contain the horizontal and vertical dimensions of Pan and Scan decoder for this sequence.  These dimensions can be smaller or larger than the source frame size.  In addition, each decoded frame can include a pan and scan offset for that frame.  The offset is presented in terms of horizontal and vertical pixel displacement from the center of the frame.  A 0 horizontal and vertical offset for example would instruct the decoder to use the center of the decoded frame as the center of the Pan and Scan image. The offsets can be updated each frame and are stored in the MPEG Picture Coding Extensions.

Demo of Pan and Scan flag insertion

Download the PanScanDemo.zip file to obtain a demo of MPEGRepairHD that adds pan and scan information to an existing stream. Just unzip the zip file and run the PanScanDemo.bat file to launch the demo.   The MPEGRepairHD adds the Pan and Scan offsets listed in the Expert.ddl Decode Decision List file.  You can verify these flags using the Decode Section of MPEGRepairHD by depressing the St (Statistics window) speed button and selecting the Video | Video Statistics | Sequence Extension option during decoding. The Sequence Display Extension should contain the horizontal and vertical dimensions of the pan and scan display for the entire MPEG sequence.

Add Pan and Scan information via MPEGRepairHD GUI

During encoding

Update the horizontal and vertical dimensions of your Pan and Scan decoder under Optimize Encode | Configure | Parameters | MPEG-2 Parameters to reflect that of your target Pan and Scan decoder. These dimensions can be smaller or larger than the source frame size.   To change the Pan and Scan offsets from the center, create a text Encode Decision List (EDL) text file called Expert.Edl located in the directory you will be using to store your MPEG output. For each frame that you wish to have a non-zero offset, add two lines containing the frame number (or time code) and the PANSCAN keyword and offset as follows for a horizontal 21 pixel offset and 43 pixel vertical offset:

Frame 1026
Panscan 21 43

{EDL files are not case sensitive}

Running the encode process should add your selected Pan and Scan display size to each sequence headers and should insert the Pan and Scan offset into every frame designated in the Expert.edl file.  You should be able to verify EDL functionality by opening the Statistics (St) window.

encode

Click on image for larger view

During decoding

You can use the MPEGRepairHD decoder to insert Pan and Scan data into existing MPEG streams. Update the horizontal and vertical dimensions of your Pan and Scan decoder under Decode Function Enable | Configure | Fix Stream | Update Pan and Scan Frame Size to reflect that of your target Pan and Scan decoder. These dimensions can be smaller or larger than the source frame size.   To change the Pan and Scan offsets from the center, create a text Decode Decision List (DDL) text file called Expert.Ddl located in the directory you will be using to store your Save Fixed File. For each frame that you wish to have a non-zero offset, add two lines containing the frame number (or time code) and the PANSCAN keyword and offset as follows for a horizontal 21 pixel offset and 43 pixel vertical offset:

Frame 1026
Panscan 21 43

{DDL files are not case sensitive.  DDL commands are identical to EDL commands}

Running the decode process should add your selected Pan and Scan display size to each sequence headers and should insert the Pan and Scan offset into every frame designated in the Expert.edl file. The resultant updated file will be saved in the file named in the Save Fixed File edit box.

decode

Click on image for larger view

Add Pan and Scan information via Expert WorkShop SDK


During encoding

The Pan and Scan flags can be added during encoding using configuration parameters and Encode Decision List files.

To set the Pan and Scan Sequence Display Extension dimensions, set your horizontal and vertical sizes in the members:

display_horizontal_size;
display_vertical_size;

in the ExpDecFix_str;

To add individual frame offsets to each Picture Sequence Header, use the Expert.Ddl command file as detailed above in the MPEGRepairHD GUI Decode process.

During decoding

The Pan and Scan flags can be added to existing MPEG streams using configuration parameters and Decode Decision List files.

To set the Pan and Scan Sequence Display Extension dimensions, set your horizontal and vertical sizes in the members:

SeqDisplayHorizontal
SeqDisplayVertical;

in the VidEncodeMPEG2_struc;

To add individual frame offsets to each Picture Sequence Header, use the Expert.Ddl command file as detailed above in the MPEGRepairHD GUI Encode process.

 

Specification

MPEGRepairHD can add Pan and Scan display sizes to Sequence Extensions during the encoding of MPEG streams or to existing elementary streams. These headers comply with the ISO/IEC 13818-2 MPEG video encoding specification. MPEGRepairHD can also add Picture Coding Extensions to each frame during encoding or to an existing elementary stream to indicate the frame offsets from center for the pan and scan display.

 

MPEGRepairHD and ExpertWorkshop SDK are trademarks of PixelTools Corporation. All other brand names are trademarks or registered trademarks of their respected holders

©1998-2009 PixelTools Corporation