Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 15 Next »

This page describes the process for installing, building, and testing support for the ZU+ Video Codec Unit (VCU) under the QNX RTOS. The Zynq UltraScale+ MPSoC VCU TRD 2019.1 - VCU TRD : Multi Stream Design Module #1 is used as the hardware platform for the examples below.

The content of this wiki page is not supported by Xilinx Technical Support. Please contact your Xilinx or QNX FAE for more information.

Table of Contents

Introduction

Blackberry QNX provides support for the Zynq UltraScale+VCU when using their ZCU106 BSP for the QNX Neutrino RTOS. This is support is enabled by way of updates to the QNX Multimedia Suite 2.0 packages as referenced in the Required QNX RTOS Software Packages section below. In addition to the VCU support, there is an addition ADAS 2.0 package which provides MIPI camera support.

In the sections below, the process for building and evaluating the packages to exercise the VCU and MIPI camera input will be described.

Required QNX Software

It is assumed that the user has installed the following tools from QNX:

For general information about the ZCU106 BSP that is utilized for this project, you should refer to the ZCU106 BSP User Guide.

Xilinx Boot Files Archive

A set of pre-built boot files are available in the following archive:

  • Location TBD

The archive also includes QNX .build files.

Please contact your Xilinx FAE or Xilinx Technical Marketing to access to the boot files archive.

Recreating the Boot Files

The bitstream and FSBL are from the Zynq UltraScale+ MPSoC VCU TRD 2019.1 - VCU TRD : Multi Stream design with one slight change. It is altered to remove the isolation configuration in the PS. Without this change, QNX will not boot.

To reproduce these files, use the Build flow for Design Module #1 (Multi Stream) and follow the steps below:

  • Open the project in Vivado

  • Disable isolation in the IPI Processor Configure Wizard (PCW).

  • Build and export the hardware

  • Create a Petalinux project based on BSP in the TRD

  • Configure the Petalinux project to use the new .hdf

  • Build the petalinux project

  • The new boot artifacts will in the <petalinux project>/images/linux directory

Required QNX RTOS Software Packages

The build the QNX reference design for the ZCU106, the following runtime software packages are required from Blackberry QNX. The packages are available through the QNX Software Center application and are available upon request for current QNX customers. Please contact your QNX or Xilinx FAE for assistance.

Make sure you also update your QNX SDP 7.0 installation at this time to at least 7.0.4

Package Type

Package Name

BuildID

Notes

BSP

QNX® SDP 7.0 BSP for Xilinx Zynq UltraScale+ MPSoC ZCU106 - 7.0

11

Graphics

QNX® SDP 7.0 Screen Base Graphics, 7.0

8159

QNX SDP 7.0 Screen Board Support ZCU102

8159

Multimedia

QNX® Multimedia Suite 2.0 - Character Conversion - 2.0

3120

These are in addition to the latest Multimedia Suite 2.0 packages.

QNX® Multimedia Suite 2.0 - MP4 Muxer Support - 2.0

3120

QNX® Multimedia Suite 2.0 - Filesystem Input Support - 2.0

3120

QNX® Multimedia Suite 2.0 - Multimedia Framework API - 2.0

3120

QNX® Multimedia Suite 2.0 - OMX IL helper library - 2.0

3120

QNX® Multimedia Suite 2.0 - OpenMAX AL API - 2.0

3120

QNX® Multimedia Suite 2.0 - Audio Output Support - 2.0

3120

QNX® Multimedia Suite 2.0 - Screen Output Support - 2.0

3120

QNX® Multimedia Suite 2.0 - MP4 container support - 2.0

3120

QNX® Multimedia Suite 2.0 - Playlist Parsing API - 2.0

3120

QNX® Multimedia Suite 2.0 - Media Renderer API - 2.0

3120

QNX® Multimedia Suite 2.0 - Resource Arbiter - 2.0

3120

QNX® Multimedia Suite 2.0 - Xilinx zcu106 hardware codec - 2.0

3120

ADAS

QNX® Platform for ADAS 2.0 - Base Support - 2.0

2887

Only needed for ADAS Demos

QNX® Platform for ADAS 2.0 - Camera - 2.0

2887

Only needed for ADAS Demos

Limitations

There are a few outstanding issues related to using the 4k display while encoding/decoding with the test applications below. At this time, it is recommended that users limit the display resolution to 1080p for best overall performance.

Building the QNX BSP Project

The QNX BSP Project can be built from the command line or using the QNX Momentics IDE. The Momentics flow running under Windows will be described below.

A “boot files archive” is needed (See “Xilinx Boot Files” section above) with all necessary components to recreate the BOOT.BIN for staring up the system.

A Pre-built BOOT.BIN is provided in the boot files archive if you do not want to build them from scratch. A pre-built QNX-IFS for each set of demos (adas and multimedia) is also available in a QNX Pre-built archive upon request. Please contact your QNX or Xilinx FAE for access.

Using the Momentics IDE Flow 

Create the ZCU106 BSP Project

  1. Launch Momentics and create a new workspace.

  2. Create a new project based on the ZCU106 BSP 

    • File->Import

    • Choose QNX->QNX Source Package and BSP. Click Next

    • Browse for the ZCU106 BSP

      • <QNX install path>\qnx700\bsp\BSP_xilinx-zynq-zcu106_br-700_be-700_SVN916472_JBN11.zip

      • Click Next Twice

      • Give the project a suitable name

      • Click Finish

Modify the Project

  1. Replace the default zcu106.build file with the one of the ones provided in the boot files archive. There are two options, depending on which set of applications you want to test:

    • adas/zcu106.build.adas: Use this if you want to capture, display, and record live video from the FMC MIPI camera. You’ll also need to install the ADAS packages mentioned in the table above.

    • multimedia/zcu106.build: Use this to simply exercise the VCU encoder/decoder with the QNX multimedia and Xilinx VCU test apps

      In either case, copy the .build file into the QNX BSP project and rename it zcu106.build. In the QNX project, the .build file is found under xilinx-zynq-zcu106->images in the project explorer.

  2. Copy all of the .conf files in the graphics directory of the boot files archive to the following directory (this only needs to be done once and can be used for other projects):
    <QNX install path>/qnx700/target/qnx7/aarch64le/usr/lib/graphics/zcu102

  3. Update the Makefile in the images directory. Modify the QNX-IFS target as shown below so that QNX-IFS gets updated during every build:

QNX-IFS: ifs-xzynq-zcu106.raw
	cp ifs-xzynq-zcu106.raw QNX-IFS

Build the Project

  1. Right click on the project name and select "Clean Project”

  2. Right click on the project name and select "Build Project"

  3. Wait for the build to complete. This process will take several minutes.

  4. Once complete, the QNX-IFS will be available in the images folder.

Create the Boot Image

  1. Copy the QNX Initial Program Loader (IPL) (<qnx proj dir>/prebuilt/aarch64le/boot/sys/ipl-xzynq-ultrascale-zcu10x) to the folder that includes the provided 2019.1 VCU TRD bootfiles. Rename the file to ipl-xzynq-ultrascale-zcu10x.elf.

  2. Open an xsct command shell, cd to the boot files directory, and use the Xilinx Bootgen tool to generate BOOT.BIN with the following command:

    bootgen -image boot_vcu_trd.bif -arch zynqmp -o BOOT.BIN -w

Preparing the Hardware

By default, this reference design targets the 2019.1 VCU TRD Design Module #1. With modification, other similar hardware configurations can be supported as well - please refer to Appendix A below. From a QNX software perspective, this reference design supports a subset of the VCU TRD interfaces as defined below:

Supported Hardware Interfaces

Sources

  • MIPI CSI-2 Rx capture pipeline implemented in the PL

    • Capture Pipeline: MIPI CSI-2 Subsystem → Demosaic → Gamma → VPSS(CSC) → VPS (Scaler) → Framebuffer Write

  • File source: SD card

Sinks

  • DP Tx display pipeline in the PS.

  • File sink: SD card

VCU Codec

  • Video Encode/Decode capability using VCU hard block in PL 

    • AVC/HEVC encoding

    • Encoder/decoder parameter configuration.

Video Input Pipeline

MIPI CSI-2 Subsystem → Demosaic → Gamma → VPSS(CSC) → VPS (Scaler) → Framebuffer Write

Setting up the board

To set the board up for testing, please refer to the Board Setup instructions in the VCU TRD: Zynq UltraScale+ MPSoC VCU TRD 2019.1

For this this version of the reference design, since we will only be using the MIPI camera input and DisplayPort output, the other interfaces can be left disconnected. Make sure the FMC voltage is configured correctly. Please refer to https://www.xilinx.com/support/answers/67308.html for details.

Booting up the Board

  1. Add BOOT.BIN and QNX-IFS to the FAT partition of an SD Card. For best results, use the SD Memory Card Formatter from the SD Association to format the card.

  2. Insert the card in ZCU106 and power on the board.

  3. When prompted by the QNX IPL, select 'M' to boot from the SD Card.

As part of the default boot process, the boot script will attempt to mount the SD cards at /sdcard.

The FAT partition should show up as /dev/hd0t11, /dev/hd0t12, or /dev/hd0t14 depending on how the flags are set on the partition. It has been observed that certain SD cards, depending on how the boot flags are set, may show up as /dev/hd0t131 which is technically denoting an ext4 partition.

Setting the MAC Address

To use the Ethernet interface, you’ll need make sure that the MAC address for the board is programmed into the on-board EEPROM. During boot, if you see an error about the MAC address not being set, refer to the ZCU106 BSP User Guide for details regarding programming the MAC address into the EEPROM.

Running the ADAS Test Applications

The camera_example application can be used to exercise the available hardware interfaces. The examples in this section are provided by the QNX® Platform for ADAS 2.0 packages listed above. The available tests are highlighted below. Source code for the camera_example application is available from QNX upon request.

To run using pre-builts, you should use the QNX-IFS file located in the /adas directory of the QNX Pre-built archive. This version of the QNX-IFS is built using adas/zcu106.build.

Camera Viewfinder Test

In the serial console, run the camera_example application and press 1 for “Camera viewfinder”. After that, select all default options:

#camera_example
Select which example you want to run:
        1) Camera viewfinder
        2) Record video to a file
        3) Camera stream
        4) Multiple camera video
        5) EGL viewfinder
        6) Event example
        7) Multiple camera streams
        x) Exit the example
1
Select which of the following 1 cameras you want to use:
        1) CAMERA_UNIT_1
Enter Choice:
1
Select which of the following VF modes you want to use:
        2) CAMERA_VFMODE_VIDEO
Enter Choice:
2
Do you want to modify the viewfinder configuration (y/n)?
n
Do you want to modify image attributes (y/n)?
n
Choose from the following options:
        i) Modify image attributes
        l) Lock 3A
        v) Modify viewfinder configuration
        x) Exit the example

The camera streaming starts and the viewfinder should show up on the connected DisplayPort Monitor

The screen resolution should be set to the camera resolution for best performance. By default, both are set to 1920x1080. See the section below “Changing the Resolution of the Display” for more information.

Camera Recording Test

In the serial console, start the VCU encoder application:

# vcu-encoder-zcu106

Now run the camera_example application and press 2 for “Record video to a file”. After that, select all default options:

#camera_example
Select which example you want to run:
        1) Camera viewfinder
        2) Record video to a file
        3) Camera stream
        4) Multiple camera video
        5) EGL viewfinder
        6) Event example
        7) Multiple camera streams
        8) Synchronized cameras
        x) Exit the example
2
Select which of the following 1 cameras you want to use:
        1) CAMERA_UNIT_1
Enter Choice:
1
Do you want to modify viewfinder configuration (y/n)?
n
Choose from the following options:
        c) Change video configuration
        e) Modify encoder parameters
        k) Force a Key Frame
        r) Start/Stop Recording a video
        v) Modify viewfinder configuration
        x) Exit the example
r
Starting to record video to file /tmp/VID_xxxxxxx_xxxxxx_.mp4
Choose from the following options:
        c) Change video configuration
        e) Modify encoder parameters
        k) Force a Key Frame
        r) Start/Stop Recording a video
        v) Modify viewfinder configuration
        x) Exit the example
		

At the final menu, choose “r” to start recording and choose "r" again to stop recording. While recording, you should see the live video on the DisplayPort monitor.

  • The default recording resolution is 1920x1080. By default, the video files will be recorded to /sdcard directory, which in our case is the mounted SD card.

  • 4k recording is not reliable at this time. This seems to be related to the amount of data being written to disk. To lower the bitrate of the encoded video, you can modify the bitrate by selecting the “Modify encoder parameters” menu option before starting to record. The default rate for 1080p is 16Mbps, and the default rate for 4k is 72 Mbps

Video File Playback Test

Before running this test, the video file to be played back must be copied to /sdcard/video.mp4. The can be overridden by changing the contents of /etc/playback.conf in the .build file

In the serial console, start the VCU decoder application:

# vcu-decoder-zcu106

Restart the sensor service with a different .conf file to configure it as a “File Camera”. The playback.conf file is defined in zcu106.build.

# slay sensor
# sensor -U 521:521,1001 -r /sdcard -c /etc/playback.conf -b external

Now run the camera_example application and press 1 for “Camera Viewfinder”. After that, select all default options:

# camera_example
Select which example you want to run:
        1) Camera viewfinder
        2) Record video to a file
        3) Camera stream
        4) Multiple camera video
        5) EGL viewfinder
        6) Event example
        7) Multiple camera streams
        8) Synchronized cameras
        x) Exit the example
1
Select which of the following 1 cameras you want to use:
        1) CAMERA_UNIT_1
Enter Choice:
1
Select which of the following VF modes you want to use:
        2) CAMERA_VFMODE_VIDEO
Enter Choice:
2
Do you want to modify the viewfinder configuration (y/n)?
n
Do you want to modify image attributes (y/n)?
n
Choose from the following options:
        i) Modify image attributes
        l) Lock 3A
        v) Modify viewfinder configuration
        x) Exit the example

The video at /sdcard/video.mp4 will begin to play on the monitor. Once the end of the video is reached, it will replay continuously until you press 'x' to exit the test.

Running the Multimedia Test Applications

The examples in this section are provided by the QNX® Platform for Multimedia 2.0 packages listed above. The available tests are highlighted below.

To run using pre-builts, you should use the QNX-IFS file located in the /multimedia directory of the boot files archive. This version of the QNX-IFS is built using multimedia/zcu106.build.

Preparing The System

Once the system is booted, run the following commands:

vcu-decoder-zcu106
vcu-encoder-zcu106
pps
mkdir /pps/services
mkdir /pps/services/multimedia
mm-renderer

Xilinx VCU Tests

Included in the multimedia package are four sample applications from Xilinx to exercise the VCU at the Control Software and OpenMax layers. These sample apps operate on raw video files (.hevc, .h264, . yuv, etc. ) instead of containerized formats like .mp4.

Depending on the size of the test video, these tests can take up significant disk space and bandwidth. For best results, it’s recommended the the files are accessed over NFS instead of the SD card interface. See the section “Mounting an NFS Partition” below for more details.

VCU Control Software

The VCU control software is a pair of standalone command-line executables that can be used to gain fine-grained control over the operation of the VCU:

  • VCU Encode: ctrlsw_encoder

  • VCU Decode: ctrlsw_decoder

Command Line Examples

#AVC/H.264
ctrlsw_decoder -in input_file.h264 -avc -out output_file.yuv

#HEVC/H.265
ctrlsw_decoder -in inptu_file.hevc -hevc -out output_file.yuv

Encode using ctrlsw_encoder - this takes a .cfg file as an input and generates an avc or hevc encoded output file based on the YUV formated input file. The configuration file details can be found in PG252. A sample configuration file can be found in Appendix B below.

ctrlsw_encoder -cfg /tmp/avc_1080p60.cfg

For more information on usage of the control software applications, please refer to PG252: VCU Control Software Sample Applications. The source code for the VCU Control Software is available at https://github.com/Xilinx/vcu-ctrl-sw.

VCU OpenMax Sample Applications

The OpenMax Integration Layer (OMXIL) sample applications provide example for utilizing the OpenMax Integration Layer.

  • VCU Encode: vcu_omx_encoder

  • VCU Decode: vcu_omx_decoder

Command Line Examples

Decode a encoded video to YUV:

#AVC/H.264
vcu_omx_decoder intput_file.h264 --avc  -o output_file.yuv

#HEVC/H.265
vcu_omx_decoder input_file.hevc --hevc  -o output_file.yuv
 

Encode a 1080p60 YUV video:

#AVC/H.264
vcu_omx_encoder input_file.yuv --width 1920 --height 1088 --framerate 60 --avc --out output_file.h264

#HEVC/H.265
vcu_omx_encoder input_file.yuv --width 1920 --height 1080 --framerate 60 --avc --out output_file.hevc

To play the encoded h264/hevc back on a PC for verification, you can use ffplay:

ffplay -i output_file.h264

To add a mp4 contatiner, you can use ffmpeg:

ffmpeg -i <input file in hevc or h264> -c:v copy -f mp4 <output file>.mp4

For more information on the usage of the OpenMax sample applications, please refer to PG252: VCU OpenMax Integration Layer. The source code for the OpenMax Integration Layer sample applications is available at https://github.com/Xilinx/vcu-omx-il/tree/master/exe_omx.

QNX Codec Tests

mmrplay

  • Used to playback .mp4 videos on the DisplayPort interface

    Usage:

    mmrplay -a "" -v "screen:/any" <absolute path to media file>.mp4

Changing the Resolution of the Display

To change the resolution of the DisplayPort interface, you need to restart the screen service and specify a new screen configuration file. Screen configuration files have been provided for the following resolutions:

  • 1920x1080 (default)

  • 3840x2160

  • 1280x720

To restart the screen service, issue the following commands:

# kill the screen process
slay screen

# start screen service up with a new configuratoin file
/sbin/screen -c /usr/lib/graphics/zcu102/graphics_<1080p|2160p|720p>.conf

Mounting an NFS Partition

For some of the tests above, it’s beneficial to use an NFS mounted filesystem due to the size of the files and the amount of bandwidth necessary. The commands below give an example for connecting to an NFS server. It is assumed that the NFS server is already running and configured correctly.

# Enable the network inteface
ifconfig xzynq0 <target ip address>

# Connect to an NFS server, and mount it at /tmp
fs-nfs3 <nfs server ip address>:<path on server> /tmp

Other Hardware Configurations

It’s possible to use the QNX software implementation provided with this reference design with other hardware configurations. The sections below describe the modifications need to run this design on the Zynq UltraScale+ MPSoC VCU TRD 2019.1 - Multi stream Audio-Video Design design module #3.

Modifying the QNX BSP Project

Changes are required to the zcu106.build file to support the new hardware configuration.

Adding AXI Interrupt Controller

The ZCU106 BSP supports the use of the AXI Interrupt Controller soft IP in the PL to aggregate interrupts before sending a single interrupt to the GIC through the PL->PS interface. In order to use it, we need to enable it at startup and define the characteristics of the interrupt.

In this design, the AXI INTC is configured as follows:

  • Base address = 0xA0055000

  • Interrupt output is connected to GIC 142 (ps->pl IRQ ).

  • The interrupt output is active high, level triggered

In the .boostrap section of the .build file, add the following command:

# startup-xzynq-zcu10x -v -a<AXI INTC BASE ADDR>, <GIC #>
startup-xzynq-zcu10x -v -a0xa0055000,142 

Updating the Sensor Service Configuration

By default, several xilinx-specific parameters used by the sensor service configuration are set to default values that match the 2019.1 VCU TRD Design Module #1 hardware settings. In order to configure the sensor service to values that don’t match DM#1, we can override the parameter settings in imx274.conf as shown below.

In zcu106.build, replace the /etc/imx274.conf section with:

	/etc/imx274.conf = {
	begin SENSOR_UNIT_1
	    type = sensor_camera
	    name = front-camera
	    position = 0, 0, 0
	    direction = 0, 0, 0
	    address = imx274, 0
	    xilinx_csi2_base = a00f0000
	    xilinx_csi2_irq = 8192
	    xilinx_demosaic_base = a0250000
	    xilinx_demosaic_gpio = 85
	    xilinx_gamma_base = a0270000
	    xilinx_gamma_gpio = 86
	    xilinx_csc_base = a0240000
	    xilinx_csc_gpio = 84
	    xilinx_csc_skip = 0
	    xilinx_scaler_base = a0200000
	    xilinx_scaler_gpio = 82
	    xilinx_scaler_skip = 0
	    xilinx_bufwrite_base = a0260000
	    xilinx_bufwrite_irq = 8193
	    xilinx_bufwrite_gpio = 80
end SENSOR_UNIT_1

Please refer to Appendix A: Hardware Configurations for details on the hardware configurations of DM#1 and DM#3.

Appendix A: Hardware Configurations

The following sections provide details on the PL configuration of various Vivado designs that are compatible with the QNX ADAS software libraries.

2019.1 VCU TRD Design Module #1

Image Sensor Configuration

Sensor Type: IMX274 (LI-IMX274MIPI-FMC)

Sensor I2C Interface

IP

Address

Interrupt Sink

AXI IIC

0xA005_1000

pl_ps_irq1[3] == GIC[139]

 

Sensor Video Pipeline

Stage

IP

Address

Interrupt Parent

EMIO Reset (QNX GPIO #)

Clock

1

MIPI CSI-2 Rx Subsystem

0xA00F_0000

pl_ps_irq1[1] == GIC[137]

12 (90)

NA

2

Sensor Demosaic

0xA025_0000

NA

7 (85)

NA

3

Gamma LUT

0xA027_0000

NA

8  (86)

NA

4

VPSS CSC

0xA024_0000

NA

6 (84)

NA

5

VPSS Scaler

0xA020_0000

NA

4 (82)

NA

6

Video Frame Buffer Write

0xA026_0000

pl_ps_irq1[2] == GIC[138]

2 (80)

NA

Note: This EMIO for MIPI RX is an active low SPI ChipSelect

Video Codec Unit IP Parameters

IP

Address

Interrupt Sink

EMIO Reset (QNX GPIO #)

Clock

Video Codec Unit

0xA010_0000

pl_ps_irq0[7] == GIC[

41 (119)

 

AXI Interrupt Controllers (PL Based)

IP

Base address

Interrupt Parent

Output Type

 

 

AXI_INTC0

0xA005_2000

pl_ps_irq1[4] == GIC[

Level High

 

 

2019.1 VCU TRD Design Module #3

Image Sensor Configuration
Sensor Type: IMX274 (LI-IMX274MIPI-FMC)
Sensor I2C Interface

IP

Address

Interrupt Sink

AXI IIC

0xA005_4000

AXI_INTC0[2]

 Sensor Video Pipeline

Stage

IP

Address

Interrupt Parent

EMIO Reset (QNX GPIO #)

Clock

1

MIPI CSI-2 Rx Subsystem

0xA00F_0000

AXI_INTC0[0]

12 (90)

NA

2

Sensor Demosaic

0xA025_0000

NA

7 (85)

NA

3

Gamma LUT

0xA027_0000

NA

8  (86)

NA

4

VPSS CSC

0xA024_0000

NA

6 (84)

NA

5

VPSS Scaler

0xA020_0000

NA

4 (82)

NA

6

Video Frame Buffer Write

0xA026_0000

AXI_INTC0[1]

2 (80)

NA

Note: This EMIO for MIPI RX is an active low SPI ChipSelect

Video Codec Unit IP Parameters

IP

Address

Interrupt Sink

EMIO Reset (QNX GPIO #)

Clock

Video Codec Unit

0xA010_0000

pl_ps_irq0[6] == GIC[

41 (119)

 

AXI Interrupt Controllers (PL Based)

IP

Base address

Interrupt Parent

Output Type

 

 

AXI_INTC0

0xA005_5000

pl_ps_irq1[6] == GIC[

Level High

 

 

 

 

 

 

 

 

Common Platform Notes

  • For QNX, MIO is mapped to GPIO 0-77, EMIO is mapped to GPIO 78-173

  • pl_ps_irq0 = GIC 121:128, pl_ps_irq1 = GIC 136:143 . QNX uses actual GIC number.

  • For Interrupts connected through AXI_INTC, the logical interrupt numbers used by QNX are as follows:

1st AXI_INTC: 0x2000 to 0x0201F
2nd AXI_INTC: 0x2020 to 0x0203F
3rd AXI_INTC: 0x2040 to 0x0205F
4th  AXI_INTC: 0x2060 to 0x0207F

Appendix B: Example ctrlsw_encoder Config File Format

The following example configuration file is used to a convert a 1080p YUV420 file avc/h264. For more info, refer to PG252.

ctrlsw_encoder -cfg avc_1080p60.cfg

Input Summary:

  • file: csw_AIR_1080p30_nv12_4B_h264.yuv

  • Size: 1920x1080

  • Color Space: I420

Output Summary:

  • file: csw_AIR_1080p30_nv12_4B_h264_yuv.h264

  • profile: AVC_MAIN Level 4

 ctrlsw_encoder Configuration File Example
#--------------------------------------------------------------------------
#                          Configuration file
#--------------------------------------------------------------------------

#--------------------------------------------------------------------------
[INPUT]
#--------------------------------------------------------------------------

# YUVFile : YUV input file
YUVFile = csw_AIR_1080p30_nv12_4B_h264.yuv

# Width, Height: frame width/height in pixels
# width and height shall be multiple of 8 pixels
Width  = 1920
Height = 1080

# Format : FOURCC format of input file
# typical file formats       : I420, I422, I0AL, I2AL...
# hardware supported formats : NV12, NV16, P010, P210... (depends of the hw ip)
# default value : I420
#Format = NV12
Format = I420

#--------------------------------------------------------------------------
[OUTPUT]
#--------------------------------------------------------------------------

# BitstreamFile : elementary stream output file
BitstreamFile = csw_AIR_1080p30_nv12_4B_h264_yuv.h264

# RecFile : optional output file for reconstructed pictures
#RecFile = rec.yuv

#--------------------------------------------------------------------------
[RATE_CONTROL]
#--------------------------------------------------------------------------

# RateCtrlMode : selects the bit rate control mode
# allowed values : CONST_QP, CBR, VBR, ...
# default value  : CONST_QP
RateCtrlMode = CBR

# FrameRate : number of frames per second
# default value : 30
FrameRate = 30

# BitRate: target bitrate in kbit/s (not used when RateCtrlMode = CONST_QP)
# default value : 4000
# BitRate = 700

# MaxBitRate: maximum bitrate in kbit/s used when RateCtrlMode = VBR
# MaxBitRate shall be equal to BitRate when RateCtrlMode = CBR or LOW_LATENCY
# default value : 4000
# MaxBitRate = 700

# SliceQP : Quantization Parameter
# when RateCtrlMode = CONST_QP, it defines the QP for all slices, otherwise it specifies the initial QP
# allowed values : from 0 to 51, AUTO
# default value  : 30
# SliceQP = 25

# CPBSize : specifies the size of the Coded Picture Buffer as specified in the HRD model, in seconds (not used when RateCtrlMode = CONST_QP)
# default value : 3.0
# CPBSize = 1.0

# InitialDelay : specifies the initial removal delay as specified in the HRD model, in seconds (not used when RateCtrlMode = CONST_QP)
# default value : 1.5
# InitialDelay = 1.0

#--------------------------------------------------------------------------
[GOP]
#--------------------------------------------------------------------------

# GopCtrlMode : specifies the Group Of Pictures configuration
# allowed values : DEFAULT_GOP, LOW_DELAY_P, LOW_DELAY_B, PYRAMIDAL_GOP
# default value  : DEFAULT_GOP
GopCtrlMode = DEFAULT_GOP

# Gop.Length : GOP length in frames including the I picture. 0 = Intra only
# default value : 30
Gop.Length = 30

# Gop.NumB : maximum number of consecutive B frames in a GOP (used only when GopCtrlMode = DEFAULT_GOP or PYRAMIDAL_GOP)
# allowed values : 0 to 4    when GopCtrlMode = DEFAULT_GOP
#                  3, 5 or 7 when GopCtrlMode = PYRAMIDAL_GOP
# default value  : 0
# Gop.NumB = 1

# Gop.FreqIDR : minimum number of frames between two IDR pictures (IDR insertion depends on the position of the GOP boundary)
# allowed values : positive value or -1 to disable IDR insertion
# default value  : -1
# Gop.FreqIDR = 25

#--------------------------------------------------------------------------
[SETTINGS]
#--------------------------------------------------------------------------

# Profile : specifies the standard/profile to which the bitstream conforms
# allowed values : AVC_BASELINE, AVC_MAIN, AVC_HIGH, AVC_HIGH10, AVC_HIGH_422,
#                  HEVC_MAIN, HEVC_MAIN10, HEVC_MAIN_422_10...
# (Some profile might not be supported by your hardware ip, see hardware ip specification)
Profile = AVC_MAIN

# Level : specifies the level to which the bitstream conforms
# allowed values : 1.0 to 5.2 for AVC, 1.0 to 5.1 for HEVC
Level = 4

# Tier : specifies the tier to which the bitstream conforms (HEVC only)
# allowed values : MAIN_TIER, HIGH_TIER
#Tier = MAIN_TIER

# ChromaMode : selects the chroma subsampling mode used to encode the stream
# allowed values : CHROMA_MONO, CHROMA_4_2_0, CHROMA_4_2_2
# default value  : CHROMA_4_2_0
ChromaMode = CHROMA_4_2_0

# BitDepth : specifies the bit depth of the luma and chroma samples in the encoded stream
# allowed values : 8, 10
# default value  : 8
BitDepth = 8

# NumSlices : number of row-based slices used for each frame
# allowed values : from 1 up to the number of coding unit rows in the frame
# default value  : 1
# NumSlices = 2

# QPCtrlMode : specifies how to generate the QP per coding unit
# allowed values : UNIFORM_QP, AUTO_QP, LOAD_QP, LOAD_QP | RELATIVE_QP
# default value  : UNIFORM_QP
QPCtrlMode = UNIFORM_QP

# ScalingList : specifies the scaling list mode
# allowed values : FLAT, DEFAULT, CUSTOM
# default value  : DEFAULT
ScalingList = FLAT

# EntropyMode : selects the entropy coding mode (AVC only)
# allowed values : MODE_CAVLC, MODE_CABAC
# default value  : MODE_CABAC
EntropyMode = MODE_CABAC

# LoopFilter : enables/disables the deblocking filter
# allowed values : ENABLE, DISABLE
# default value  : ENABLE
LoopFilter = ENABLE

#--------------------------------------------------------------------------
[RUN]
#--------------------------------------------------------------------------

# Loop : specifies whether the encoder should loop back to the beginning of the YUV input stream when it reaches the end of the file
# Allowed values : TRUE, FALSE
# default value  : FALSE
Loop = FALSE

# MaxPicture : number of frames to encode
# Allowed value : ALL, 1 .. 2147483647
# default value : ALL
MaxPicture = ALL

# FirstPicture : specifies the first frame to encode
# Allowed value : 0 .. 2147483647
# default value : 0
FirstPicture = 0

Appendix C: Test Videos

Test .mp4 Videos

Big Buck Bunny: https://download.blender.org/demo/movies/BBB/

Elephant’s Dream: https://archive.org/details/ElephantsDream

Creating avc/hevc Encoded Videos From .mp4

# convert to h.264/avc
ffmpeg -i input.mp4 output.h264
ffmpeg -i test.mp4 -c:v copy -bsf h264_mp4toannexb out.h264

# convert to h.265/hevc
ffmpeg -i test.mp4 -c:v copy -bsf hevc_mp4toannexb out.h265

Creating .mp4 From avc/hevc Encoded Videos

ffmpeg -i <input file in hevc or avc>  -c:v copy -f mp4 <output file>.mp4

Raw Videos

https://media.xiph.org/video/derf/

These .y4m videos can be converted to YUV with the following ffmpeg command:

ffmpeg -i example.y4m test.yuv

  • No labels