By Date: <-- -->
By Thread: <-- -->

RFC: V4L2 MPEG Encoding API: Part 2 (second version)



This is part 2 of the proposal for adding an MPEG API to V4L2. This part 
describes the extended controls.

This is the revised version. The main changes against the first are:

- allowing the control type to be either INT or MENU depending on the 
driver's functionality. This solves the mess with both INT and MENU 
controls that do the same thing. Thanks to Michael Schimek for that 
idea.

If there are no serious objections, then I'll start implementing this.

There are four sections: the controls relating to the audio stream, 
controls relating to the video stream, controls relating to the system 
stream and finally controls specific to the cx2341x MPEG encoder chip 
to illustrate device specific controls.

Note that sometimes controls can either of type INT or MENU. If a driver 
can handle any bitrate, then the control will be an INT, indicating 
that anything goes (within the boundaries set by the min and max 
control values). If it is a MENU, then only the given values can be 
chosen.

Audio controls
==============

This is the full list of the audio properties that can be set according  
to the ISO/IEC 11172-3 MPEG audio standard. Also the options listed  
with each control come straight from this standard.

V4L2_CID_COMP_AUDIO_SAMPLING_FREQ
Set audio recording frequency.
MENU: possible values: 0 = 44.1, 1 = 48, 2 = 32 kHz
INT: the sampling frequency in Hz.

V4L2_CID_COMP_AUDIO_ENCODING
Set Audio encoding.
MENU: possible values: 0 = MPEG Layer 1, 1 = MPEG Layer 2, 2 = MPEG 
Layer 3

V4L2_CID_COMP_AUDIO_L1_BITRATE:
Set audio bitrate for layer 1.
Set to INACTIVE if layer != 1.
MENU: possible values:
        0 = 32k
        1 = 64k
        2 = 96k
        3 = 128k
        4 = 160k
        5 = 192k
        6 = 224k
        7 = 256k
        8 = 288k
        9 = 320k
        10 = 352k
        11 = 384k
        12 = 416k
        13 = 448k
INT: bitrate in bits per second.

V4L2_CID_COMP_AUDIO_L2_BITRATE:
Set audio bitrate for layer 2.
Set to INACTIVE if layer != 2.
MENU: possible values:
        0 = 32k
        1 = 48k
        2 = 56k
        3 = 64k
        4 = 80k
        5 = 96k
        6 = 112k
        7 = 128k
        8 = 160k
        9 = 192k
        10 = 224k
        11 = 256k
        12 = 320k
        13 = 384k
INT: bitrate in bits per second.

V4L2_CID_COMP_AUDIO_L3_BITRATE:
Set audio bitrate for layer 3.
Set to INACTIVE if layer != 3.
MENU: possible values:
        0 = 32k
        1 = 40k
        2 = 48k
        3 = 56k
        4 = 64k
        5 = 80k
        6 = 96k
        7 = 112k
        8 = 128k
        9 = 160k
        10 = 192k
        11 = 224k
        12 = 256k
        13 = 320k
INT: bitrate in bits per second.

V4L2_CID_COMP_AUDIO_MODE
Set audio mode.
MENU: possible values: 0 = stereo, 1 = joint stereo, 2 = dual, 3 = mono

V4L2_CID_COMP_AUDIO_MODE_EXTENSION
Set audio mode extension for joint stereo.
Set to inactive if AUDIO_MODE != joint stereo or AUDIO_ENCODING=Layer 3. 
This control determines which subbands use intensity-stereo encoding 
for joint stereo. Note that these values are layer 1 and 2 specific. 
For layer 3 there are two booleans defined according to the MPEG spec, 
which are currently not implemented in this specification until a 
device can actually use them.
MENU: possible values:
        0 = Subbands 4-31/bound=4
        1 = Subbands 8-31/bound=8
        2 = Subbands 12-31/bound=12
        3 = Subbands 16-31/bound=16

V4L2_CID_COMP_AUDIO_EMPHASIS
Set audio emphasis.
MENU: possible values: 0 = none, 1 = 50/15uS, 2 = CCITT J.17

V4L2_CID_COMP_AUDIO_CRC
Set whether a CRC checksum is added.
MENU: possible values: 0=off, 1=crc16

V4L2_CID_COMP_AUDIO_COPYRIGHT
Set whether the material has copyright or not.
BOOL: possible values: 1 = has copyright, 0 = does not have copyright

V4L2_CID_COMP_AUDIO_ORIGINAL
Set if the material is original or a copy.
BOOL: possible values: 1 = original, 0 = copy

-------------------------------------------------------

Video controls
==============

The video controls also map directly to video properties defined in the
ISO/IEC 11172-2 video mpeg standard.

V4L2_CID_COMP_VIDEO_ENCODING
Set Video encoding.
MENU: possible values: 0 = MPEG-1, 1 = MPEG-2

V4L2_CID_COMP_VIDEO_ASPECT
Set video aspect ratio.
MENU: possible values:
        0 = 1:1 square
        1 = 4:3
        2 = 16:9
        3 = 2.21:1

V4L2_CID_COMP_VIDEO_B_FRAMES
INT: Set number of B frames between the I and P frame.
For example: IBBPBBPBBPBB --> GOP size: 12, number of B frames: 2.

V4L2_CID_COMP_VIDEO_GOP_SIZE
INT: Set number of pictures that form a GOP (group of pictures)

V4L2_CID_COMP_VIDEO_GOP_CLOSURE
BOOL: Set the GOP open/close property: 0=Open 1=Closed

V4L2_CID_COMP_VIDEO_PULLDOWN
BOOL: Set 3:2 pulldown properties 0=enabled 1=disabled

V4L2_CID_COMP_VIDEO_BITRATE_MODE
MENU: Set CBR vs VBR: 0=variable bitrate, 1=constant bitrate

V4L2_CID_COMP_VIDEO_BITRATE
INT: Bitrate in bits per second.

V4L2_CID_COMP_VIDEO_BITRATE_PEAK
Set to INACTIVE if BITRATE_MODE is CBR.
INT: Peak bitrate in bits per second.

V4L2_CID_COMP_VIDEO_TEMPORAL_DECIMATION
INT: For each frame captured, skip specified number of frames.

-------------------------------------------------------

Stream controls
===============

The first copyright control maps to a stream property in the ISO/IEC  
11172-1 standard. The second is device specific and lists the various  
stream types that the device can produce.

V4L2_CID_COMP_STREAM_COPYRIGHT
BOOL
0=Stream is not copyrighted
1=Stream is copyrighted

V4L2_CID_COMP_STREAM_TYPE
MENU Sets the sort of stream that the encoder produces.
Note that not all stream types may be available depending on the driver. 
So querying for a menu item may result in EINVAL. This control depends 
on the audio and video encoding controls. As an example, here is the 
list for the ivtv/pvrusb2 driver:
         0=Program stream
         1=Transport stream
         2=MPEG1 stream
         3=PES A/V stream
         5=PES Video stream
         7=PES Audio stream
        10=DVD stream
        11=VCD stream
        12=SVCD stream
        13=DVD_S1 stream
        14=DVD_S2 stream

V4L2_CID_COMP_STREAM_PID_PMT
INT Transport Stream Packet Identification Code for the Program Map
Table packets.
Only active if STREAM_TYPE == transport stream.

V4L2_CID_COMP_STREAM_PID_AUDIO
INT Transport Stream Packet Identification Code for the Audio packets.
Only active if STREAM_TYPE == transport stream.

V4L2_CID_COMP_STREAM_PID_VIDEO
INT Transport Stream Packet Identification Code for the Video packets.
Only active if STREAM_TYPE == transport stream.

V4L2_CID_COMP_STREAM_PID_PCR
INT Transport Stream Packet Identification Code for the Program Clock
Reference packets.
Only active if STREAM_TYPE == transport stream.

V4L2_CID_COMP_STREAM_PES_ID_AUDIO
INT Audio PES ID.

V4L2_CID_COMP_STREAM_PES_ID_VIDEO
INT Video PES ID.

-----------------------

For the cx2341x there are a few specific controls to set, all related to
setting encoder filters. Filters like these are device specific.

Spatial filter:

V4L2_CID_COMP_CX2341X_VIDEO_SPATIAL_FILTER_MODE
Set spatial filter mode: 0=manual, 1=auto

V4L2_CID_COMP_CX2341X_VIDEO_SPATIAL_FILTER
Spatial filter setting: default 0, range 0:15
Set to inactive if SPATIAL_FILTER_MODE == auto.

V4L2_CID_COMP_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE
Luminance filter
            0=Off
            1=1D Horizontal
            2=1D Vertical
            3=2D H/V Separable (default)
            4=2D Symmetric non-separable

V4L2_CID_COMP_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE
Chrominance filter
            0=Off
            1=1D Horizontal (default)


Temporal filter:

V4L2_CID_COMP_CX2341X_VIDEO_TEMPORAL_FILTER_MODE
Set temporal filter mode: 0=manual, 1=auto

V4L2_CID_COMP_CX2341X_VIDEO_TEMPORAL_FILTER
Set temporal filter: default 0, range 0:31
Set to inactive if TEMPORAL_FILTER_MODE == auto.

Median filter:

V4L2_CID_COMP_CX2341X_VIDEO_MEDIAN_FILTER
Set median filter: 0=Disabled 1=Horizontal 2=Vertical 3=Horiz/Vert 
4=Diagonal

V4L2_CID_COMP_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_TOP
Threshold above which the luminance median filter is enabled.
Set to inactive is MEDIAN_FILTER == Disabled.
Default: 0, range 0:255

V4L2_CID_COMP_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_BOTTOM
Threshold below which the luminance median filter is enabled.
Set to inactive is MEDIAN_FILTER == Disabled.
Default: 255, range 0:255

V4L2_CID_COMP_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_TOP
Threshold above which the chrominance median filter is enabled.
Set to inactive is MEDIAN_FILTER == Disabled.
Default: 0, range 0:255

V4L2_CID_COMP_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_BOTTOM
Threshold below which the chrominance median filter is enabled.
Set to inactive is MEDIAN_FILTER == Disabled.
Default: 255, range 0:255

--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request (at) redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list