forked from mhaller/pyffmpeg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pyffmpeg.pyx
4035 lines (3464 loc) · 160 KB
/
pyffmpeg.pyx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# -*- coding: utf-8 -*-
"""
##################################################################################
# PyFFmpeg v2.2 alpha 1
#
# Copyright (C) 2011 Martin Haller <[email protected]>
# Copyright (C) 2011 Bertrand Nouvel <[email protected]>
# Copyright (C) 2008-2010 Bertrand Nouvel <[email protected]>
# Japanese French Laboratory for Informatics - CNRS
#
##################################################################################
# This file is distibuted under LGPL-3.0
# See COPYING file attached.
##################################################################################
#
# TODO:
# * check motion vector related functions
# * why seek_before mandatory
# * Add support for video encoding
# * add multithread support
# * Fix first frame bug...
#
# Abilities
# * Frame seeking (TO BE CHECKED again and again)
#
# Changed compared with PyFFmpeg version 1.0:
# * Clean up destructors
# * Added compatibility with NumPy and PIL
# * Added copyless mode for ordered streams/tracks ( when buffers are disabled)
# * Added audio support
# * MultiTrack support (possibility to pass paramer)
# * Added support for streamed video
# * Updated ID for compatibility with transparency
# * Updated to latest avcodec primitives
#
##################################################################################
# Based on Pyffmpeg 0.2 by
# Copyright (C) 2006-2007 James Evans <[email protected]>
# Authorization to change from GPL2.0 to LGPL 3.0 provided by original author for
# this new version
##################################################################################
"""
##################################################################################
# Settings
##################################################################################
AVCODEC_MAX_AUDIO_FRAME_SIZE=192000
AVPROBE_PADDING_SIZE=32
OUTPUTMODE_NUMPY=0
OUTPUTMODE_PIL=1
##################################################################################
# Declaration and imports
##################################################################################
import sys
import traceback
##################################################################################
# ffmpeg uses following integer types
ctypedef signed char int8_t
ctypedef unsigned char uint8_t
ctypedef signed short int16_t
ctypedef unsigned short uint16_t
ctypedef signed long int32_t
ctypedef unsigned long uint32_t
ctypedef signed long long int64_t
ctypedef unsigned long long uint64_t
##################################################################################
cdef enum:
SEEK_SET = 0
SEEK_CUR = 1
SEEK_END = 2
##################################################################################
cdef extern from "string.h":
memcpy(void * dst, void * src, unsigned long sz)
memset(void * dst, unsigned char c, unsigned long sz)
##################################################################################
cdef extern from "Python.h":
ctypedef int size_t
object PyBuffer_FromMemory( void *ptr, int size)
object PyBuffer_FromReadWriteMemory( void *ptr, int size)
object PyString_FromStringAndSize(char *s, int len)
void* PyMem_Malloc( size_t n)
void PyMem_Free( void *p)
##################################################################################
# ok libavutil 50. 39. 0
cdef extern from "libavutil/mathematics.h":
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
##################################################################################
# ok libavutil 50. 39. 0
cdef extern from "libavutil/mem.h":
# size_t is used
#ctypedef unsigned long FF_INTERNAL_MEM_TYPE
ctypedef size_t FF_INTERNAL_MEM_TYPE
void *av_mallocz(FF_INTERNAL_MEM_TYPE size)
void *av_realloc(void * ptr, FF_INTERNAL_MEM_TYPE size)
void av_free(void *ptr)
void av_freep(void *ptr)
##################################################################################
# ok libavutil 50. 39. 0
cdef extern from "libavutil/pixfmt.h":
cdef enum PixelFormat:
PIX_FMT_NONE= -1,
PIX_FMT_YUV420P, #< planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
PIX_FMT_YUYV422, #< packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
PIX_FMT_RGB24, #< packed RGB 8:8:8, 24bpp, RGBRGB...
PIX_FMT_BGR24, #< packed RGB 8:8:8, 24bpp, BGRBGR...
PIX_FMT_YUV422P, #< planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
PIX_FMT_YUV444P, #< planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
PIX_FMT_YUV410P, #< planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
PIX_FMT_YUV411P, #< planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
PIX_FMT_GRAY8, #< Y , 8bpp
PIX_FMT_MONOWHITE, #< Y , 1bpp, 0 is white, 1 is black, in each byte pixels are ordered from the msb to the lsb
PIX_FMT_MONOBLACK, #< Y , 1bpp, 0 is black, 1 is white, in each byte pixels are ordered from the msb to the lsb
PIX_FMT_PAL8, #< 8 bit with PIX_FMT_RGB32 palette
PIX_FMT_YUVJ420P, #< planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV420P and setting color_range
PIX_FMT_YUVJ422P, #< planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV422P and setting color_range
PIX_FMT_YUVJ444P, #< planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV444P and setting color_range
PIX_FMT_XVMC_MPEG2_MC,#< XVideo Motion Acceleration via common packet passing
PIX_FMT_XVMC_MPEG2_IDCT,
PIX_FMT_UYVY422, #< packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
PIX_FMT_UYYVYY411, #< packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3
PIX_FMT_BGR8, #< packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb)
PIX_FMT_BGR4, #< packed RGB 1:2:1 bitstream, 4bpp, (msb)1B 2G 1R(lsb), a byte contains two pixels, the first pixel in the byte is the one composed by the 4 msb bits
PIX_FMT_BGR4_BYTE, #< packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb)
PIX_FMT_RGB8, #< packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb)
PIX_FMT_RGB4, #< packed RGB 1:2:1 bitstream, 4bpp, (msb)1R 2G 1B(lsb), a byte contains two pixels, the first pixel in the byte is the one composed by the 4 msb bits
PIX_FMT_RGB4_BYTE, #< packed RGB 1:2:1, 8bpp, (msb)1R 2G 1B(lsb)
PIX_FMT_NV12, #< planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (first byte U and the following byte V)
PIX_FMT_NV21, #< as above, but U and V bytes are swapped
PIX_FMT_ARGB, #< packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
PIX_FMT_RGBA, #< packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
PIX_FMT_ABGR, #< packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
PIX_FMT_BGRA, #< packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
PIX_FMT_GRAY16BE, #< Y , 16bpp, big-endian
PIX_FMT_GRAY16LE, #< Y , 16bpp, little-endian
PIX_FMT_YUV440P, #< planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
PIX_FMT_YUVJ440P, #< planar YUV 4:4:0 full scale (JPEG), deprecated in favor of PIX_FMT_YUV440P and setting color_range
PIX_FMT_YUVA420P, #< planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
PIX_FMT_VDPAU_H264,#< H.264 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
PIX_FMT_VDPAU_MPEG1,#< MPEG-1 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
PIX_FMT_VDPAU_MPEG2,#< MPEG-2 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
PIX_FMT_VDPAU_WMV3,#< WMV3 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
PIX_FMT_VDPAU_VC1, #< VC-1 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
PIX_FMT_RGB48BE, #< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as big-endian
PIX_FMT_RGB48LE, #< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as little-endian
PIX_FMT_RGB565BE, #< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), big-endian
PIX_FMT_RGB565LE, #< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), little-endian
PIX_FMT_RGB555BE, #< packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), big-endian, most significant bit to 0
PIX_FMT_RGB555LE, #< packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), little-endian, most significant bit to 0
PIX_FMT_BGR565BE, #< packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), big-endian
PIX_FMT_BGR565LE, #< packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), little-endian
PIX_FMT_BGR555BE, #< packed BGR 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), big-endian, most significant bit to 1
PIX_FMT_BGR555LE, #< packed BGR 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), little-endian, most significant bit to 1
PIX_FMT_VAAPI_MOCO, #< HW acceleration through VA API at motion compensation entry-point, Picture.data[3] contains a vaapi_render_state struct which contains macroblocks as well as various fields extracted from headers
PIX_FMT_VAAPI_IDCT, #< HW acceleration through VA API at IDCT entry-point, Picture.data[3] contains a vaapi_render_state struct which contains fields extracted from headers
PIX_FMT_VAAPI_VLD, #< HW decoding through VA API, Picture.data[3] contains a vaapi_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
PIX_FMT_YUV420P16LE, #< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
PIX_FMT_YUV420P16BE, #< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
PIX_FMT_YUV422P16LE, #< planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
PIX_FMT_YUV422P16BE, #< planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
PIX_FMT_YUV444P16LE, #< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
PIX_FMT_YUV444P16BE, #< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
PIX_FMT_VDPAU_MPEG4, #< MPEG4 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
PIX_FMT_DXVA2_VLD, #< HW decoding through DXVA2, Picture.data[3] contains a LPDIRECT3DSURFACE9 pointer
PIX_FMT_RGB444BE, #< packed RGB 4:4:4, 16bpp, (msb)4A 4R 4G 4B(lsb), big-endian, most significant bits to 0
PIX_FMT_RGB444LE, #< packed RGB 4:4:4, 16bpp, (msb)4A 4R 4G 4B(lsb), little-endian, most significant bits to 0
PIX_FMT_BGR444BE, #< packed BGR 4:4:4, 16bpp, (msb)4A 4B 4G 4R(lsb), big-endian, most significant bits to 1
PIX_FMT_BGR444LE, #< packed BGR 4:4:4, 16bpp, (msb)4A 4B 4G 4R(lsb), little-endian, most significant bits to 1
PIX_FMT_Y400A, #< 8bit gray, 8bit alpha
PIX_FMT_NB #< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions
##################################################################################
# ok libavutil 50. 39. 0
cdef extern from "libavutil/avutil.h":
# from avutil.h
enum AVMediaType:
AVMEDIA_TYPE_UNKNOWN = -1,
AVMEDIA_TYPE_VIDEO,
AVMEDIA_TYPE_AUDIO,
AVMEDIA_TYPE_DATA,
AVMEDIA_TYPE_SUBTITLE,
AVMEDIA_TYPE_ATTACHMENT,
AVMEDIA_TYPE_NB
# unnamed enum for defines
enum:
AV_NOPTS_VALUE = <int64_t>0x8000000000000000
AV_TIME_BASE = 1000000
# this is defined below as variable
# AV_TIME_BASE_Q (AVRational){1, AV_TIME_BASE}
##################################################################################
# ok libavutil 50. 39. 0
cdef extern from "libavutil/samplefmt.h":
enum AVSampleFormat:
AV_SAMPLE_FMT_NONE = -1,
AV_SAMPLE_FMT_U8, #< unsigned 8 bits
AV_SAMPLE_FMT_S16, #< signed 16 bits
AV_SAMPLE_FMT_S32, #< signed 32 bits
AV_SAMPLE_FMT_FLT, #< float
AV_SAMPLE_FMT_DBL, #< double
AV_SAMPLE_FMT_NB #< Number of sample formats. DO NOT USE if dynamically linking to libavcore
##################################################################################
# ok libavutil 50. 39. 0
cdef extern from "libavutil/rational.h":
struct AVRational:
int num #< numerator
int den #< denominator
##################################################################################
# ok libavformat 52.102. 0
cdef extern from "libavformat/avio.h":
struct AVIOContext:
unsigned char *buffer
int buffer_size
unsigned char *buf_ptr, *buf_end
void *opaque
int *read_packet
int *write_packet
int64_t *seek
int64_t pos #< position in the file of the current buffer
int must_flush #< true if the next seek should flush
int eof_reached #< true if eof reached
int write_flag #< true if open for writing
int is_streamed
int max_packet_size
unsigned long checksum
unsigned char *checksum_ptr
unsigned long *update_checksum
int error #< contains the error code or 0 if no error happened
int *read_pause
int64_t *read_seek
int url_setbufsize(AVIOContext *s, int buf_size)
int url_ferror(AVIOContext *s)
int avio_open(AVIOContext **s, char *url, int flags)
int avio_close(AVIOContext *s)
int avio_read(AVIOContext *s, unsigned char *buf, int size)
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
AVIOContext *avio_alloc_context(
unsigned char *buffer,
int buffer_size,
int write_flag,
void *opaque,
void *a,
void *b,
void *c)
#struct ByteIOContext:
# pass
#ctypedef long long int offset_t
#int get_buffer(ByteIOContext *s, unsigned char *buf, int size)
# use avio_read(s, buf, size);
#int url_ferror(ByteIOContext *s)
# use int url_ferror(AVIOContext *s)
#int url_feof(ByteIOContext *s)
# use AVIOContext.eof_reached
#int url_fopen(ByteIOContext **s, char *filename, int flags)
# use avio_open(s, filename, flags);
#int url_setbufsize(ByteIOContext *s, int buf_size)
#use int url_setbufsize(AVIOContext *s, int buf_size);
#int url_fclose(ByteIOContext *s)
# use avio_close(s)
#long long int url_fseek(ByteIOContext *s, long long int offset, int whence)
# use avio_seek(s, offset, whence);
# ByteIOContext *av_alloc_put_byte(
# unsigned char *buffer,
# int buffer_size,
# int write_flag,
# void *opaque,
# void * a , void * b , void * c)
# #int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),
# #int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),
# #offset_t (*seek)(void *opaque, offset_t offset, int whence))
# use avio_alloc_context(buffer, buffer_size, write_flag, opaque,
# read_packet, write_packet, seek);
##################################################################################
# ok libavcodec 52.113. 2
cdef extern from "libavcodec/avcodec.h":
# use an unamed enum for defines
cdef enum:
CODEC_FLAG_QSCALE = 0x0002 #< Use fixed qscale.
CODEC_FLAG_4MV = 0x0004 #< 4 MV per MB allowed / advanced prediction for H.263.
CODEC_FLAG_QPEL = 0x0010 #< Use qpel MC.
CODEC_FLAG_GMC = 0x0020 #< Use GMC.
CODEC_FLAG_MV0 = 0x0040 #< Always try a MB with MV=<0,0>.
CODEC_FLAG_PART = 0x0080 #< Use data partitioning.
# * The parent program guarantees that the input for B-frames containing
# * streams is not written to for at least s->max_b_frames+1 frames, if
# * this is not set the input will be copied.
CODEC_FLAG_INPUT_PRESERVED = 0x0100
CODEC_FLAG_PASS1 = 0x0200 #< Use internal 2pass ratecontrol in first pass mode.
CODEC_FLAG_PASS2 = 0x0400 #< Use internal 2pass ratecontrol in second pass mode.
CODEC_FLAG_EXTERN_HUFF = 0x1000 #< Use external Huffman table (for MJPEG).
CODEC_FLAG_GRAY = 0x2000 #< Only decode/encode grayscale.
CODEC_FLAG_EMU_EDGE = 0x4000 #< Don't draw edges.
CODEC_FLAG_PSNR = 0x8000 #< error[?] variables will be set during encoding.
CODEC_FLAG_TRUNCATED = 0x00010000 #< Input bitstream might be truncated at a random location instead of only at frame boundaries.
CODEC_FLAG_NORMALIZE_AQP = 0x00020000 #< Normalize adaptive quantization.
CODEC_FLAG_INTERLACED_DCT = 0x00040000 #< Use interlaced DCT.
CODEC_FLAG_LOW_DELAY = 0x00080000 #< Force low delay.
CODEC_FLAG_ALT_SCAN = 0x00100000 #< Use alternate scan.
CODEC_FLAG_GLOBAL_HEADER = 0x00400000 #< Place global headers in extradata instead of every keyframe.
CODEC_FLAG_BITEXACT = 0x00800000 #< Use only bitexact stuff (except (I)DCT).
# Fx : Flag for h263+ extra options
CODEC_FLAG_AC_PRED = 0x01000000 #< H.263 advanced intra coding / MPEG-4 AC prediction
CODEC_FLAG_H263P_UMV = 0x02000000 #< unlimited motion vector
CODEC_FLAG_CBP_RD = 0x04000000 #< Use rate distortion optimization for cbp.
CODEC_FLAG_QP_RD = 0x08000000 #< Use rate distortion optimization for qp selectioon.
CODEC_FLAG_H263P_AIV = 0x00000008 #< H.263 alternative inter VLC
CODEC_FLAG_OBMC = 0x00000001 #< OBMC
CODEC_FLAG_LOOP_FILTER = 0x00000800 #< loop filter
CODEC_FLAG_H263P_SLICE_STRUCT = 0x10000000
CODEC_FLAG_INTERLACED_ME = 0x20000000 #< interlaced motion estimation
CODEC_FLAG_SVCD_SCAN_OFFSET = 0x40000000 #< Will reserve space for SVCD scan offset user data.
CODEC_FLAG_CLOSED_GOP = 0x80000000
CODEC_FLAG2_FAST = 0x00000001 #< Allow non spec compliant speedup tricks.
CODEC_FLAG2_STRICT_GOP = 0x00000002 #< Strictly enforce GOP size.
CODEC_FLAG2_NO_OUTPUT = 0x00000004 #< Skip bitstream encoding.
CODEC_FLAG2_LOCAL_HEADER = 0x00000008 #< Place global headers at every keyframe instead of in extradata.
CODEC_FLAG2_BPYRAMID = 0x00000010 #< H.264 allow B-frames to be used as references.
CODEC_FLAG2_WPRED = 0x00000020 #< H.264 weighted biprediction for B-frames
CODEC_FLAG2_MIXED_REFS = 0x00000040 #< H.264 one reference per partition, as opposed to one reference per macroblock
CODEC_FLAG2_8X8DCT = 0x00000080 #< H.264 high profile 8x8 transform
CODEC_FLAG2_FASTPSKIP = 0x00000100 #< H.264 fast pskip
CODEC_FLAG2_AUD = 0x00000200 #< H.264 access unit delimiters
CODEC_FLAG2_BRDO = 0x00000400 #< B-frame rate-distortion optimization
CODEC_FLAG2_INTRA_VLC = 0x00000800 #< Use MPEG-2 intra VLC table.
CODEC_FLAG2_MEMC_ONLY = 0x00001000 #< Only do ME/MC (I frames -> ref, P frame -> ME+MC).
CODEC_FLAG2_DROP_FRAME_TIMECODE = 0x00002000 #< timecode is in drop frame format.
CODEC_FLAG2_SKIP_RD = 0x00004000 #< RD optimal MB level residual skipping
CODEC_FLAG2_CHUNKS = 0x00008000 #< Input bitstream might be truncated at a packet boundaries instead of only at frame boundaries.
CODEC_FLAG2_NON_LINEAR_QUANT = 0x00010000 #< Use MPEG-2 nonlinear quantizer.
CODEC_FLAG2_BIT_RESERVOIR = 0x00020000 #< Use a bit reservoir when encoding if possible
CODEC_FLAG2_MBTREE = 0x00040000 #< Use macroblock tree ratecontrol (x264 only)
CODEC_FLAG2_PSY = 0x00080000 #< Use psycho visual optimizations.
CODEC_FLAG2_SSIM = 0x00100000 #< Compute SSIM during encoding, error[] values are undefined.
CODEC_FLAG2_INTRA_REFRESH = 0x00200000 #< Use periodic insertion of intra blocks instead of keyframes.
# codec capabilities
CODEC_CAP_DRAW_HORIZ_BAND = 0x0001 #< Decoder can use draw_horiz_band callback.
CODEC_CAP_DR1 = 0x0002
CODEC_CAP_PARSE_ONLY = 0x0004
CODEC_CAP_TRUNCATED = 0x0008
CODEC_CAP_HWACCEL = 0x0010
CODEC_CAP_DELAY = 0x0020
CODEC_CAP_SMALL_LAST_FRAME = 0x0040
CODEC_CAP_HWACCEL_VDPAU = 0x0080
CODEC_CAP_SUBFRAMES = 0x0100
CODEC_CAP_EXPERIMENTAL = 0x0200
CODEC_CAP_CHANNEL_CONF = 0x0400
CODEC_CAP_NEG_LINESIZES = 0x0800
CODEC_CAP_FRAME_THREADS = 0x1000
# AVFrame pict_type values
FF_I_TYPE = 1 #< Intra
FF_P_TYPE = 2 #< Predicted
FF_B_TYPE = 3 #< Bi-dir predicted
FF_S_TYPE = 4 #< S(GMC)-VOP MPEG4
FF_SI_TYPE = 5 #< Switching Intra
FF_SP_TYPE = 6 #< Switching Predicte
FF_BI_TYPE = 7
# AVFrame mb_type values
#The following defines may change, don't expect compatibility if you use them.
#Note bits 24-31 are reserved for codec specific use (h264 ref0, mpeg1 0mv, ...)
MB_TYPE_INTRA4x4 = 0x0001
MB_TYPE_INTRA16x16 = 0x0002 #FIXME H.264-specific
MB_TYPE_INTRA_PCM = 0x0004 #FIXME H.264-specific
MB_TYPE_16x16 = 0x0008
MB_TYPE_16x8 = 0x0010
MB_TYPE_8x16 = 0x0020
MB_TYPE_8x8 = 0x0040
MB_TYPE_INTERLACED = 0x0080
MB_TYPE_DIRECT2 = 0x0100 #FIXME
MB_TYPE_ACPRED = 0x0200
MB_TYPE_GMC = 0x0400
MB_TYPE_SKIP = 0x0800
MB_TYPE_P0L0 = 0x1000
MB_TYPE_P1L0 = 0x2000
MB_TYPE_P0L1 = 0x4000
MB_TYPE_P1L1 = 0x8000
MB_TYPE_L0 = (MB_TYPE_P0L0 | MB_TYPE_P1L0)
MB_TYPE_L1 = (MB_TYPE_P0L1 | MB_TYPE_P1L1)
MB_TYPE_L0L1 = (MB_TYPE_L0 | MB_TYPE_L1)
MB_TYPE_QUANT = 0x00010000
MB_TYPE_CBP = 0x00020000
# AVCodecContext error_concealment values
FF_EC_GUESS_MV = 1
FF_EC_DEBLOCK = 2
# AVCodecContext debug values
FF_DEBUG_PICT_INFO = 1
FF_DEBUG_RC = 2
FF_DEBUG_BITSTREAM = 4
FF_DEBUG_MB_TYPE = 8
FF_DEBUG_QP = 16
FF_DEBUG_MV = 32
FF_DEBUG_DCT_COEFF = 0x00000040
FF_DEBUG_SKIP = 0x00000080
FF_DEBUG_STARTCODE = 0x00000100
FF_DEBUG_PTS = 0x00000200
FF_DEBUG_ER = 0x00000400
FF_DEBUG_MMCO = 0x00000800
FF_DEBUG_BUGS = 0x00001000
FF_DEBUG_VIS_QP = 0x00002000
FF_DEBUG_VIS_MB_TYPE = 0x00004000
FF_DEBUG_BUFFERS = 0x00008000
# AVCodecContext debug_mv values
FF_DEBUG_VIS_MV_P_FOR = 0x00000001 #< visualize forward predicted MVs of P frames
FF_DEBUG_VIS_MV_B_FOR = 0x00000002 #< visualize forward predicted MVs of B frames
FF_DEBUG_VIS_MV_B_BACK = 0x00000004 #< visualize backward predicted MVs of B frames
# AVCodecContex dtg_active_format values
FF_DTG_AFD_SAME = 8
FF_DTG_AFD_4_3 = 9 #< 4:3
FF_DTG_AFD_16_9 = 10 #< 16:9
FF_DTG_AFD_14_9 = 11 #< 14:9
FF_DTG_AFD_4_3_SP_14_9 = 13
FF_DTG_AFD_16_9_SP_14_9= 14
FF_DTG_AFD_SP_4_3 = 15
# AVCodecContex profile values
FF_PROFILE_UNKNOWN = -99
FF_PROFILE_AAC_MAIN = 0
FF_PROFILE_AAC_LOW = 1
FF_PROFILE_AAC_SSR = 2
FF_PROFILE_AAC_LTP = 3
FF_PROFILE_H264_BASELINE = 66
FF_PROFILE_H264_MAIN = 77
FF_PROFILE_H264_EXTENDED = 88
FF_PROFILE_H264_HIGH = 100
FF_PROFILE_H264_HIGH_10 = 110
FF_PROFILE_H264_HIGH_422 = 122
FF_PROFILE_H264_HIGH_444 = 244
FF_PROFILE_H264_CAVLC_444 = 44
FF_LEVEL_UNKNOWN = -99
# ok libavcodec 52.113. 2
enum AVDiscard:
# we leave some space between them for extensions (drop some keyframes for intra only or drop just some bidir frames)
AVDISCARD_NONE = -16 # discard nothing
AVDISCARD_DEFAULT= 0 # discard useless packets like 0 size packets in avi
AVDISCARD_NONREF = 8 # discard all non reference
AVDISCARD_BIDIR = 16 # discard all bidirectional frames
AVDISCARD_NONKEY = 32 # discard all frames except keyframes
AVDISCARD_ALL = 48 # discard all
# ok libavcodec 52.113. 2
enum AVColorPrimaries:
AVCOL_PRI_BT709 = 1 #< also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP177 Annex B
AVCOL_PRI_UNSPECIFIED = 2
AVCOL_PRI_BT470M = 4
AVCOL_PRI_BT470BG = 5 #< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM
AVCOL_PRI_SMPTE170M = 6 #< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC
AVCOL_PRI_SMPTE240M = 7 #< functionally identical to above
AVCOL_PRI_FILM = 8
AVCOL_PRI_NB = 9 #< Not part of ABI
# ok libavcodec 52.113. 2
enum AVColorTransferCharacteristic:
AVCOL_TRC_BT709 = 1 #< also ITU-R BT1361
AVCOL_TRC_UNSPECIFIED = 2
AVCOL_TRC_GAMMA22 = 4 #< also ITU-R BT470M / ITU-R BT1700 625 PAL & SECAM
AVCOL_TRC_GAMMA28 = 5 #< also ITU-R BT470BG
AVCOL_TRC_NB = 6 #< Not part of ABI
# ok libavcodec 52.113. 2
enum AVColorSpace:
AVCOL_SPC_RGB = 0
AVCOL_SPC_BT709 = 1 #< also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / SMPTE RP177 Annex B
AVCOL_SPC_UNSPECIFIED = 2
AVCOL_SPC_FCC = 4
AVCOL_SPC_BT470BG = 5 #< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601
AVCOL_SPC_SMPTE170M = 6 #< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC / functionally identical to above
AVCOL_SPC_SMPTE240M = 7
AVCOL_SPC_NB = 8 #< Not part of ABI
# ok libavcodec 52.113. 2
enum AVColorRange:
AVCOL_RANGE_UNSPECIFIED = 0
AVCOL_RANGE_MPEG = 1 #< the normal 219*2^(n-8) "MPEG" YUV ranges
AVCOL_RANGE_JPEG = 2 #< the normal 2^n-1 "JPEG" YUV ranges
AVCOL_RANGE_NB = 3 #< Not part of ABI
# ok libavcodec 52.113. 2
enum AVChromaLocation:
AVCHROMA_LOC_UNSPECIFIED = 0
AVCHROMA_LOC_LEFT = 1 #< mpeg2/4, h264 default
AVCHROMA_LOC_CENTER = 2 #< mpeg1, jpeg, h263
AVCHROMA_LOC_TOPLEFT = 3 #< DV
AVCHROMA_LOC_TOP = 4
AVCHROMA_LOC_BOTTOMLEFT = 5
AVCHROMA_LOC_BOTTOM = 6
AVCHROMA_LOC_NB = 7 #< Not part of ABI
# ok libavcodec 52.113. 2
enum CodecID:
CODEC_ID_NONE,
# video codecs
CODEC_ID_MPEG1VIDEO,
CODEC_ID_MPEG2VIDEO, #< preferred ID for MPEG-1/2 video decoding
CODEC_ID_MPEG2VIDEO_XVMC,
CODEC_ID_H261,
CODEC_ID_H263,
CODEC_ID_RV10,
CODEC_ID_RV20,
CODEC_ID_MJPEG,
CODEC_ID_MJPEGB,
CODEC_ID_LJPEG,
CODEC_ID_SP5X,
CODEC_ID_JPEGLS,
CODEC_ID_MPEG4,
CODEC_ID_RAWVIDEO,
CODEC_ID_MSMPEG4V1,
CODEC_ID_MSMPEG4V2,
CODEC_ID_MSMPEG4V3,
CODEC_ID_WMV1,
CODEC_ID_WMV2,
CODEC_ID_H263P,
CODEC_ID_H263I,
CODEC_ID_FLV1,
CODEC_ID_SVQ1,
CODEC_ID_SVQ3,
CODEC_ID_DVVIDEO,
CODEC_ID_HUFFYUV,
CODEC_ID_CYUV,
CODEC_ID_H264,
CODEC_ID_INDEO3,
CODEC_ID_VP3,
CODEC_ID_THEORA,
CODEC_ID_ASV1,
CODEC_ID_ASV2,
CODEC_ID_FFV1,
CODEC_ID_4XM,
CODEC_ID_VCR1,
CODEC_ID_CLJR,
CODEC_ID_MDEC,
CODEC_ID_ROQ,
CODEC_ID_INTERPLAY_VIDEO,
CODEC_ID_XAN_WC3,
CODEC_ID_XAN_WC4,
CODEC_ID_RPZA,
CODEC_ID_CINEPAK,
CODEC_ID_WS_VQA,
CODEC_ID_MSRLE,
CODEC_ID_MSVIDEO1,
CODEC_ID_IDCIN,
CODEC_ID_8BPS,
CODEC_ID_SMC,
CODEC_ID_FLIC,
CODEC_ID_TRUEMOTION1,
CODEC_ID_VMDVIDEO,
CODEC_ID_MSZH,
CODEC_ID_ZLIB,
CODEC_ID_QTRLE,
CODEC_ID_SNOW,
CODEC_ID_TSCC,
CODEC_ID_ULTI,
CODEC_ID_QDRAW,
CODEC_ID_VIXL,
CODEC_ID_QPEG,
CODEC_ID_XVID, #< LIBAVCODEC_VERSION_MAJOR < 53
CODEC_ID_PNG,
CODEC_ID_PPM,
CODEC_ID_PBM,
CODEC_ID_PGM,
CODEC_ID_PGMYUV,
CODEC_ID_PAM,
CODEC_ID_FFVHUFF,
CODEC_ID_RV30,
CODEC_ID_RV40,
CODEC_ID_VC1,
CODEC_ID_WMV3,
CODEC_ID_LOCO,
CODEC_ID_WNV1,
CODEC_ID_AASC,
CODEC_ID_INDEO2,
CODEC_ID_FRAPS,
CODEC_ID_TRUEMOTION2,
CODEC_ID_BMP,
CODEC_ID_CSCD,
CODEC_ID_MMVIDEO,
CODEC_ID_ZMBV,
CODEC_ID_AVS,
CODEC_ID_SMACKVIDEO,
CODEC_ID_NUV,
CODEC_ID_KMVC,
CODEC_ID_FLASHSV,
CODEC_ID_CAVS,
CODEC_ID_JPEG2000,
CODEC_ID_VMNC,
CODEC_ID_VP5,
CODEC_ID_VP6,
CODEC_ID_VP6F,
CODEC_ID_TARGA,
CODEC_ID_DSICINVIDEO,
CODEC_ID_TIERTEXSEQVIDEO,
CODEC_ID_TIFF,
CODEC_ID_GIF,
CODEC_ID_FFH264,
CODEC_ID_DXA,
CODEC_ID_DNXHD,
CODEC_ID_THP,
CODEC_ID_SGI,
CODEC_ID_C93,
CODEC_ID_BETHSOFTVID,
CODEC_ID_PTX,
CODEC_ID_TXD,
CODEC_ID_VP6A,
CODEC_ID_AMV,
CODEC_ID_VB,
CODEC_ID_PCX,
CODEC_ID_SUNRAST,
CODEC_ID_INDEO4,
CODEC_ID_INDEO5,
CODEC_ID_MIMIC,
CODEC_ID_RL2,
CODEC_ID_8SVX_EXP,
CODEC_ID_8SVX_FIB,
CODEC_ID_ESCAPE124,
CODEC_ID_DIRAC,
CODEC_ID_BFI,
CODEC_ID_CMV,
CODEC_ID_MOTIONPIXELS,
CODEC_ID_TGV,
CODEC_ID_TGQ,
CODEC_ID_TQI,
CODEC_ID_AURA,
CODEC_ID_AURA2,
CODEC_ID_V210X,
CODEC_ID_TMV,
CODEC_ID_V210,
CODEC_ID_DPX,
CODEC_ID_MAD,
CODEC_ID_FRWU,
CODEC_ID_FLASHSV2,
CODEC_ID_CDGRAPHICS,
CODEC_ID_R210,
CODEC_ID_ANM,
CODEC_ID_BINKVIDEO,
CODEC_ID_IFF_ILBM,
CODEC_ID_IFF_BYTERUN1,
CODEC_ID_KGV1,
CODEC_ID_YOP,
CODEC_ID_VP8,
CODEC_ID_PICTOR,
CODEC_ID_ANSI,
CODEC_ID_A64_MULTI,
CODEC_ID_A64_MULTI5,
CODEC_ID_R10K,
CODEC_ID_MXPEG,
CODEC_ID_LAGARITH,
CODEC_ID_PRORES,
# various PCM "codecs"
CODEC_ID_PCM_S16LE= 0x10000,
CODEC_ID_PCM_S16BE,
CODEC_ID_PCM_U16LE,
CODEC_ID_PCM_U16BE,
CODEC_ID_PCM_S8,
CODEC_ID_PCM_U8,
CODEC_ID_PCM_MULAW,
CODEC_ID_PCM_ALAW,
CODEC_ID_PCM_S32LE,
CODEC_ID_PCM_S32BE,
CODEC_ID_PCM_U32LE,
CODEC_ID_PCM_U32BE,
CODEC_ID_PCM_S24LE,
CODEC_ID_PCM_S24BE,
CODEC_ID_PCM_U24LE,
CODEC_ID_PCM_U24BE,
CODEC_ID_PCM_S24DAUD,
CODEC_ID_PCM_ZORK,
CODEC_ID_PCM_S16LE_PLANAR,
CODEC_ID_PCM_DVD,
CODEC_ID_PCM_F32BE,
CODEC_ID_PCM_F32LE,
CODEC_ID_PCM_F64BE,
CODEC_ID_PCM_F64LE,
CODEC_ID_PCM_BLURAY,
CODEC_ID_PCM_LXF,
# various ADPCM codecs
CODEC_ID_ADPCM_IMA_QT= 0x11000,
CODEC_ID_ADPCM_IMA_WAV,
CODEC_ID_ADPCM_IMA_DK3,
CODEC_ID_ADPCM_IMA_DK4,
CODEC_ID_ADPCM_IMA_WS,
CODEC_ID_ADPCM_IMA_SMJPEG,
CODEC_ID_ADPCM_MS,
CODEC_ID_ADPCM_4XM,
CODEC_ID_ADPCM_XA,
CODEC_ID_ADPCM_ADX,
CODEC_ID_ADPCM_EA,
CODEC_ID_ADPCM_G726,
CODEC_ID_ADPCM_CT,
CODEC_ID_ADPCM_SWF,
CODEC_ID_ADPCM_YAMAHA,
CODEC_ID_ADPCM_SBPRO_4,
CODEC_ID_ADPCM_SBPRO_3,
CODEC_ID_ADPCM_SBPRO_2,
CODEC_ID_ADPCM_THP,
CODEC_ID_ADPCM_IMA_AMV,
CODEC_ID_ADPCM_EA_R1,
CODEC_ID_ADPCM_EA_R3,
CODEC_ID_ADPCM_EA_R2,
CODEC_ID_ADPCM_IMA_EA_SEAD,
CODEC_ID_ADPCM_IMA_EA_EACS,
CODEC_ID_ADPCM_EA_XAS,
CODEC_ID_ADPCM_EA_MAXIS_XA,
CODEC_ID_ADPCM_IMA_ISS,
CODEC_ID_ADPCM_G722,
# AMR
CODEC_ID_AMR_NB= 0x12000,
CODEC_ID_AMR_WB,
# RealAudio codecs
CODEC_ID_RA_144= 0x13000,
CODEC_ID_RA_288,
# various DPCM codecs
CODEC_ID_ROQ_DPCM= 0x14000,
CODEC_ID_INTERPLAY_DPCM,
CODEC_ID_XAN_DPCM,
CODEC_ID_SOL_DPCM,
# audio codecs
CODEC_ID_MP2= 0x15000,
CODEC_ID_MP3, #< preferred ID for decoding MPEG audio layer 1, 2 or 3
CODEC_ID_AAC,
CODEC_ID_AC3,
CODEC_ID_DTS,
CODEC_ID_VORBIS,
CODEC_ID_DVAUDIO,
CODEC_ID_WMAV1,
CODEC_ID_WMAV2,
CODEC_ID_MACE3,
CODEC_ID_MACE6,
CODEC_ID_VMDAUDIO,
CODEC_ID_SONIC,
CODEC_ID_SONIC_LS,
CODEC_ID_FLAC,
CODEC_ID_MP3ADU,
CODEC_ID_MP3ON4,
CODEC_ID_SHORTEN,
CODEC_ID_ALAC,
CODEC_ID_WESTWOOD_SND1,
CODEC_ID_GSM, #< as in Berlin toast format
CODEC_ID_QDM2,
CODEC_ID_COOK,
CODEC_ID_TRUESPEECH,
CODEC_ID_TTA,
CODEC_ID_SMACKAUDIO,
CODEC_ID_QCELP,
CODEC_ID_WAVPACK,
CODEC_ID_DSICINAUDIO,
CODEC_ID_IMC,
CODEC_ID_MUSEPACK7,
CODEC_ID_MLP,
CODEC_ID_GSM_MS, # as found in WAV
CODEC_ID_ATRAC3,
CODEC_ID_VOXWARE,
CODEC_ID_APE,
CODEC_ID_NELLYMOSER,
CODEC_ID_MUSEPACK8,
CODEC_ID_SPEEX,
CODEC_ID_WMAVOICE,
CODEC_ID_WMAPRO,
CODEC_ID_WMALOSSLESS,
CODEC_ID_ATRAC3P,
CODEC_ID_EAC3,
CODEC_ID_SIPR,
CODEC_ID_MP1,
CODEC_ID_TWINVQ,
CODEC_ID_TRUEHD,
CODEC_ID_MP4ALS,
CODEC_ID_ATRAC1,
CODEC_ID_BINKAUDIO_RDFT,
CODEC_ID_BINKAUDIO_DCT,
CODEC_ID_AAC_LATM,
CODEC_ID_QDMC,
# subtitle codecs
CODEC_ID_DVD_SUBTITLE= 0x17000,
CODEC_ID_DVB_SUBTITLE,
CODEC_ID_TEXT, #< raw UTF-8 text
CODEC_ID_XSUB,
CODEC_ID_SSA,
CODEC_ID_MOV_TEXT,
CODEC_ID_HDMV_PGS_SUBTITLE,
CODEC_ID_DVB_TELETEXT,
CODEC_ID_SRT,
CODEC_ID_TTF= 0x18000,
CODEC_ID_PROBE= 0x19000,
CODEC_ID_MPEG2TS= 0x20000
CODEC_ID_FFMETADATA=0x21000, #< Dummy codec for streams containing only metadata information.
# ok libavcodec 52.113. 2
enum CodecType:
CODEC_TYPE_UNKNOWN = AVMEDIA_TYPE_UNKNOWN
CODEC_TYPE_VIDEO = AVMEDIA_TYPE_VIDEO
CODEC_TYPE_AUDIO = AVMEDIA_TYPE_AUDIO
CODEC_TYPE_DATA = AVMEDIA_TYPE_DATA
CODEC_TYPE_SUBTITLE = AVMEDIA_TYPE_SUBTITLE
CODEC_TYPE_ATTACHMENT = AVMEDIA_TYPE_ATTACHMENT
CODEC_TYPE_NB = AVMEDIA_TYPE_NB
# ok libavcodec 52.113. 2
struct AVPanScan:
int id
int width
int height
int16_t position[3][2]
# ok libavcodec 52.113. 2
struct AVPacket:
int64_t pts #< presentation time stamp in time_base units
int64_t dts #< decompression time stamp in time_base units
char *data
int size
int stream_index
int flags
int duration #< presentation duration in time_base units (0 if not available)
void *destruct
void *priv
int64_t pos #< byte position in Track, -1 if unknown
#===============================================================================
# * Time difference in AVStream->time_base units from the pts of this
# * packet to the point at which the output from the decoder has converged
# * independent from the availability of previous frames. That is, the
# * frames are virtually identical no matter if decoding started from
# * the very first frame or from this keyframe.
# * Is AV_NOPTS_VALUE if unknown.
# * This field is not the display duration of the current packet.
# * This field has no meaning if the packet does not have AV_PKT_FLAG_KEY
# * set.
# *
# * The purpose of this field is to allow seeking in streams that have no
# * keyframes in the conventional sense. It corresponds to the
# * recovery point SEI in H.264 and match_time_delta in NUT. It is also
# * essential for some types of subtitle streams to ensure that all
# * subtitles are correctly displayed after seeking.
#===============================================================================
int64_t convergence_duration
# ok libavcodec 52.113. 2
struct AVProfile:
int profile
char * name #< short name for the profile
# ok libavcodec 52.113. 2
struct AVCodec:
char * name
AVMediaType type
CodecID id
int priv_data_size
int * init # function pointer
int * encode # function pointer
int * close # function pointer
int * decode # function pointer
int capabilities #< see CODEC_CAP_xxx in
AVCodec * next
void * flush
AVRational * supported_framerates #< array of supported framerates, or NULL
# if any, array is terminated by {0,0}
PixelFormat * pix_fmts #< array of supported pixel formats, or NULL
# if unknown, array is terminanted by -1
char * long_name
int * supported_samplerates #< array of supported audio samplerates, or NULL if unknown, array is terminated by 0
AVSampleFormat * sample_fmts #< array of supported sample formats, or NULL if unknown, array is terminated by -1
int64_t * channel_layouts #< array of support channel layouts, or NULL if unknown. array is terminated by 0
uint8_t max_lowres #< maximum value for lowres supported by the decoder
void * priv_class #< AVClass for the private context
AVProfile * profiles #< array of recognized profiles, or NULL if unknown, array is terminated by {FF_PROFILE_UNKNOWN}
int * init_thread_copy # function pointer
int * update_thread_context # function pointer
# ok libavcodec 52.113. 2
struct AVFrame:
uint8_t *data[4] #< pointer to the picture planes
int linesize[4] #<
uint8_t *base[4] #< pointer to the first allocated byte of the picture. Can be used in get_buffer/release_buffer
int key_frame #< 1 -> keyframe, 0-> not
int pict_type #< Picture type of the frame, see ?_TYPE below
int64_t pts #< presentation timestamp in time_base units (time when frame should be shown to user)
int coded_picture_number #< picture number in bitstream order
int display_picture_number #< picture number in display order
int quality #< quality (between 1 (good) and FF_LAMBDA_MAX (bad))
int age #< buffer age (1->was last buffer and dint change, 2->..., ...)
int reference #< is this picture used as reference
int qscale_table #< QP table
int qstride #< QP store stride
uint8_t *mbskip_table #< mbskip_table[mb]>=1 if MB didn't change, stride= mb_width = (width+15)>>4
int16_t (*motion_val[2])[2] #< motion vector table
uint32_t *mb_type #< macroblock type table: mb_type_base + mb_width + 2
uint8_t motion_subsample_log2 #< log2 of the size of the block which a single vector in motion_val represents: (4->16x16, 3->8x8, 2-> 4x4, 1-> 2x2)
void *opaque #< for some private data of the user
uint64_t error[4] #< unused for decodig
int type #< type of the buffer (to keep track of who has to deallocate data[*]
int repeat_pict #< When decoding, this signals how much the picture must be delayed: extra_delay = repeat_pict / (2*fps)
int qscale_type
int interlaced_frame #< The content of the picture is interlaced
int top_field_first #< If the content is interlaced, is top field displayed first
AVPanScan *pan_scan #< Pan scan
int palette_has_changed #< Tell user application that palette has changed from previous frame
int buffer_hints #<
short *dct_coeff #< DCT coefficients
int8_t *ref_index[2] #< motion reference frame index, the order in which these are stored can depend on the codec
# reordered opaque 64bit (generally an integer or a double precision float
# PTS but can be anything).
# The user sets AVCodecContext.reordered_opaque to represent the input at
# that time, the decoder reorders values as needed and sets AVFrame.reordered_opaque
# to exactly one of the values provided by the user through AVCodecContext.reordered_opaque
# @deprecated in favor of pkt_pts
int64_t reordered_opaque
void *hwaccel_picture_private #< hardware accelerator private data
int64_t pkt_pts #< reordered pts from the last AVPacket that has been input into the decoder
int64_t pkt_dts #< dts from the last AVPacket that has been input into the decoder
# AVCodecContext *owner #< the AVCodecContext which ff_thread_get_buffer() was last called on
void *thread_opaque #< used by multithreading to store frame-specific info
# ok libavcodec 52.113. 2
struct AVCodecContext:
void * av_class
int bit_rate
int bit_rate_tolerance
int flags
int sub_id
int me_method
uint8_t * extradata
int extradata_size
AVRational time_base
int width
int height
int gop_size
PixelFormat pix_fmt
int rate_emu
void * draw_horiz_band