Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ av1_obu,
avc_annexb,
[avc_au](doc/formats.md#avc_au),
avc_dcr,
avc_nalu,
[avc_nalu](doc/formats.md#avc_nalu),
avc_pps,
avc_sei,
avc_sps,
Expand Down
48 changes: 42 additions & 6 deletions doc/formats.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
|`avc_annexb` |H.264/AVC&nbsp;Annex&nbsp;B |<sub>`avc_nalu`</sub>|
|[`avc_au`](#avc_au) |H.264/AVC&nbsp;Access&nbsp;Unit |<sub>`avc_nalu`</sub>|
|`avc_dcr` |H.264/AVC&nbsp;Decoder&nbsp;Configuration&nbsp;Record |<sub>`avc_nalu`</sub>|
|`avc_nalu` |H.264/AVC&nbsp;Network&nbsp;Access&nbsp;Layer&nbsp;Unit |<sub>`avc_sps` `avc_pps` `avc_sei`</sub>|
|[`avc_nalu`](#avc_nalu) |H.264/AVC&nbsp;Network&nbsp;Access&nbsp;Layer&nbsp;Unit |<sub>`avc_sps` `avc_pps` `avc_sei`</sub>|
|`avc_pps` |H.264/AVC&nbsp;Picture&nbsp;Parameter&nbsp;Set |<sub></sub>|
|`avc_sei` |H.264/AVC&nbsp;Supplemental&nbsp;Enhancement&nbsp;Information |<sub></sub>|
|`avc_sps` |H.264/AVC&nbsp;Sequence&nbsp;Parameter&nbsp;Set |<sub></sub>|
Expand Down Expand Up @@ -262,20 +262,56 @@ H.264/AVC Access Unit.

### Options

|Name |Default|Description|
|- |- |-|
|`length_size`|0 |Length value size|
|Name |Default|Description|
|- |- |-|
|`bottom_field_pic_order_in_frame_present_flag`|false ||
|`delta_pic_order_always_zero_flag` |false ||
|`frame_mbs_only_flag` |true ||
|`length_size` |0 |Length value size|
|`log2max_frame_num` |4 ||
|`log2max_pic_order_cnt_lsb` |4 ||
|`pic_order_cnt_type` |0 ||
|`redundant_pic_cnt_present_flag` |false ||
|`separate_colour_plane_flag` |false ||

### Examples

Decode file using avc_au options
```
$ fq -d avc_au -o length_size=0 . file
$ fq -d avc_au -o bottom_field_pic_order_in_frame_present_flag=false -o delta_pic_order_always_zero_flag=false -o frame_mbs_only_flag=true -o length_size=0 -o log2max_frame_num=4 -o log2max_pic_order_cnt_lsb=4 -o pic_order_cnt_type=0 -o redundant_pic_cnt_present_flag=false -o separate_colour_plane_flag=false . file
```

Decode value as avc_au
```
... | avc_au({length_size:0})
... | avc_au({bottom_field_pic_order_in_frame_present_flag:false,delta_pic_order_always_zero_flag:false,frame_mbs_only_flag:true,length_size:0,log2max_frame_num:4,log2max_pic_order_cnt_lsb:4,pic_order_cnt_type:0,redundant_pic_cnt_present_flag:false,separate_colour_plane_flag:false})
```

## avc_nalu
H.264/AVC Network Access Layer Unit.

### Options

|Name |Default|Description|
|- |- |-|
|`bottom_field_pic_order_in_frame_present_flag`|false ||
|`delta_pic_order_always_zero_flag` |false ||
|`frame_mbs_only_flag` |true ||
|`log2max_frame_num` |4 ||
|`log2max_pic_order_cnt_lsb` |4 ||
|`pic_order_cnt_type` |0 ||
|`redundant_pic_cnt_present_flag` |false ||
|`separate_colour_plane_flag` |false ||

### Examples

Decode file using avc_nalu options
```
$ fq -d avc_nalu -o bottom_field_pic_order_in_frame_present_flag=false -o delta_pic_order_always_zero_flag=false -o frame_mbs_only_flag=true -o log2max_frame_num=4 -o log2max_pic_order_cnt_lsb=4 -o pic_order_cnt_type=0 -o redundant_pic_cnt_present_flag=false -o separate_colour_plane_flag=false . file
```

Decode value as avc_nalu
```
... | avc_nalu({bottom_field_pic_order_in_frame_present_flag:false,delta_pic_order_always_zero_flag:false,frame_mbs_only_flag:true,log2max_frame_num:4,log2max_pic_order_cnt_lsb:4,pic_order_cnt_type:0,redundant_pic_cnt_present_flag:false,separate_colour_plane_flag:false})
```

## avi
Expand Down
36 changes: 36 additions & 0 deletions format/format.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,46 @@ type AAC_Frame_In struct {
}
type AVC_AU_In struct {
LengthSize uint64 `doc:"Length value size"`
AVC_SPS_Info
AVC_PPS_Info
}

type AVC_NALU_In struct {
AVC_SPS_Info
AVC_PPS_Info
}

type AVC_NALU_Out struct {
AVC_SPS_Info
AVC_PPS_Info
}

type AVC_DCR_Out struct {
LengthSize uint64
AVC_SPS_Info
AVC_PPS_Info
}

type AVC_PPS_Info struct {
BottomFieldPicOrderInFramePresentFlag bool `doc:""`
RedundantPicCntPresentFlag bool `doc:""`
}

type AVC_PPS_Out struct {
AVC_PPS_Info
}

type AVC_SPS_Info struct {
SeparateColourPlaneFlag bool `doc:""`
Log2MaxFrameNum uint64 `doc:""`
FrameMbsOnlyFlag bool `doc:""`
PicOrderCntType uint64 `doc:""`
Log2MaxPicOrderCntLsb uint64 `doc:""`
DeltaPicOrderAlwaysZeroFlag bool `doc:""`
}

type AVC_SPS_Out struct {
AVC_SPS_Info
}

type CAFF_In struct {
Expand Down
9 changes: 6 additions & 3 deletions format/matroska/testdata/avc.fqtest
Original file line number Diff line number Diff line change
Expand Up @@ -476,13 +476,16 @@ $ fq -d matroska dv avc.mkv
0x0520|65 |e | forbidden_zero_bit: false 0x520-0x520.1 (0.1)
0x0520|65 |e | nal_ref_idc: 3 0x520.1-0x520.3 (0.2)
0x0520|65 |e | nal_unit_type: "idr_slice" (5) (Coded slice of an IDR picture) 0x520.3-0x521 (0.5)
| | | rbsp{}: 0x521-0x522.1 (1.1)
| | | rbsp{}: 0x521-0x523.4 (2.4)
0x0520| 88 | . | first_mb_in_slice: 0 0x521-0x521.1 (0.1)
0x0520| 88 | . | slice_type: "i" (7) 0x521.1-0x522 (0.7)
0x0520| 84 | . | pic_parameter_set_id: 0 0x522-0x522.1 (0.1)
0x0520| 84 00 2b ff fe f5 db f3 2c ac 66 67 3d ff| ..+.....,.fg=.| gap0: raw bits 0x522.1-0xd2b (2056.7)
0x0520| 84 | . | frame_num: 0 0x522.1-0x522.5 (0.4)
0x0520| 84 | . | idr_pic_id: 0 0x522.5-0x522.6 (0.1)
0x0520| 84 00 | .. | pic_order_cnt_lsb: 0 0x522.6-0x523.4 (0.6)
0x0520| 00 2b ff fe f5 db f3 2c ac 66 67 3d ff| .+.....,.fg=.| gap0: raw bits 0x523.4-0xd2b (2055.4)
0x0530|ed 3b 60 00 21 74 ff c0 cf 1f fc 67 ff cd 99 a7|.;`.!t.....g....|
* |until 0xd2a.7 (2057) | |
* |until 0xd2a.7 (2056) | |
| | | [6]{}: element 0xd2b-0xd47 (28)
0x0d20| 1c 53 bb 6b | .S.k | id: "cues" (0x1c53bb6b) (A Top-Level Element to speed seeking access) 0xd2b-0xd2f (4)
| | | type: "master"
Expand Down
28 changes: 18 additions & 10 deletions format/mp4/testdata/avc.fqtest
Original file line number Diff line number Diff line change
Expand Up @@ -479,40 +479,48 @@ $ fq -d mp4 dv avc.mp4
0x02e0| 65 | e | forbidden_zero_bit: false 0x2e5-0x2e5.1 (0.1)
0x02e0| 65 | e | nal_ref_idc: 3 0x2e5.1-0x2e5.3 (0.2)
0x02e0| 65 | e | nal_unit_type: "idr_slice" (5) (Coded slice of an IDR picture) 0x2e5.3-0x2e6 (0.5)
| | | rbsp{}: 0x2e6-0x2e7.1 (1.1)
| | | rbsp{}: 0x2e6-0x2e8.4 (2.4)
0x02e0| 88 | . | first_mb_in_slice: 0 0x2e6-0x2e6.1 (0.1)
0x02e0| 88 | . | slice_type: "i" (7) 0x2e6.1-0x2e7 (0.7)
0x02e0| 84 | . | pic_parameter_set_id: 0 0x2e7-0x2e7.1 (0.1)
0x02e0| 84 00 33 ff fe f6 86 f8 14| ..3......| gap0: raw bits 0x2e7.1-0xbfc (2324.7)
0x02e0| 84 | . | frame_num: 0 0x2e7.1-0x2e7.5 (0.4)
0x02e0| 84 | . | idr_pic_id: 0 0x2e7.5-0x2e7.6 (0.1)
0x02e0| 84 00 | .. | pic_order_cnt_lsb: 0 0x2e7.6-0x2e8.4 (0.6)
0x02e0| 00 33 ff fe f6 86 f8 14| .3......| gap0: raw bits 0x2e8.4-0xbfc (2323.4)
0x02f0|d8 53 23 af ff f2 50 06 7f 30 02 17 55 d4 5a 6f|.S#...P..0..U.Zo|
* |until 0xbfb.7 (2325) | |
* |until 0xbfb.7 (2324) | |
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef| [1][0:1]: sample (avc_au) 0xbfc-0xd49 (333)
| | | [0]{}: nalu 0xbfc-0xd49 (333)
0x0bf0| 00 00 01 49| ...I| length: 329 0xbfc-0xc00 (4)
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef| nalu{}: (avc_nalu) 0xc00-0xd49 (329)
0x0c00|41 |A | forbidden_zero_bit: false 0xc00-0xc00.1 (0.1)
0x0c00|41 |A | nal_ref_idc: 2 0xc00.1-0xc00.3 (0.2)
0x0c00|41 |A | nal_unit_type: "slice" (1) (Coded slice of a non-IDR picture) 0xc00.3-0xc01 (0.5)
| | | rbsp{}: 0xc01-0xc01.7 (0.7)
| | | rbsp{}: 0xc01-0xc03.1 (2.1)
0x0c00| 9a | . | first_mb_in_slice: 0 0xc01-0xc01.1 (0.1)
0x0c00| 9a | . | slice_type: "p" (5) 0xc01.1-0xc01.6 (0.5)
0x0c00| 9a | . | pic_parameter_set_id: 0 0xc01.6-0xc01.7 (0.1)
0x0c00| 9a 22 6c 42 bf fe 38 85 de c2 03 1a de 79 0a| ."lB..8......y.| gap0: raw bits 0xc01.7-0xd49 (327.1)
0x0c00| 9a 22 | ." | frame_num: 1 0xc01.7-0xc02.3 (0.4)
0x0c00| 22 6c | "l | pic_order_cnt_lsb: 4 0xc02.3-0xc03.1 (0.6)
0x0c00| 6c 42 bf fe 38 85 de c2 03 1a de 79 0a| lB..8......y.| gap0: raw bits 0xc03.1-0xd49 (325.7)
0x0c10|56 fd b3 4b b4 0f 24 7f e9 d3 b6 f2 5e 6f dd b7|V..K..$.....^o..|
* |until 0xd48.7 (328) | |
* |until 0xd48.7 (326) | |
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef| [2][0:1]: sample (avc_au) 0xd49-0xd81 (56)
| | | [0]{}: nalu 0xd49-0xd81 (56)
0x0d40| 00 00 00 34 | ...4 | length: 52 0xd49-0xd4d (4)
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef| nalu{}: (avc_nalu) 0xd4d-0xd81 (52)
0x0d40| 01 | . | forbidden_zero_bit: false 0xd4d-0xd4d.1 (0.1)
0x0d40| 01 | . | nal_ref_idc: 0 0xd4d.1-0xd4d.3 (0.2)
0x0d40| 01 | . | nal_unit_type: "slice" (1) (Coded slice of a non-IDR picture) 0xd4d.3-0xd4e (0.5)
| | | rbsp{}: 0xd4e-0xd4e.7 (0.7)
| | | rbsp{}: 0xd4e-0xd50.1 (2.1)
0x0d40| 9e | . | first_mb_in_slice: 0 0xd4e-0xd4e.1 (0.1)
0x0d40| 9e | . | slice_type: "b" (6) 0xd4e.1-0xd4e.6 (0.5)
0x0d40| 9e | . | pic_parameter_set_id: 0 0xd4e.6-0xd4e.7 (0.1)
0x0d40| 9e 41| .A| gap0: raw bits 0xd4e.7-0xd81 (50.1)
0x0d50|79 0a ff 01 f9 2d 04 d3 29 fe 4d 76 42 26 f6 cd|y....-..).MvB&..|
* |until 0xd80.7 (51) | |
0x0d40| 9e 41| .A| frame_num: 2 0xd4e.7-0xd4f.3 (0.4)
0x0d40| 41| A| pic_order_cnt_lsb: 2 0xd4f.3-0xd50.1 (0.6)
0x0d50|79 |y |
0x0d50|79 0a ff 01 f9 2d 04 d3 29 fe 4d 76 42 26 f6 cd|y....-..).MvB&..| gap0: raw bits 0xd50.1-0xd81 (48.7)
0x0d60|13 |. |
* |until 0xd80.7 (49) | |
| | | id: 1
| | | data_format: "avc1" (Advanced Video Coding)
Loading
Loading