or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

audio-processing.mdcodec-operations.mdcommand-line-tools.mdconstants-enums.mdcryptographic-security.mddevice-io.mdformat-handling.mdhardware-acceleration.mdindex.mdmedia-filtering.mdpostproc.mdscaling-conversion.md

constants-enums.mddocs/

0

# Constants and Enumerations

1

2

Comprehensive reference of constants, enumerations, and compile-time values used throughout the FFmpeg JavaCPP bindings for configuration, error handling, and API parameters.

3

4

## Capabilities

5

6

### Media Types

7

8

#### AVMediaType

9

10

```java { .api }

11

// Media type constants for streams and codecs

12

int AVMEDIA_TYPE_UNKNOWN = -1; // Unknown media type

13

int AVMEDIA_TYPE_VIDEO = 0; // Video stream

14

int AVMEDIA_TYPE_AUDIO = 1; // Audio stream

15

int AVMEDIA_TYPE_DATA = 2; // Opaque data stream

16

int AVMEDIA_TYPE_SUBTITLE = 3; // Subtitle stream

17

int AVMEDIA_TYPE_ATTACHMENT = 4; // Attachment stream (fonts, images)

18

int AVMEDIA_TYPE_NB = 5; // Number of media types

19

```

20

21

### Pixel Formats

22

23

#### AVPixelFormat (Video)

24

25

```java { .api }

26

// Common pixel formats for video data

27

int AV_PIX_FMT_NONE = -1; // No pixel format

28

int AV_PIX_FMT_YUV420P = 0; // Planar YUV 4:2:0, 12bpp

29

int AV_PIX_FMT_YUYV422 = 1; // Packed YUV 4:2:2, 16bpp

30

int AV_PIX_FMT_RGB24 = 2; // Packed RGB 8:8:8, 24bpp

31

int AV_PIX_FMT_BGR24 = 3; // Packed BGR 8:8:8, 24bpp

32

int AV_PIX_FMT_YUV422P = 4; // Planar YUV 4:2:2, 16bpp

33

int AV_PIX_FMT_YUV444P = 5; // Planar YUV 4:4:4, 24bpp

34

int AV_PIX_FMT_YUV410P = 6; // Planar YUV 4:1:0, 9bpp

35

int AV_PIX_FMT_YUV411P = 7; // Planar YUV 4:1:1, 12bpp

36

int AV_PIX_FMT_GRAY8 = 8; // Y grayscale, 8bpp

37

int AV_PIX_FMT_MONOWHITE = 9; // Y 1bpp, 0 is white

38

int AV_PIX_FMT_MONOBLACK = 10; // Y 1bpp, 0 is black

39

int AV_PIX_FMT_PAL8 = 11; // 8-bit with palette

40

int AV_PIX_FMT_YUVJ420P = 12; // Planar YUV 4:2:0, 12bpp, full scale (JPEG)

41

int AV_PIX_FMT_YUVJ422P = 13; // Planar YUV 4:2:2, 16bpp, full scale (JPEG)

42

int AV_PIX_FMT_YUVJ444P = 14; // Planar YUV 4:4:4, 24bpp, full scale (JPEG)

43

44

// High bit depth formats

45

int AV_PIX_FMT_YUV420P10LE = 62; // Planar YUV 4:2:0, 15bpp, little-endian

46

int AV_PIX_FMT_YUV420P10BE = 63; // Planar YUV 4:2:0, 15bpp, big-endian

47

int AV_PIX_FMT_YUV420P16LE = 109; // Planar YUV 4:2:0, 24bpp, little-endian

48

int AV_PIX_FMT_YUV420P16BE = 110; // Planar YUV 4:2:0, 24bpp, big-endian

49

50

// Hardware acceleration formats

51

int AV_PIX_FMT_CUDA = 232; // NVIDIA CUDA format

52

int AV_PIX_FMT_VAAPI = 178; // Intel VA-API format

53

int AV_PIX_FMT_DXVA2_VLD = 133; // DirectX Video Acceleration

54

int AV_PIX_FMT_VIDEOTOOLBOX = 192; // Apple VideoToolbox format

55

```

56

57

### Audio Sample Formats

58

59

#### AVSampleFormat

60

61

```java { .api }

62

// Audio sample format constants

63

int AV_SAMPLE_FMT_NONE = -1; // No sample format

64

int AV_SAMPLE_FMT_U8 = 0; // Unsigned 8-bit

65

int AV_SAMPLE_FMT_S16 = 1; // Signed 16-bit

66

int AV_SAMPLE_FMT_S32 = 2; // Signed 32-bit

67

int AV_SAMPLE_FMT_FLT = 3; // 32-bit float

68

int AV_SAMPLE_FMT_DBL = 4; // 64-bit double

69

int AV_SAMPLE_FMT_U8P = 5; // Unsigned 8-bit, planar

70

int AV_SAMPLE_FMT_S16P = 6; // Signed 16-bit, planar

71

int AV_SAMPLE_FMT_S32P = 7; // Signed 32-bit, planar

72

int AV_SAMPLE_FMT_FLTP = 8; // 32-bit float, planar

73

int AV_SAMPLE_FMT_DBLP = 9; // 64-bit double, planar

74

int AV_SAMPLE_FMT_S64 = 10; // Signed 64-bit

75

int AV_SAMPLE_FMT_S64P = 11; // Signed 64-bit, planar

76

```

77

78

### Codec IDs

79

80

#### Video Codec IDs

81

82

```java { .api }

83

// Major video codec identifiers

84

int AV_CODEC_ID_NONE = 0; // No codec

85

86

// MPEG codecs

87

int AV_CODEC_ID_MPEG1VIDEO = 1; // MPEG-1 video

88

int AV_CODEC_ID_MPEG2VIDEO = 2; // MPEG-2 video

89

int AV_CODEC_ID_MPEG4 = 12; // MPEG-4 Part 2

90

91

// H.26x codecs

92

int AV_CODEC_ID_H261 = 3; // ITU-T H.261

93

int AV_CODEC_ID_H263 = 4; // ITU-T H.263

94

int AV_CODEC_ID_H264 = 27; // ITU-T H.264/AVC

95

int AV_CODEC_ID_H265 = 173; // ITU-T H.265/HEVC

96

97

// Modern codecs

98

int AV_CODEC_ID_VP8 = 139; // Google VP8

99

int AV_CODEC_ID_VP9 = 167; // Google VP9

100

int AV_CODEC_ID_AV1 = 225; // AOMedia AV1

101

102

// Image formats

103

int AV_CODEC_ID_MJPEG = 7; // Motion JPEG

104

int AV_CODEC_ID_PNG = 61; // PNG image

105

int AV_CODEC_ID_BMP = 67; // BMP image

106

int AV_CODEC_ID_TIFF = 145; // TIFF image

107

```

108

109

#### Audio Codec IDs

110

111

```java { .api }

112

// Major audio codec identifiers (base = 65536)

113

int AV_CODEC_ID_PCM_S16LE = 65536; // PCM signed 16-bit little-endian

114

int AV_CODEC_ID_PCM_S16BE = 65537; // PCM signed 16-bit big-endian

115

int AV_CODEC_ID_PCM_U16LE = 65538; // PCM unsigned 16-bit little-endian

116

int AV_CODEC_ID_PCM_U16BE = 65539; // PCM unsigned 16-bit big-endian

117

118

// Compressed audio

119

int AV_CODEC_ID_MP2 = 86016; // MPEG Audio Layer 2

120

int AV_CODEC_ID_MP3 = 86017; // MPEG Audio Layer 3

121

int AV_CODEC_ID_AAC = 86018; // Advanced Audio Coding

122

int AV_CODEC_ID_AC3 = 86019; // Dolby Digital (AC-3)

123

int AV_CODEC_ID_DTS = 86020; // DTS Coherent Acoustics

124

int AV_CODEC_ID_VORBIS = 86021; // Ogg Vorbis

125

int AV_CODEC_ID_FLAC = 86028; // Free Lossless Audio Codec

126

int AV_CODEC_ID_OPUS = 86076; // Opus audio codec

127

```

128

129

#### Subtitle Codec IDs

130

131

```java { .api }

132

// Subtitle codec identifiers (base = 94208)

133

int AV_CODEC_ID_DVD_SUBTITLE = 94208; // DVD subtitles

134

int AV_CODEC_ID_DVB_SUBTITLE = 94209; // DVB subtitles

135

int AV_CODEC_ID_TEXT = 94210; // Raw text

136

int AV_CODEC_ID_XSUB = 94211; // XSUB subtitles

137

int AV_CODEC_ID_SSA = 94212; // SubStation Alpha

138

int AV_CODEC_ID_MOV_TEXT = 94213; // QuickTime text

139

int AV_CODEC_ID_HDMV_PGS_SUBTITLE = 94214; // HDMV PGS subtitles

140

int AV_CODEC_ID_DVB_TELETEXT = 94215; // DVB teletext

141

int AV_CODEC_ID_SRT = 94216; // SubRip subtitles

142

int AV_CODEC_ID_WEBVTT = 94225; // WebVTT subtitles

143

```

144

145

### Container Format IDs

146

147

#### Input/Output Format Constants

148

149

```java { .api }

150

// Format context flags

151

int AVFMT_NOFILE = 0x0001; // Format does not need file I/O

152

int AVFMT_NEEDNUMBER = 0x0002; // Format needs numbered files

153

int AVFMT_SHOW_IDS = 0x0008; // Format wants AVFormatContext.duration

154

int AVFMT_GLOBALHEADER = 0x0040; // Format wants global header

155

int AVFMT_NOTIMESTAMPS = 0x0080; // Format does not need timestamps

156

int AVFMT_GENERIC_INDEX = 0x0100; // Format allows timestamp discontinuities

157

int AVFMT_TS_DISCONT = 0x0200; // Format allows timestamp discontinuities

158

int AVFMT_VARIABLE_FPS = 0x0400; // Format allows variable fps

159

int AVFMT_NODIMENSIONS = 0x0800; // Format does not need width/height

160

int AVFMT_NOSTREAMS = 0x1000; // Format does not require any streams

161

int AVFMT_NOBINSEARCH = 0x2000; // Format does not allow binary search

162

int AVFMT_NOGENSEARCH = 0x4000; // Format does not allow generic search

163

int AVFMT_NO_BYTE_SEEK = 0x8000; // Format does not allow byte seeking

164

```

165

166

### Stream Flags

167

168

#### AVStream Disposition

169

170

```java { .api }

171

// Stream disposition flags

172

int AV_DISPOSITION_DEFAULT = 0x0001; // Default stream

173

int AV_DISPOSITION_DUB = 0x0002; // Dubbed stream

174

int AV_DISPOSITION_ORIGINAL = 0x0004; // Original language

175

int AV_DISPOSITION_COMMENT = 0x0008; // Commentary stream

176

int AV_DISPOSITION_LYRICS = 0x0010; // Lyrics stream

177

int AV_DISPOSITION_KARAOKE = 0x0020; // Karaoke stream

178

int AV_DISPOSITION_FORCED = 0x0040; // Forced subtitles

179

int AV_DISPOSITION_HEARING_IMPAIRED = 0x0080; // For hearing impaired

180

int AV_DISPOSITION_VISUAL_IMPAIRED = 0x0100; // For visually impaired

181

int AV_DISPOSITION_CLEAN_EFFECTS = 0x0200; // Clean effects audio

182

int AV_DISPOSITION_ATTACHED_PIC = 0x0400; // Attached picture

183

int AV_DISPOSITION_TIMED_THUMBNAILS = 0x0800; // Timed thumbnails

184

```

185

186

### Error Codes

187

188

#### AVERROR Constants

189

190

```java { .api }

191

// FFmpeg error code functions

192

int AVERROR_BSF_NOT_FOUND(); // Bitstream filter not found

193

int AVERROR_BUG(); // Internal bug

194

int AVERROR_BUFFER_TOO_SMALL(); // Buffer too small

195

int AVERROR_DECODER_NOT_FOUND(); // Decoder not found

196

int AVERROR_DEMUXER_NOT_FOUND(); // Demuxer not found

197

int AVERROR_ENCODER_NOT_FOUND(); // Encoder not found

198

int AVERROR_EOF(); // End of file

199

int AVERROR_EXIT(); // Immediate exit requested

200

int AVERROR_EXTERNAL(); // External library error

201

int AVERROR_FILTER_NOT_FOUND(); // Filter not found

202

int AVERROR_INVALIDDATA(); // Invalid data found

203

int AVERROR_MUXER_NOT_FOUND(); // Muxer not found

204

int AVERROR_OPTION_NOT_FOUND(); // Option not found

205

int AVERROR_PATCHWELCOME(); // Feature not implemented

206

int AVERROR_PROTOCOL_NOT_FOUND(); // Protocol not found

207

int AVERROR_STREAM_NOT_FOUND(); // Stream not found

208

int AVERROR_BUG2(); // Internal bug #2

209

int AVERROR_UNKNOWN(); // Unknown error

210

int AVERROR_EXPERIMENTAL(); // Experimental feature

211

int AVERROR_INPUT_CHANGED(); // Input changed between calls

212

int AVERROR_OUTPUT_CHANGED(); // Output changed between calls

213

int AVERROR_HTTP_BAD_REQUEST(); // HTTP 400 Bad Request

214

int AVERROR_HTTP_UNAUTHORIZED(); // HTTP 401 Unauthorized

215

int AVERROR_HTTP_FORBIDDEN(); // HTTP 403 Forbidden

216

int AVERROR_HTTP_NOT_FOUND(); // HTTP 404 Not Found

217

int AVERROR_HTTP_OTHER_4XX(); // HTTP 4xx client error

218

int AVERROR_HTTP_SERVER_ERROR(); // HTTP 5xx server error

219

```

220

221

### Seeking Flags

222

223

#### AVSEEK Flags

224

225

```java { .api }

226

// Seeking operation flags

227

int AVSEEK_FLAG_BACKWARD = 1; // Seek backwards

228

int AVSEEK_FLAG_BYTE = 2; // Seek by byte position

229

int AVSEEK_FLAG_ANY = 4; // Seek to any frame (not just keyframes)

230

int AVSEEK_FLAG_FRAME = 8; // Seek by frame number

231

```

232

233

### Color and HDR Constants

234

235

#### Color Specifications

236

237

```java { .api }

238

// Color primaries

239

int AVCOL_PRI_RESERVED0 = 0; // Reserved

240

int AVCOL_PRI_BT709 = 1; // ITU-R BT.709 (HDTV)

241

int AVCOL_PRI_UNSPECIFIED = 2; // Unspecified

242

int AVCOL_PRI_RESERVED = 3; // Reserved

243

int AVCOL_PRI_BT470M = 4; // ITU-R BT.470 System M

244

int AVCOL_PRI_BT470BG = 5; // ITU-R BT.470 System B/G

245

int AVCOL_PRI_SMPTE170M = 6; // SMPTE-170M (NTSC)

246

int AVCOL_PRI_SMPTE240M = 7; // SMPTE-240M

247

int AVCOL_PRI_FILM = 8; // Generic film

248

int AVCOL_PRI_BT2020 = 9; // ITU-R BT.2020 (UHD)

249

int AVCOL_PRI_SMPTE428 = 10; // SMPTE ST 428-1

250

int AVCOL_PRI_SMPTE431 = 11; // SMPTE RP 431-2

251

int AVCOL_PRI_SMPTE432 = 12; // SMPTE EG 432-1

252

int AVCOL_PRI_JEDEC_P22 = 22; // JEDEC P22 phosphors

253

254

// Color transfer characteristics

255

int AVCOL_TRC_RESERVED0 = 0; // Reserved

256

int AVCOL_TRC_BT709 = 1; // ITU-R BT.709

257

int AVCOL_TRC_UNSPECIFIED = 2; // Unspecified

258

int AVCOL_TRC_RESERVED = 3; // Reserved

259

int AVCOL_TRC_GAMMA22 = 4; // Gamma 2.2

260

int AVCOL_TRC_GAMMA28 = 5; // Gamma 2.8

261

int AVCOL_TRC_SMPTE170M = 6; // SMPTE-170M

262

int AVCOL_TRC_SMPTE240M = 7; // SMPTE-240M

263

int AVCOL_TRC_LINEAR = 8; // Linear transfer

264

int AVCOL_TRC_LOG = 9; // Logarithmic (100:1 range)

265

int AVCOL_TRC_LOG_SQRT = 10; // Logarithmic (100*sqrt(10):1)

266

int AVCOL_TRC_IEC61966_2_4 = 11; // IEC 61966-2-4

267

int AVCOL_TRC_BT1361_ECG = 12; // ITU-R BT.1361

268

int AVCOL_TRC_IEC61966_2_1 = 13; // IEC 61966-2-1 (sRGB)

269

int AVCOL_TRC_BT2020_10 = 14; // ITU-R BT.2020 (10-bit)

270

int AVCOL_TRC_BT2020_12 = 15; // ITU-R BT.2020 (12-bit)

271

int AVCOL_TRC_SMPTE2084 = 16; // SMPTE ST 2084 (PQ)

272

int AVCOL_TRC_SMPTE428 = 17; // SMPTE ST 428-1

273

int AVCOL_TRC_ARIB_STD_B67 = 18; // ARIB STD-B67 (HLG)

274

275

// Color space/matrix coefficients

276

int AVCOL_SPC_RGB = 0; // RGB

277

int AVCOL_SPC_BT709 = 1; // ITU-R BT.709

278

int AVCOL_SPC_UNSPECIFIED = 2; // Unspecified

279

int AVCOL_SPC_RESERVED = 3; // Reserved

280

int AVCOL_SPC_FCC = 4; // FCC regulations

281

int AVCOL_SPC_BT470BG = 5; // ITU-R BT.470 System B/G

282

int AVCOL_SPC_SMPTE170M = 6; // SMPTE-170M

283

int AVCOL_SPC_SMPTE240M = 7; // SMPTE-240M

284

int AVCOL_SPC_YCGCO = 8; // YCgCo

285

int AVCOL_SPC_BT2020_NCL = 9; // ITU-R BT.2020 non-constant luminance

286

int AVCOL_SPC_BT2020_CL = 10; // ITU-R BT.2020 constant luminance

287

int AVCOL_SPC_SMPTE2085 = 11; // SMPTE ST 2085

288

int AVCOL_SPC_CHROMA_DERIVED_NCL = 12; // Chromaticity-derived non-constant luminance

289

int AVCOL_SPC_CHROMA_DERIVED_CL = 13; // Chromaticity-derived constant luminance

290

int AVCOL_SPC_ICTCP = 14; // ITU-R BT.2100 ICtCp

291

```

292

293

### Threading Constants

294

295

#### Threading Types

296

297

```java { .api }

298

// Threading type constants

299

int FF_THREAD_FRAME = 1; // Frame-level threading

300

int FF_THREAD_SLICE = 2; // Slice-level threading

301

```

302

303

### Channel Layout Constants

304

305

#### Audio Channel Layouts

306

307

```java { .api }

308

// Standard channel layout constants

309

long AV_CH_FRONT_LEFT = 0x00000001L;

310

long AV_CH_FRONT_RIGHT = 0x00000002L;

311

long AV_CH_FRONT_CENTER = 0x00000004L;

312

long AV_CH_LOW_FREQUENCY = 0x00000008L;

313

long AV_CH_BACK_LEFT = 0x00000010L;

314

long AV_CH_BACK_RIGHT = 0x00000020L;

315

long AV_CH_FRONT_LEFT_OF_CENTER = 0x00000040L;

316

long AV_CH_FRONT_RIGHT_OF_CENTER = 0x00000080L;

317

long AV_CH_BACK_CENTER = 0x00000100L;

318

long AV_CH_SIDE_LEFT = 0x00000200L;

319

long AV_CH_SIDE_RIGHT = 0x00000400L;

320

long AV_CH_TOP_CENTER = 0x00000800L;

321

322

// Common channel layout combinations

323

long AV_CH_LAYOUT_MONO = AV_CH_FRONT_CENTER;

324

long AV_CH_LAYOUT_STEREO = AV_CH_FRONT_LEFT | AV_CH_FRONT_RIGHT;

325

long AV_CH_LAYOUT_2POINT1 = AV_CH_LAYOUT_STEREO | AV_CH_LOW_FREQUENCY;

326

long AV_CH_LAYOUT_SURROUND = AV_CH_LAYOUT_STEREO | AV_CH_FRONT_CENTER;

327

long AV_CH_LAYOUT_4POINT0 = AV_CH_LAYOUT_SURROUND | AV_CH_BACK_CENTER;

328

long AV_CH_LAYOUT_5POINT0 = AV_CH_LAYOUT_SURROUND | AV_CH_SIDE_LEFT | AV_CH_SIDE_RIGHT;

329

long AV_CH_LAYOUT_5POINT1 = AV_CH_LAYOUT_5POINT0 | AV_CH_LOW_FREQUENCY;

330

long AV_CH_LAYOUT_7POINT1 = AV_CH_LAYOUT_5POINT1 | AV_CH_BACK_LEFT | AV_CH_BACK_RIGHT;

331

```

332

333

## Usage Examples

334

335

### Using Constants in Code

336

337

```java

338

// Check media type

339

if (stream.codecpar().codec_type() == AVMEDIA_TYPE_VIDEO) {

340

System.out.println("This is a video stream");

341

}

342

343

// Set pixel format

344

codecContext.pix_fmt(AV_PIX_FMT_YUV420P);

345

346

// Handle specific error

347

int result = avcodec_open2(codecContext, codec, null);

348

if (result == AVERROR_DECODER_NOT_FOUND()) {

349

System.err.println("Decoder not found");

350

} else if (result < 0) {

351

System.err.println("Other error: " + result);

352

}

353

354

// Configure audio format

355

codecContext.sample_fmt(AV_SAMPLE_FMT_FLTP);

356

codecContext.channel_layout(AV_CH_LAYOUT_STEREO);

357

```

358

359

### Constant Value Lookup

360

361

```java

362

// Get human-readable names for constants

363

String pixelFormatName = av_get_pix_fmt_name(AV_PIX_FMT_YUV420P).getString();

364

String sampleFormatName = av_get_sample_fmt_name(AV_SAMPLE_FMT_FLTP).getString();

365

366

System.out.println("Pixel format: " + pixelFormatName);

367

System.out.println("Sample format: " + sampleFormatName);

368

```

369

370

This comprehensive reference covers the most commonly used constants and enumerations in FFmpeg JavaCPP bindings, providing the numeric values and symbolic names needed for effective multimedia programming.