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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
|
---
title: 网络视频编解码器指南
slug: Web/Media/Formats/Video_codecs
translation_of: Web/Media/Formats/Video_codecs
original_slug: Web/Media/Formats/视频编解码器
---
<div>{{QuickLinksWithSubpages("/en-US/docs/Web/Media")}}</div>
<p>未经压缩的视频的数据量太大了,我们有必要进行很多压缩处理来存储视频,就更不用说通过网络传输视频的时候了。想象一下我们需要多少数据来存储未经压缩的视频:</p>
<ul>
<li>全色彩的高清视频(1920x1080)每一帧为 8,294,400 字节。</li>
<li>按照典型的每秒30帧的传播速度,高清视频每秒钟会占用 248,832,000 字节(约 249 MB)。</li>
<li>一分钟的高清视频将需要 14.93 GB 的存储空间。</li>
<li>一个相当典型的30分钟视频会议将需要约 447.9 GB 的存储空间,而2小时的电影则需要<em>将近 1.79 <strong>TB</strong>(也就是 1790 GB)</em> 的存储空间。</li>
</ul>
<p>不仅仅是需要的存储空间很大的问题,以 249MB 每秒的速度传输这样的未压缩的视频所需要的网络带宽也很大(不包括音频和开销)。这就是为什么我们需要视频编解码器。就像音频编解码器对声音数据所做的处理一样,视频编解码器会压缩视频数据并将其编码为一种格式,以后我们可以对其进行解码,播放或者编辑。</p>
<p>大多数的视频编解码器是有损的(解码后的视频与原来的视频不完全匹配)。一些细节可能会丢失,丢失的数量取决于编解码器和它的配置方式。通常来说,压缩程度越高,细节丢失的越多,视频失真更严重。虽然现在也有一些无损编解码器,但是通常都是用于存档和存储在本地来进行本地回放的,而不是在网络上使用。</p>
<p><span class="seoSummary">本指南介绍了一些你可能遇到或者考虑去使用的网络视频编解码器的功能以及一些兼容性和实用性问题。并且帮助您为项目视频选择正确的编解码器提供一些建议。</span></p>
<h2 id="通用编解码器">通用编解码器</h2>
<p>以下视频编解码器是网上最常用的视频编解码器。每个编解码器都列出了它们可以支持的文件类型。每个编解码器都提供了一个指向下文相关部分详细内容的快捷链接,包含一些您可能需要了解的特定功能和兼容性问题。</p>
<table class="standard-table">
<thead>
<tr>
<th scope="row">编解码器名称 (简称)</th>
<th scope="col">编解码器全称</th>
<th scope="col">支持文件类型</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row"><a href="/en-US/docs/Web/Media/Formats/Video_codecs#AV1">AV1</a></th>
<td>AOMedia Video 1</td>
<td><a href="/en-US/docs/Web/Media/Formats/Containers#MP4">MP4</a>, <a href="/en-US/docs/Web/Media/Formats/Containers#WebM">WebM</a></td>
</tr>
<tr>
<th scope="row"><a href="/en-US/docs/Web/Media/Formats/Video_codecs#AVC_(H.264)">AVC (H.264)</a></th>
<td>Advanced Video Coding</td>
<td><a href="/en-US/docs/Web/Media/Formats/Containers#3GP">3GP</a>, <a href="/en-US/docs/Web/Media/Formats/Containers#MP4">MP4</a>, <a href="/en-US/docs/Web/Media/Formats/Containers#WebM">WebM</a></td>
</tr>
<tr>
<th scope="row"><a href="/en-US/docs/Web/Media/Formats/Video_codecs#H.263">H.263</a></th>
<td>H.263 Video</td>
<td><a href="/en-US/docs/Web/Media/Formats/Containers#3GP">3GP</a></td>
</tr>
<tr>
<th scope="row"><a href="#HEVC">HEVC (H.265)</a></th>
<td>High Efficiency Video Coding</td>
<td><a href="/en-US/docs/Web/Media/Formats/Containers#MP4">MP4</a></td>
</tr>
<tr>
<th scope="row">{{anch("MP4V-ES")}}</th>
<td>MPEG-4 Video Elemental Stream</td>
<td><a href="/en-US/docs/Web/Media/Formats/Containers#3GP">3GP</a>, <a href="/en-US/docs/Web/Media/Formats/Containers#MP4">MP4</a></td>
</tr>
<tr>
<th scope="row">{{anch("MPEG-1")}}</th>
<td>MPEG-1 Part 2 Visual</td>
<td><a href="/en-US/docs/Web/Media/Formats/Containers#MPEGMPEG-2">MPEG</a>, <a href="/en-US/docs/Web/Media/Formats/Containers#QuickTime">QuickTime</a></td>
</tr>
<tr>
<th scope="row">{{anch("MPEG-2")}}</th>
<td>MPEG-2 Part 2 Visual</td>
<td><a href="/en-US/docs/Web/Media/Formats/Containers#MP4">MP4</a>, <a href="/en-US/docs/Web/Media/Formats/Containers#MPEGMPEG-2">MPEG</a>, <a href="/en-US/docs/Web/Media/Formats/Containers#QuickTime">QuickTime</a></td>
</tr>
<tr>
<th scope="row"><a href="/en-US/docs/Web/Media/Formats/Video_codecs#Theora">Theora</a></th>
<td>Theora</td>
<td><a href="/en-US/docs/Web/Media/Formats/Containers#Ogg">Ogg</a></td>
</tr>
<tr>
<th scope="row"><a href="/en-US/docs/Web/Media/Formats/Video_codecs#VP8">VP8</a></th>
<td>Video Processor 8</td>
<td><a href="/en-US/docs/Web/Media/Formats/Containers#3GP">3GP</a>, <a href="/en-US/docs/Web/Media/Formats/Containers#Ogg">Ogg</a>, <a href="/en-US/docs/Web/Media/Formats/Containers#WebM">WebM</a></td>
</tr>
<tr>
<th scope="row"><a href="/en-US/docs/Web/Media/Formats/Video_codecs#VP9">VP9</a></th>
<td>Video Processor 9</td>
<td><a href="/en-US/docs/Web/Media/Formats/Containers#MP4">MP4</a>, <a href="/en-US/docs/Web/Media/Formats/Containers#Ogg">Ogg</a>, <a href="/en-US/docs/Web/Media/Formats/Containers#WebM">WebM</a></td>
</tr>
</tbody>
</table>
<h2 id="影响编码视频的因素">影响编码视频的因素</h2>
<p>和任何编码器一样,有两个会影响到编码视频大小和质量的因素:源视频的格式和内容,以及在对视频进行编码时候使用的编解码器的特性和配置。</p>
<p>最简单的原则是:如果要让编码视频看起来更像原始的未压缩过的视频,那么通常得到的视频会更大。因此我们始终要在尺寸和质量之间进行权衡。在某些情况下,我们会为了降低数据大小而接受质量的损失。但是其他时候,我们不能接受质量损失,所以我们必须接受会导致文件相应增大的编码器配置。</p>
<h3 id="源视频格式对编码输出的影响">源视频格式对编码输出的影响</h3>
<p>源视频格式影响编码输出的程度取决于编解码器及其工作方式。如果编解码器将视频媒体转换为内部像素的格式,或者使用使用简单像素以外的方法表示图像,那么原始图像的格式对编码输出没有什么影响。但是,诸如帧频和分辨率之类始终会对媒体视频的输出大小产生影响。</p>
<p>Additionally, all codecs have their strengths and weaknesses. Some have trouble with specific kinds of shapes and patterns, or aren't good at replicating sharp edges, or tend to lose detail in dark areas, or any number of possibilities. It all depends on the underlying algorithms and mathematics.</p>
<table class="standard-table">
<caption>The potential effect of source video format and contents on the encoded video quality and size</caption>
<thead>
<tr>
<th scope="row">Feature</th>
<th scope="col">对质量的影响</th>
<th scope="col">对尺寸的影响</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">Color depth (bit depth)</th>
<td>颜色位深越高,视频中颜色保真度质量就越高。除此之外,在图像饱和部分(颜色纯而强烈的,例如明亮纯红色[rgba(255,0,0,1)),低于每分量10色深(10bits色彩)允许条带化,其中,如果没有可见色阶跃就无法表示渐变。</td>
<td>Depending on the codec, higher color depths may result in larger compressed file sizes. The determining factor is what internal storage format is used for the compressed data.</td>
</tr>
<tr>
<th scope="row">Frame rate</th>
<td>Primarily affects the perceived smoothness of the motion in the image. To a point, the higher the frame rate, the smoother and more realistic the motion will appear. Eventually the point of diminishing returns is reached. See {{anch("Frame rate")}} below for details.</td>
<td>Assuming the frame rate is not reduced during encoding, higher frame rates cause larger compressed video sizes.</td>
</tr>
<tr>
<th scope="row">Motion</th>
<td>Compression of video typically works by comparing frames, finding where they differ, and constructing records containing enough information to update the previous frame to approximate the appearance of the following frame. The more successive frames differ from one another, the larger these differences are, and the less effective the compression is at avoiding the introduction of artifacts into the compressed video.</td>
<td>The complexity introduced by motion results in larger intermediate frames due to the higher number of differences between frames). For this and other reasons, the more motion there is in a video, the larger the output file will typically be.</td>
</tr>
<tr>
<th scope="row">Noise</th>
<td>Picture noise (such as film grain effects, dust, or other grittiness to the image) introduces variability. Variability generally makes compression more difficult, resulting in more lost quality due to the need to drop details to achieve the same level of compression.</td>
<td>The more variability—such as noise—there is in the image, the more complex the compression process and the less success the algorithm is likely to have compressing the image to the same degree. Unless you configure the encoder in a way that ignores some or all of the variations caused by noise, the compressed video will be larger.</td>
</tr>
<tr>
<th scope="row">Resolution (width and height)</th>
<td>Higher resolution video, presented in the same screen size, will typically be able to more accurately portray the original scene, barring effects introduced during compression.</td>
<td>The higher the resolution of a video, the larger it gets. This plays a key role in the final size of the video.</td>
</tr>
</tbody>
</table>
<p>The degree to which these affect the resulting encoded video will vary depending on the precise details of the situation, including which encoder you use and how it's configured. In addition to general codec options, the encoder could be configured to reduce the frame rate, to clean up noise, and/or to reduce the overall resolution of the video during encoding.</p>
<h3 id="Effect_of_codec_configuration_on_encoded_output">Effect of codec configuration on encoded output</h3>
<p>The algorithms used do encode video typically use one or more of a number of general techniques to perform their encoding. Generally speaking, any configuration option that is intended to reduce the output size of the video will probably have a negative impact on the overall quality of the video, or will introduce certain types of artifacts into the video. It's also possible to select a lossless form of encoding, which will result in a much larger encoded file but with perfect reproduction of the original video upon decoding.</p>
<p>In addition, each encoder utility may have variations in how they process the source video, resulting in differences in the output quality and/or size.</p>
<table class="standard-table">
<caption>Video encoder configuration effects on quality and size</caption>
<thead>
<tr>
<th scope="row">Feature</th>
<th scope="col">Effect on quality</th>
<th scope="col">Effect on size</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">Lossless compression</th>
<td>No loss of quality</td>
<td>Lossless compression cannot reduce the overall video size nearly as much as lossy compression; the resulting files are likely to still be too large for general usage.</td>
</tr>
<tr>
<th scope="row">Lossy compression</th>
<td>To some degree, artifacts and other forms of quality degradation wil occur, depending on the specific codec and how much compression is being applied</td>
<td>The more the encoded video is allowed to deviate from the source, the easier it is to accomplish higher compression rates</td>
</tr>
<tr>
<th scope="row">Quality setting</th>
<td>The higher the quality configuration, the more like the original media the encoded video will look</td>
<td>In general, higher quality settings will result in larger encoded video files; the degree to which this is true varies depending on the codec</td>
</tr>
<tr>
<th scope="row">Bit rate</th>
<td>Quality generally improves with higher bit rates</td>
<td>Higher bit rates inherently lead to larger output files</td>
</tr>
</tbody>
</table>
<p>The options available when encoding video, and the values to be assigned to those options, will vary not only from one codec to another but depending on the encoding software you use. The documentation included with your encoding software will help you to understand the specific impact of these options on the encoded video.</p>
<h2 id="Compression_artifacts">Compression artifacts</h2>
<p><strong>Artifacts</strong> are side effects of a lossy encoding process in which the lost or rearranged data results in visibly negative effects. Once an artifact has appeared, it may linger for a while, because of how video is displayed. Each frame of video is presented by applying a set of changes to the currently-visible frame. This means that any errors or artifacts will compound over time, resulting in glitches or otherwise strange or unexpected deviations in the image that linger for a time.</p>
<p>To resolve this, and to improve seek time through the video data, periodic <strong>key frames</strong> (also known as <strong>intra-frames</strong> or <strong>i-frames</strong>) are placed into the video file. The key frames are full frames, which are used to repair any damage or artifact residue that's currently visible.</p>
<h3 id="Aliasing">Aliasing</h3>
<p>Aliasing is a general term for anything that upon being reconstructed from the encoded data does not look the same as it did before compression. There are many forms of aliasing; the most common ones you may see include:</p>
<table class="standard-table">
<tbody>
<tr>
<td>
<h4 id="Moiré_patterns">Moiré patterns</h4>
<p>A <strong>{{interwiki("Moiré pattern")}}</strong> is a large-scale spatial interference pattern produced when a pattern in the source image and the manner in which the encoder operates are slightly out of alignment spatially. The artifacts generated by the encoder then introduce strange, swirling effects in the source image's pattern upon decoding.</p>
</td>
<td><a href="https://mdn.mozillademos.org/files/16680/moire-pattern.jpg"><img alt="" src="https://mdn.mozillademos.org/files/16680/moire-pattern.jpg" style="height: 250px; width: 205px;"></a></td>
</tr>
<tr>
<td>
<h4 id="Staircase_effect">Staircase effect</h4>
<p>The <strong>staircase effect</strong> is a spatial artifact that occurs when diagonal straight or curved edges that should be smooth take on a jagged appearance, looking somewhat like a set of stair steps. This is the effect that is being reduced by "anti-aliasing" filters.</p>
</td>
<td><a href="https://mdn.mozillademos.org/files/16681/staircase-effect.jpg"><img alt="" src="https://mdn.mozillademos.org/files/16681/staircase-effect.jpg" style="height: 250px; width: 206px;"></a></td>
</tr>
<tr>
<td>
<h4 id="Wagon-wheel_effect">Wagon-wheel effect</h4>
<p>The <strong>wagon-wheel effect</strong> (or <strong>{{interwiki("wikipedia", "stroboscopic effect")}}</strong>) is the visual effect that's commonly seen in film, in which a turning wheel appears to rotate at the wrong speed, or even in reverse, due to an interaction between the frame rate and the compression algorithm. The same effect can occur with any repeating pattern that moves, such as the ties on a railway line, posts along the side of a road, and so forth. This is a temporal (time-based) aliasing issue; the speed of the rotation interferes with the frequency of the sampling performed during compression or encoding.</p>
</td>
<td><a href="https://mdn.mozillademos.org/files/16682/stroboscopic-effect.gif"><img alt="" src="https://mdn.mozillademos.org/files/16682/stroboscopic-effect.gif"></a></td>
</tr>
</tbody>
</table>
<h3 id="Color_edging">Color edging</h3>
<p><strong>Color edging</strong> is a type of visual artifact that presents as spurious colors introduced along the edges of colored objects within the scene. These colors have no intentional color relationship to the contents of the frame.</p>
<h3 id="Loss_of_sharpness"> Loss of sharpness</h3>
<p>The act of removing data in the process of encoding video requires that some details be lost. If enough compression is applied, parts or potentially all of the image could lose sharpness, resulting in a slightly fuzzy or hazy appearance.</p>
<p>Lost sharpness can make text in the image difficult to read, as text—especially small text—is very detail-oriented content, where minor alterations can significantly impact legibility.</p>
<h3 id="Ringing">Ringing</h3>
<p>Lossy compression algorithms can introduce <strong>{{interwiki("wikipedia", "ringing artifacts", "ringing")}}</strong>, an effect where areas outside an object are contaminated with colored pixels generated by the compression algorithm. This happens when an algorithm that uses blocks that span across a sharp boundary between an object and its background. This is particularly common at higher compression levels.</p>
<p><a href="https://mdn.mozillademos.org/files/16684/Ringing-effects.png"><img alt="Example of the ringing effect" src="https://mdn.mozillademos.org/files/16684/Ringing-effects.png" style="height: 368px; width: 350px;"></a></p>
<p>Note the blue and pink fringes around the edges of the star above (as well as the stepping and other significant compression artifacts). Those fringes are the ringing effect. Ringing is similar in some respects to {{anch("Mosquito noise", "mosquito noise")}}, except that while the ringing effect is more or less steady and unchanging, mosquito noise shimmers and moves.</p>
<p>RInging is another type of artifact that can make it particularly difficult to read text contained in your images.</p>
<h3 id="Posterizing">Posterizing</h3>
<p><strong>Posterization</strong> occurs when the compression results in the loss of color detail in gradients. Instead of smooth transitions through the various colors in a region, the image becomes blocky, with blobs of color that approximate the original appearance of the image.</p>
<p><a href="https://mdn.mozillademos.org/files/16686/posterize-effect.jpg"><img alt="" src="https://mdn.mozillademos.org/files/16686/posterize-effect.jpg" style="height: 440px; width: 400px;"></a></p>
<p>Note the blockiness of the colors in the plumage of the bald eagle in the photo above (and the snowy owl in the background). The details of the feathers is largely lost due to these posterization artifacts.</p>
<h3 id="Contouring">Contouring</h3>
<p><strong>Contouring</strong> or <strong>color banding</strong> is a specific form of posterization in which the color blocks form bands or stripes in the image. This occurs when the video is encoded with too coarse a quantization configuration. As a result, the video's contents show a "layered" look, where instead of smooth gradients and transitions, the transitions from color to color are abrupt, causing strips of color to appear.</p>
<p><a href="https://mdn.mozillademos.org/files/16685/contouring-effect.jpg"><img alt="Example of an image whose compression has introduced contouring" src="https://mdn.mozillademos.org/files/16685/contouring-effect.jpg" style="height: 300px; width: 400px;"></a></p>
<p>In the example image above, note how the sky has bands of different shades of blue, instead of being a consistent gradient as the sky color changes toward the horizon. This is the contouring effect.</p>
<h3 id="Mosquito_noise">Mosquito noise</h3>
<p><strong>Mosquito noise</strong> is a temporal artifact which presents as noise or <strong>edge busyness</strong> that appears as a flickering haziness or shimmering that roughly follows outside the edges of objects with hard edges or sharp transitions between foreground objects and the background. The effect can be similar in appearance to {{anch("Ringing", "ringing")}}.</p>
<p><img alt="" src="https://mdn.mozillademos.org/files/16687/mosquito-effect-sm.png" style="height: 393px; width: 400px;"></p>
<p>The photo above shows mosquito noise in a number of places, including in the sky surrounding the bridge. In the upper-right corner, an inset shows a close-up of a portion of the image that exhibits mosquito noise.</p>
<p>Mosquito noise artifacts are most commonly found in MPEG video, but can occur whenever a discrete cosine transform (DCT) algorithm is used; this includes, for example, JPEG still images.</p>
<h3 id="Motion_compensation_block_boundary_artifacts">Motion compensation block boundary artifacts</h3>
<p>Compression of video generally works by comparing two frames and recording the differences between them, one frame after another, until the end of the video. This technique works well when the camera is fixed in place, or the objects in the frame are relatively stationary, but if there is a great deal of motion in the frame, the number of differences between frames can be so great that compression doesn't do any good.</p>
<p><strong>{{interwiki("wikipedia", "Motion compensation")}}</strong> is a technique that looks for motion (either of the camera or of objects in the frame of view) and determines how many pixels the moving object has moved in each direction. Then that shift is stored, along with a description of the pixels that have moved that can't be described just by that shift. In essence, the encoder finds the moving objects, then builds an internal frame of sorts that looks like the original but with all the objects translated to their new locations. In theory, this approximates the new frame's appearance. Then, to finish the job, the remaining differences are found, then the set of object shifts and the set of pixel differences are stored in the data representing the new frame. This object that describes the shift and the pixel differences is called a <strong>residual frame</strong>.</p>
<table class="standard-table">
<thead>
<tr>
<th scope="col" style="width: 216px;">Original frame</th>
<th scope="col" style="width: 216px;">Inter-frame differences</th>
<th scope="col" style="width: 216px;">Difference after motion compensation</th>
</tr>
</thead>
<tbody>
<tr>
<td><img alt="Original frame of video" src="https://mdn.mozillademos.org/files/16688/motion-comp-orig.jpg" style="height: 102px; width: 182px;"></td>
<td><img alt="" src="https://mdn.mozillademos.org/files/16689/motion-comp-diff.jpg" style="height: 102px; width: 182px;"></td>
<td><img alt="Differences between the frames after shifting two pixels right" src="https://mdn.mozillademos.org/files/16690/motion-comp-compensated.jpg" style="height: 102px; width: 182px;"></td>
</tr>
<tr>
<td style="vertical-align: top;">The first full frame as seen by the viewer.</td>
<td style="vertical-align: top;">Here, only the differences between the first frame and the following frame are seen. Everything else is black. Looking closely, we can see that the majority of these differences come from a horizontal camera move, making this a good candidate for motion compensation.</td>
<td style="vertical-align: top;">To minimize the number of pixels that are different, here we take into account the panning of the camera by first shifting the first frame to the right by two pixels, then by taking the difference. This compensates for the panning of the camera, allowing for more overlap between the two frames.</td>
</tr>
<tr>
<th colspan="3" style="font: italic 0.9em Arial, x-locale-body, sans-serif; vertical-align: middle;">Images from <a href="https://en.wikipedia.org/wiki/Motion_compensation#Illustrated_example">Wikipedia</a></th>
</tr>
</tbody>
</table>
<p>There are two general types of motion compensation: <strong>global motion compensation</strong> and <strong>block motion compensation</strong>. Global motion compensation generally adjusts for camera movements such as tracking, dolly movements, panning, tilting, rolling, and up and down movements. Block motion compensation handles localized changes, looking for smaller sections of the image that can be encoded using motion compensation. These blocks are normally of a fixed size, in a grid, but there are forms of motion compensation that allow for variable block sizes, and even for blocks to overlap.</p>
<p>There are, however, artifacts that can occur due to motion compensation. These occur along block borders, in the form of sharp edges that produce false ringing and other edge effects. These are due to the mathematics involved in the coding of the residual frames, and can be easily noticed before being repaired by the next key frame.</p>
<h3 id="Reduced_frame_size">Reduced frame size</h3>
<p>In certain situations, it may be useful to reduce the video's dimensions in order to improve the final size of the video file. While the immediate loss of size or smoothness of playback may be a negative factor, careful decision-making can result in a good end result. If a 1080p video is reduced to 720p prior to encoding, the resulting video can be much smaller while having much higher visual quality; even after scaling back up during playback, the result may be better than encoding the original video at full size and accepting the quality hit needed to meet your size requirements.</p>
<h3 id="Reduced_frame_rate">Reduced frame rate</h3>
<p>Similarly, you can remove frames from the video entirely and decrease the frame rate to compensate. This has two benefits: it makes the overall video smaller, and that smaller size allows motion compensation to accomplish even more for you. For exmaple, instead of computing motion differences for two frames that are two pixels apart due to inter-frame motion, skipping every other frame could lead to computing a difference that comes out to four pixels of movement. This lets the overall movement of the camera be represented by fewer residual frames.</p>
<p>The absolute minimum frame rate that a video can be before its contents are no longer perceived as motion by the human eye is about 12 frames per second. Less than that, and the video becomes a series of still images. Motion picture film is typically 24 frames per second, while standard definition television is about 30 frames per second (slightly less, but close enough) and high definition television is between 24 and 60 frames per second. Anything from 24 FPS upward will generally be seen as satisfactorily smooth; 30 or 60 FPS is an ideal target, depending on your needs.</p>
<p>In the end, the decisions about what sacrifices you're able to make are entirely up to you and/or your design team.</p>
<h2 id="Codec_details">Codec details</h2>
<h3 id="AV1">AV1</h3>
<p>The <strong>AOMedia Video 1</strong> (<strong>AV1</strong>) codec is an open format designed by the <a href="https://aomedia.org/">Alliance for Open Media</a> specifically for internet video. It achieves higher data compression rates than {{anch("VP9")}} and {{anch("HEVC", "H.265/HEVC")}}, and as much as 50% higher rates than <a href="/en-US/docs/Web/Media/Formats/Video_codecs#AVC_(H.264)">AVC</a>. AV1 is fully royalty-free and is designed for use by both the {{HTMLElement("video")}} element and by <a href="/en-US/docs/Web/API/WebRTC_API">WebRTC</a>.</p>
<p>AV1 currently offers three profiles: <strong>main</strong>, <strong>high</strong>, and <strong>professional</strong> with increasing support for color depths and chroma subsampling. In addition, a series of <strong>levels</strong> are specified, each defining limits on a range of attributes of the video. These attributes include frame dimensions, image area in pixels, display and decode rates, average and maximum bit rates, and limits on the number of tiles and tile columns used in the encoding/decoding process.</p>
<p>For example, level AV1 level 2.0 offers a maximum frame width of 2048 pixels and a maximum height of 1152 pixels, but its maximum frame size in pixels is 147,456, so you can't actually have a 2048x1152 video at level 2.0. It's worth noting, however, that at least for Firefox and Chrome, the levels are actually ignored at this time when performing software decoding, and the decoder just does the best it can to play the video given the settings provided. For compatibility's sake going forward, however, you should stay within the limits of the level you choose.</p>
<p>The primary drawback to AV1 at this time is that it is very new, and support is still in the process of being integrated into most browsers. Additionally, encoders and decoders are still being optimized for performance, and hardware encoders and decoders are still mostly in development rather than production. For this reason, encoding a video into AV1 format takes a very long time, since all the work is done in software.</p>
<p>For the time being, because of these factors, AV1 is not yet ready to be your first choice of video codec, but you should watch for it to be ready to use in the future.</p>
<table class="standard-table">
<tbody>
<tr>
<th scope="row">Supported bit rates</th>
<td>Varies depending on the video's level; theoretical maximum reaches 800 Mbps at level 6.3<sup><a href="#av1-foot-2">[2]</a></sup></td>
</tr>
<tr>
<th scope="row">Supported frame rates</th>
<td>Varies by level; for example, level 2.0 has a maximum of 30 FPS while level 6.3 can reach 120 FPS</td>
</tr>
<tr>
<th scope="row">Compression</th>
<td>Lossy <a href="https://en.wikipedia.org/wiki/Discrete_cosine_transform">DCT-based algorithm</a></td>
</tr>
<tr>
<th scope="row">Supported frame sizes</th>
<td>8 x 8 pixels to 65,535 x 65535 pixels with each dimension allowed to take any value between these</td>
</tr>
<tr>
<th scope="row">Supported color modes</th>
<td>
<table class="standard-table">
<thead>
<tr>
<th scope="row">Profile</th>
<th scope="col">Color depths</th>
<th scope="col">Chroma subsampling</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">Main</th>
<td>8 or 10</td>
<td>4:0:0 (greyscale) or 4:2:0</td>
</tr>
<tr>
<th scope="row">High</th>
<td>8 or 10</td>
<td>4:0:0 (greyscale), 4:2:0, or 4:4:4</td>
</tr>
<tr>
<th scope="row">Professional</th>
<td>8, 10, or 12</td>
<td>4:0:0 (greyscale), 4:2:0, 4:2:2, or 4:4:4</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<th scope="row">HDR support</th>
<td>Yes</td>
</tr>
<tr>
<th scope="row">Variable Frame Rate (VFR) support</th>
<td>Yes</td>
</tr>
<tr>
<th scope="row">Browser compatibility</th>
<td>
<table class="standard-table">
<tbody>
<tr>
<th scope="row">Feature</th>
<th scope="col">Chrome</th>
<th scope="col">Edge</th>
<th scope="col">Firefox</th>
<th scope="col">Internet Explorer</th>
<th scope="col">Opera</th>
<th scope="col">Safari</th>
</tr>
<tr>
<th scope="row">AV1 support</th>
<td>70</td>
<td>75</td>
<td>67</td>
<td>No</td>
<td>57</td>
<td>No</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<th scope="row">Container support</th>
<td>ISOBMFF<sup><a href="#av1-foot-1">[1]</a></sup>, MPEG-TS, <a href="/en-US/docs/Web/Media/Formats/Containers#MP4">MP4</a>, <a href="/en-US/docs/Web/Media/Formats/Containers#WebM">WebM</a></td>
</tr>
<tr>
<th scope="row">{{Glossary("RTP")}} / <a href="/en-US/docs/Web/API/WebRTC_API">WebRTC</a> compatible</th>
<td>Yes</td>
</tr>
<tr>
<th scope="row">Supporting/Maintaining organization</th>
<td><a href="https://aomedia.org/">Alliance for Open Media</a></td>
</tr>
<tr>
<th scope="row">Specification</th>
<td><a href="https://aomediacodec.github.io/av1-spec/av1-spec.pdf">https://aomediacodec.github.io/av1-spec/av1-spec.pdf</a></td>
</tr>
<tr>
<th scope="row">Licensing</th>
<td>Royalty-free, open standard</td>
</tr>
</tbody>
</table>
<p><a id="av1-foot-1" name="av1-foot-1">[1]</a> {{interwiki("wikipedia", "ISO Base Media File Format")}}</p>
<p><a name="av1-foot-2">[2]</a> See the AV1 specification's <a href="https://aomediacodec.github.io/av1-spec/#levels">tables of levels</a>, which describe the maximum resolutions and rates at each level.</p>
<h3 id="AVC_H.264"><a name="AVC">AVC</a> (H.264)</h3>
<p>The MPEG-4 specification suite's <strong>Advanced Video Coding</strong> (<strong>AVC</strong>) standard is specified by the identical ITU H.264 specification and the MPEG-4 Part 10 specification. It's a motion compensation based codec that is widely used today for all sorts of media, including broadcast television, {{Glossary("RTP")}} videoconferencing, and as the video codec for Blu-Ray discs.</p>
<p>AVC is highly flexible, with a number of profiles with varying capabilities; for example, the Constrained Baseline Profile is designed for use in videoconferencing and mobile scenarios, using less bandwidth than the Main Profile (which is used for standard definition digital TV in some regions) or the High Profile (used for Blu-Ray Disc video). Most of the profiles use 8-bit color components and 4:2:0 chroma subsampling; The High 10 Profile adds support for 10-bit color, and advanced forms of High 10 add 4:2:2 and 4:4:4 chroma subsampling.</p>
<p>AVC also has special features such as support for multiple views of the same scene (Multiview Video Coding), which allows, among other things, the production of stereoscopic video.</p>
<p>AVC is a proprietary format, however, and numerous patents are owned by multiple parties regarding its technologies. Commercial use of AVC media requires a license, though the MPEG LA patent pool does not require license fees for streaming internet video in AVC format as long as the video is free for end users.</p>
<p>Non-web browser implementations of WebRTC (any implementation which doesn't include the JavaScript APIs) are <em>required</em> to support AVC as a codec in WebRTC calls. While web browsers are not required to do so, some do.</p>
<p>In HTML content for web browsers, AVC is broadly compatible and many platforms support hardware encoding and decoding of AVC media. However, be aware of its <a href="https://www.mpegla.com/programs/avc-h-264/">licensing requirements</a> before choosing to use AVC in your project!</p>
<table class="standard-table">
<tbody>
<tr>
<th scope="row">Supported bit rates</th>
<td>Varies by level</td>
</tr>
<tr>
<th scope="row">Supported frame rates</th>
<td>Varies by level; up to 300 FPS is possible</td>
</tr>
<tr>
<th scope="row">Compression</th>
<td>Lossy <a href="https://en.wikipedia.org/wiki/Discrete_cosine_transform">DCT-based algorithm</a>, though it's possible to create lossless macroblocks within the image</td>
</tr>
<tr>
<th scope="row">Supported frame sizes</th>
<td>Up to 8,192 x 4,320 pixels</td>
</tr>
<tr>
<th scope="row">Supported color modes</th>
<td>
<p>Some of the more common or interesting profiles:</p>
<table class="standard-table">
<tbody>
<tr>
<th scope="row">Profile</th>
<th scope="col">Color depths</th>
<th scope="col">Chroma subsampling</th>
</tr>
<tr>
<td>Constrained Baseline (CBP)</td>
<td>8</td>
<td>4:2:0</td>
</tr>
<tr>
<td>Baseline (BP)</td>
<td>8</td>
<td>4:2:0</td>
</tr>
<tr>
<td>Extended (XP)</td>
<td>8</td>
<td>4:2:0</td>
</tr>
<tr>
<td>Main (MP)</td>
<td>8</td>
<td>4:2:0</td>
</tr>
<tr>
<td>High (HiP)</td>
<td>8</td>
<td>4:0:0 (greyscale) and 4:2:0</td>
</tr>
<tr>
<td>Progressive High (ProHiP)</td>
<td>8</td>
<td>4:0:0 (greyscale) and 4:2:0</td>
</tr>
<tr>
<td>High 10 (Hi10P)</td>
<td>8 to 10</td>
<td>4:0:0 (greyscale) and 4:2:0</td>
</tr>
<tr>
<td>High 4:2:2 (Hi422P)</td>
<td>8 to 10</td>
<td>4:0:0 (greyscale), 4:2:0, and 4:2:2</td>
</tr>
<tr>
<td>High 4:4:4 Predictive</td>
<td>8 to 14</td>
<td>4:0:0 (greyscale), 4:2:0, 4:2:2, and 4:4:4</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<th scope="row">HDR support</th>
<td>Yes; {{interwiki("wikipedia", "Hybrid Log-Gamma")}} or Advanced HDR/SL-HDR; both are part of ATSC</td>
</tr>
<tr>
<th scope="row">Variable Frame Rate (VFR) support</th>
<td>Yes</td>
</tr>
<tr>
<th scope="row">Browser compatibility</th>
<td>
<table class="standard-table">
<tbody>
<tr>
<th scope="row">Feature</th>
<th scope="col">Chrome</th>
<th scope="col">Edge</th>
<th scope="col">Firefox</th>
<th scope="col">Internet Explorer</th>
<th scope="col">Opera</th>
<th scope="col">Safari</th>
</tr>
<tr>
<th scope="row">AVC/H.265 support</th>
<td>4</td>
<td>12</td>
<td>35<sup><a href="#avc-foot-1">[1]</a></sup></td>
<td>9</td>
<td>25</td>
<td>3.2</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<th scope="row">Container support</th>
<td><a href="/en-US/docs/Web/Media/Formats/Containers#3GP">3GP</a>, <a href="/en-US/docs/Web/Media/Formats/Containers#MP4">MP4</a>, <a href="/en-US/docs/Web/Media/Formats/Containers#WebM">WebM</a></td>
</tr>
<tr>
<th scope="row">{{Glossary("RTP")}} / <a href="/en-US/docs/Web/API/WebRTC_API">WebRTC</a> compatible</th>
<td>Yes</td>
</tr>
<tr>
<th scope="row">Supporting/Maintaining organization</th>
<td><a href="https://mpeg.chiariglione.org/">MPEG</a> / <a href="https://www.itu.int/">ITU</a></td>
</tr>
<tr>
<th scope="row">Specification</th>
<td><a href="https://mpeg.chiariglione.org/standards/mpeg-4/advanced-video-coding">https://mpeg.chiariglione.org/standards/mpeg-4/advanced-video-coding</a><br>
<a href="https://www.itu.int/rec/T-REC-H.264">https://www.itu.int/rec/T-REC-H.264</a></td>
</tr>
<tr>
<th scope="row">Licensing</th>
<td>Proprietary with numerous patents. Commercial use <a href="https://www.mpegla.com/programs/avc-h-264/">requires a license</a>. Note that multiple patent pools may apply.</td>
</tr>
</tbody>
</table>
<p><a id="avc-foot-1" name="avc-foot-1">[1]</a> Firefox support for AVC is dependent upon the operating system's built-in or preinstalled codecs for AVC and its container in order to avoid patent concerns.</p>
<h3 id="H.263">H.263</h3>
<p>ITU's <strong>H.263</strong> codec was designed primarily for use in low-bandwidth situations. In particular, its focus is for video conferencing on PSTN (Public Switched Telephone Networks), {{Glossary("RTSP")}}, and SIP (IP-based videoconferencing) systems. Despite being optimized for low-bandwidth networks, it is fairly CPU intensive and may not perform adequately on lower-end computers. The data format is similar to that of MPEG-4 Part 2.</p>
<p>H.263 has never been widely used on the web. Variations on H.263 have been used as the basis for other proprietary formats, such as Flash video or the Sorenson codec. However, no major browser has ever included H.263 support by default. Certain media plugins have enabled support for H.263 media.</p>
<p>Unlike most codecs, H.263 defines fundamentals of an encoded video in terms of the maximum bit rate per frame (picture), or <strong>BPPmaxKb</strong>. During encoding, a value is selected for BPPmaxKb, and then the video cannot exceed this value for each frame. The final bit rate will depend on this, the frame rate, the compression, and the chosen resolution and block format.</p>
<p>H.263 has been superseded by H.264 and is therefore considered a legacy media format which you generally should avoid using if you can. The only real reason to use H.263 in new projects is if you require support on very old devices on which H.263 is your best choice.</p>
<p>H.263 is a proprietary format, with <a href="https://www.itu.int/ITU-T/recommendations/related_ps.aspx?id_prod=4242">patents</a> held by a number of organizations and companies, including Telenor, Fujitsu, Motorola, Samsung, Hitachi, Polycom, Qualcomm, and so on. To use H.263, you are legally obligated to obtain the appropriate licenses.</p>
<table class="standard-table">
<tbody>
<tr>
<th scope="row">Supported bit rates</th>
<td>Unrestricted, but typically below 64 Kbps</td>
</tr>
<tr>
<th scope="row">Supported frame rates</th>
<td>Any</td>
</tr>
<tr>
<th scope="row">Compression</th>
<td>Lossy <a href="https://en.wikipedia.org/wiki/Discrete_cosine_transform">DCT-based algorithm</a></td>
</tr>
<tr>
<th scope="row">Supported frame sizes</th>
<td>Up to 1408 x 1152 pixels<sup><a href="#h263-foot-2">[2]</a></sup></td>
</tr>
<tr>
<th scope="row">Supported color modes</th>
<td>YCbCr; each picture format (sub-QCIF, QCIF, CIF, 4CIF, or 16CIF) defines the frame size in pixels as well as how many rows each of luminance and chrominance samples are used for each frame</td>
</tr>
<tr>
<th scope="row">HDR support</th>
<td>No</td>
</tr>
<tr>
<th scope="row">Variable Frame Rate (VFR) support</th>
<td>No</td>
</tr>
<tr>
<th scope="row">Browser compatibility</th>
<td>
<table class="standard-table">
<tbody>
<tr>
<th scope="row">Feature</th>
<th scope="col">Chrome</th>
<th scope="col">Edge</th>
<th scope="col">Firefox</th>
<th scope="col">Internet Explorer</th>
<th scope="col">Opera</th>
<th scope="col">Safari</th>
</tr>
<tr>
<th scope="row">H.263 support</th>
<td>No</td>
<td>No</td>
<td>No<sup><a href="#h263-foot-1">[1]</a></sup></td>
<td>No</td>
<td>No</td>
<td>No</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<th scope="row">Container support</th>
<td><a href="/en-US/docs/Web/Media/Formats/Containers#3GP">3GP</a>, <a href="/en-US/docs/Web/Media/Formats/Containers#MP4">MP4</a>, <a href="/en-US/docs/Web/Media/Formats/Containers#QuickTime">QuickTime</a></td>
</tr>
<tr>
<th scope="row">{{Glossary("RTP")}} / <a href="/en-US/docs/Web/API/WebRTC_API">WebRTC</a> compatible</th>
<td>No</td>
</tr>
<tr>
<th scope="row">Supporting/Maintaining organization</th>
<td><a href="https://www.itu.net/">ITU</a></td>
</tr>
<tr>
<th scope="row">Specification</th>
<td><a href="https://www.itu.int/rec/T-REC-H.263/">https://www.itu.int/rec/T-REC-H.263/</a></td>
</tr>
<tr>
<th scope="row">Licensing</th>
<td>Proprietary; appropriate license or licenses are required. Note that multiple patent pools may apply.</td>
</tr>
</tbody>
</table>
<p><a id="h263-foot-1" name="h263-foot-1">[1]</a> While Firefox does not generally support H.263, the OpenMax platform implementation (used for the Boot to Gecko project upon which Firefox OS was based) did support H.263 in 3GP files.</p>
<p><a id="h263-foot-2" name="h263-foot-2">[2]</a> Version 1 of H.263 specifies a set of picture sizes which are supported. Later versions may support additional resolutions.</p>
<h3 id="HEVC_H.265"><a id="HEVC" name="HEVC">HEVC</a> (H.265)</h3>
<p>The <strong><a href="http://hevc.info/">High Efficiency Video Coding</a></strong> (<strong>HVEC</strong>) codec is defined by ITU's <strong>H.265</strong> as well as by MPEG-H Part 2 (the still in-development follow-up to MPEG-4). HEVC was designed to support efficient encoding and decoding of video in sizes including very high resolutions (including 8K video), with a structure specifically designed to let software take advantage of modern processors. Theoretically, HEVC can achieve compressed file sizes half that of {{anch("AVC")}} but with comparable image quality.</p>
<p>For example, each coding tree unit (CTU)—similar to the macroblock used in previous codecs—consists of a tree of luma values for each sample as well as a tree of chroma values for each chroma sample used in the same coding tree unit, as well as any required syntax elements. This structure supports easy processing by multiple cores.</p>
<p>An interesting feature of HEVC is that the main profile supports only 8 bit per component color with 4:2:0 chroma subsampling. Also interesting is that 4:4:4 video is handled specially. Instead of having the luma samples (representing the image's pixels in grayscale) and the Cb and Cr samples (indicating how to alter the grays to create color pixels), the three channels are instead treated as three monochrome images, one for each color, which are then combined during rendering to produce a full-color image.</p>
<p>HEVC is a proprietary format and is covered by a number of patents. Licensing is <a href="https://www.mpegla.com/programs/hevc/">managed by MPEG LA</a>; fees are charged to developers rather than to content producers and distributors. Be sure to review the latest license terms and requirements before making a decision on whether or not to use HEVC in your app or web site!</p>
<table class="standard-table">
<tbody>
<tr>
<th scope="row">Supported bit rates</th>
<td>Up to 800,000 Kbps</td>
</tr>
<tr>
<th scope="row">Supported frame rates</th>
<td>Varies by level; up to 300 FPS is possible</td>
</tr>
<tr>
<th scope="row">Compression</th>
<td>Lossy <a href="https://en.wikipedia.org/wiki/Discrete_cosine_transform">DCT-based algorithm</a></td>
</tr>
<tr>
<th scope="row">Supported frame sizes</th>
<td>128 x 96 to 8,192 x 4,320 pixels; varies by profile and level</td>
</tr>
<tr>
<th scope="row">Supported color modes</th>
<td>
<p>Information below is provided for the major profiles. There are a number of other profiles available that are not included here.</p>
<table class="standard-table">
<thead>
<tr>
<th scope="col">Profile</th>
<th scope="col">Color depths</th>
<th scope="col">Chroma subsampling</th>
</tr>
</thead>
<tbody>
<tr>
<td>Main</td>
<td>8</td>
<td>4:2:0</td>
</tr>
<tr>
<td>Main 10</td>
<td>8 to 10</td>
<td>4:2:0</td>
</tr>
<tr>
<td>Main 12</td>
<td>8 to 12</td>
<td>4:0:0 and 4:2:0</td>
</tr>
<tr>
<td>Main 4:2:2 10</td>
<td>8 to 10</td>
<td>4:0:0, 4:2:0, and 4:2:2</td>
</tr>
<tr>
<td>Main 4:2:2 12</td>
<td>8 to 12</td>
<td>4:0:0, 4:2:0, and 4:2:2</td>
</tr>
<tr>
<td>Main 4:4:4</td>
<td>8</td>
<td>4:0:0, 4:2:0, 4:2:2, and 4:4:4</td>
</tr>
<tr>
<td>Main 4:4:4 10</td>
<td>8 to 10</td>
<td>4:0:0, 4:2:0, 4:2:2, and 4:4:4</td>
</tr>
<tr>
<td>Main 4:4:4 12</td>
<td>8 to 12</td>
<td>4:0:0, 4:2:0, 4:2:2, and 4:4:4</td>
</tr>
<tr>
<td>Main 4:4:4 16 Intra</td>
<td>8 to 16</td>
<td>4:0:0, 4:2:0, 4:2:2, and 4:4:4</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<th scope="row">HDR support</th>
<td>Yes</td>
</tr>
<tr>
<th scope="row">Variable Frame Rate (VFR) support</th>
<td>Yes</td>
</tr>
<tr>
<th scope="row">Browser compatibility</th>
<td>
<table class="standard-table">
<tbody>
<tr>
<th scope="row">Feature</th>
<th scope="col">Chrome</th>
<th scope="col">Edge</th>
<th scope="col">Firefox</th>
<th scope="col">Internet Explorer</th>
<th scope="col">Opera</th>
<th scope="col">Safari</th>
</tr>
<tr>
<th scope="row">HEVC / H.265 support</th>
<td>No</td>
<td>18<sup><a href="#hevc-foot--1">[1]</a></sup></td>
<td>No<sup><a href="#hevc-foot-2">[2]</a></sup></td>
<td>11<sup><a href="#hevc-foot--1">[1]</a></sup></td>
<td>No</td>
<td>11</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<th scope="row">Container support</th>
<td><a href="/en-US/docs/Web/Media/Formats/Containers#MP4">MP4</a></td>
</tr>
<tr>
<th scope="row">{{Glossary("RTP")}} / <a href="/en-US/docs/Web/API/WebRTC_API">WebRTC</a> compatible</th>
<td>No</td>
</tr>
<tr>
<th scope="row">Supporting/Maintaining organization</th>
<td><a href="https://www.itu.net/">ITU</a> / <a href="https://mpeg.chiariglione.org/">MPEG</a></td>
</tr>
<tr>
<th scope="row">Specifications</th>
<td><a href="http://www.itu.int/rec/T-REC-H.265">http://www.itu.int/rec/T-REC-H.265</a><br>
<a href="https://www.iso.org/standard/69668.html">https://www.iso.org/standard/69668.html</a></td>
</tr>
<tr>
<th scope="row">Licensing</th>
<td>Proprietary; confirm your compliance with the <a href="https://www.mpegla.com/programs/hevc/">licensing requirements</a>. Note that multiple patent pools may apply.</td>
</tr>
</tbody>
</table>
<p><a id="hevc-foot--1" name="hevc-foot--1">[1]</a> Internet Explorer and Edge only supports HEVC on devices with a hardware codec.</p>
<p><a id="hevc-foot-2" name="hevc-foot-2">[2]</a> Mozilla will not support HEVC while it is encumbered by patents.</p>
<h3 id="MP4V-ES">MP4V-ES</h3>
<p>The <strong>MPEG-4 Video Elemental Stream</strong> (<strong>MP4V-ES</strong>) format is part of the MPEG-4 Part 2 Visual standard. While in general, MPEG-4 part 2 video is not used by anyone because of its lack of compelling value related to other codecs, MP4V-ES does have some usage on mobile. MP4V is essentially H.263 encoding in an MPEG-4 container.</p>
<p>Its primary purpose is to be used to stream MPEG-4 audio and video over an {{Glossary("RTP")}} session. However, MP4V-ES is also used to transmit MPEG-4 audio and video over a mobile connection using <a href="/en-US/docs/Web/Media/Formats/Containers#3GP">3GP</a>.</p>
<p>You almost certainly don't want to use this format, since it isn't supported in a meaningful way by any major browsers, and is quite obsolete. Files of this type should have the extension <code>.mp4v</code>, but sometimes are inaccurately labeled <code>.mp4</code>.</p>
<table class="standard-table">
<tbody>
<tr>
<th scope="row">Supported bit rates</th>
<td>5 Kbps to 1 Gbps and more</td>
</tr>
<tr>
<th scope="row">Supported frame rates</th>
<td>No specific limit; restricted only by the data rate</td>
</tr>
<tr>
<th scope="row">Compression</th>
<td>Lossy <a href="https://en.wikipedia.org/wiki/Discrete_cosine_transform">DCT-based algorithm</a></td>
</tr>
<tr>
<th scope="row">Supported frame sizes</th>
<td>Up to 4,096 x 4,096 pixels</td>
</tr>
<tr>
<th scope="row">Supported color modes</th>
<td>YCrCb with chroma subsampling (4:2:0, 4:2:2, and 4:4:4) supported; up to 12 bits per component</td>
</tr>
<tr>
<th scope="row">HDR support</th>
<td>No</td>
</tr>
<tr>
<th scope="row">Variable Frame Rate (VFR) support</th>
<td>Yes</td>
</tr>
<tr>
<th scope="row">Browser compatibility</th>
<td>
<table class="standard-table">
<tbody>
<tr>
<th scope="row">Feature</th>
<th scope="col">Chrome</th>
<th scope="col">Edge</th>
<th scope="col">Firefox</th>
<th scope="col">Internet Explorer</th>
<th scope="col">Opera</th>
<th scope="col">Safari</th>
</tr>
<tr>
<th scope="row">MP4V-ES support</th>
<td>No<sup><a href="#mp4ves-foot-2">[2]</a></sup></td>
<td>No</td>
<td>Yes<sup><a href="#mp4ves-foot-1">[1]</a></sup></td>
<td>No</td>
<td>No</td>
<td>No</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<th scope="row">Container support</th>
<td><a href="/en-US/docs/Web/Media/Formats/Containers#3GP">3GP</a>, <a href="/en-US/docs/Web/Media/Formats/Containers#MP4">MP4</a></td>
</tr>
<tr>
<th scope="row">{{Glossary("RTP")}} / <a href="/en-US/docs/Web/API/WebRTC_API">WebRTC</a> compatible</th>
<td>No</td>
</tr>
<tr>
<th scope="row">Supporting/Maintaining organization</th>
<td><a href="https://mpeg.chiariglione.org/">MPEG</a></td>
</tr>
<tr>
<th scope="row">Specification</th>
<td>{{RFC(6416)}}</td>
</tr>
<tr>
<th scope="row">Licensing</th>
<td>Proprietary; <a href="https://www.mpegla.com/programs/mpeg-4-visual/">obtain a license</a> through <a href="https://www.mpegla.com/">MPEG LA</a> and/or <a href="https://about.att.com/innovation/ip/patents/mpeg-4">AT&T</a> as needed</td>
</tr>
</tbody>
</table>
<p><a id="mp4ves-foot-1" name="mp4ves-foot-1">[1]</a> Firefox supports MP4V-ES in <a href="/en-US/docs/Web/Media/Formats/Containers#3GP">3GP</a> containers only.</p>
<p><a name="mp4ves-foot-2">[2]</a> Chrome does not support MP4V-ES; however, Chrome OS does.</p>
<h3 id="MPEG-1_Part_2_Video"><a id="MPEG-1" name="MPEG-1">MPEG-1</a> Part 2 Video</h3>
<p><strong>MPEG-1 Part 2 Video</strong> was unveiled at the beginning of the 1990s. Unlike the later MPEG video standards, MPEG-1 was created solely by MPEG, without the {{Glossary("ITU", "ITU's")}} involvement.</p>
<p>Because any MPEG-2 decoder can also play MPEG-1 video, it's compatible with a wide variety of software and hardware devices. There are no active patents remaining in relation to MPEG-1 video, so it may be used free of any licensing concerns. However, few web browsers support MPEG-1 video without the support of a plugin, and with plugin use deprecated in web browsers, these are generally no longer available. This makes MPEG-1 a poor choice for use in web sites and web applications.</p>
<table class="standard-table">
<tbody>
<tr>
<th scope="row">Supported bit rates</th>
<td>Up to 1.5 Mbps</td>
</tr>
<tr>
<th scope="row">Supported frame rates</th>
<td>23.976 FPS, 24 FPS, 25 FPS, 29.97 FPS, 30 FPS, 50 FPS, 59.94 FPS, and 60 FPS</td>
</tr>
<tr>
<th scope="row">Compression</th>
<td>Lossy <a href="https://en.wikipedia.org/wiki/Discrete_cosine_transform">DCT-based algorithm</a></td>
</tr>
<tr>
<th scope="row">Supported frame sizes</th>
<td>Up to 4,095 x 4,095 pixels</td>
</tr>
<tr>
<th scope="row">Supported color modes</th>
<td>Y'CbCr with 4:2:0 chroma subsampling with up to 12 bits per component</td>
</tr>
<tr>
<th scope="row">HDR support</th>
<td>No</td>
</tr>
<tr>
<th scope="row">Variable Frame Rate (VFR) support</th>
<td>No</td>
</tr>
<tr>
<th scope="row">Browser compatibility</th>
<td>
<table class="standard-table">
<tbody>
<tr>
<th scope="row">Feature</th>
<th scope="col">Chrome</th>
<th scope="col">Edge</th>
<th scope="col">Firefox</th>
<th scope="col">Internet Explorer</th>
<th scope="col">Opera</th>
<th scope="col">Safari</th>
</tr>
<tr>
<th scope="row">MPEG-1 support</th>
<td>No</td>
<td>No</td>
<td>No</td>
<td>No</td>
<td>No</td>
<td>Yes</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<th scope="row">Container support</th>
<td>MPEG</td>
</tr>
<tr>
<th scope="row">{{Glossary("RTP")}} / <a href="/en-US/docs/Web/API/WebRTC_API">WebRTC</a> compatible</th>
<td>No</td>
</tr>
<tr>
<th scope="row">Supporting/Maintaining organization</th>
<td><a href="https://mpeg.chiariglione.org/">MPEG</a></td>
</tr>
<tr>
<th scope="row">Specification</th>
<td><a href="https://www.iso.org/standard/22411.html">https://www.iso.org/standard/22411.html</a></td>
</tr>
<tr>
<th scope="row">Licensing</th>
<td>Proprietary; however, all patents have expired, so MPEG-1 may be used freely</td>
</tr>
</tbody>
</table>
<h3 id="MPEG-2_Part_2_Video"><a id="MPEG-2" name="MPEG-2">MPEG-2</a> Part 2 Video</h3>
<p><span class="seoSummary"><strong><a href="https://en.wikipedia.org/wiki/H.262/MPEG-2_Part_2">MPEG-2 Part 2</a></strong> is the video format defined by the MPEG-2 specification, and is also occasionally referred to by its {{Glossary("ITU")}} designation, H.262.</span> It is very similar to MPEG-1 video—in fact, any MPEG-2 player can automatically handle MPEG-1 without any special work—except it has been expanded to support higher bit rates and enhanced encoding techniques.</p>
<p>The goal was to allow MPEG-2 to compress standard definition television, so interlaced video is also supported. The standard definition compression rate and the quality of the resulting video met needs well enough that MPEG-2 is the primary video codec used for DVD video media.</p>
<p>MPEG-2 has several profiles available with different capabilities. Each profile is then available four levels, each of which increases attributes of the video, such as frame rate, resolution, bit rate, and so forth. Most profiles use Y'CbCr with 4:2:0 chroma subsampling, but more advanced profiles support 4:2:2 as well. In addition, there are four levels, each of which offers support for larger frame dimensions and bit rates. For example, the {{interwiki("wikipedia", "ATSC standards", "ATSC")}} specification for television used in North America supports MPEG-2 video in high definition using the Main Profile at High Level, allowing 4:2:0 video at both 1920 x 1080 (30 FPS) and 1280 x 720 (60 FPS), at a maximum bit rate of 80 Mbps.</p>
<p>However, few web browsers support MPEG-2 without the support of a plugin, and with plugin use deprecated in web browsers, these are generally no longer available. This makes MPEG-2 a poor choice for use in web sites and web applications.</p>
<table class="standard-table">
<tbody>
<tr>
<th scope="row">Supported bit rates</th>
<td>Up to 100 Mbps; varies by level and profile</td>
</tr>
<tr>
<th scope="row">Supported frame rates</th>
<td>
<table class="standard-table">
<thead>
<tr>
<th scope="row">Abbr.</th>
<th scope="col">Level name</th>
<th scope="col">Frame rates supported</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">LL</th>
<td>Low Level</td>
<td>23.9, 24, 25, 29.97, 30</td>
</tr>
<tr>
<th scope="row">ML</th>
<td>Main Level</td>
<td>23.976, 24, 25, 29.97, 30</td>
</tr>
<tr>
<th scope="row">H-14</th>
<td>High 1440</td>
<td>23.976, 24, 26, 29.97, 30, 50, 59.94, 60</td>
</tr>
<tr>
<th scope="row">HL</th>
<td>High Level</td>
<td>23.976, 24, 26, 29.97, 30, 50, 59.94, 60</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<th scope="row">Compression</th>
<td>Lossy <a href="https://en.wikipedia.org/wiki/Discrete_cosine_transform">DCT-based algorithm</a></td>
</tr>
<tr>
<th scope="row">Supported frame sizes</th>
<td>
<table class="standard-table">
<tbody>
<tr>
<th scope="row">Abbr.</th>
<th scope="col">Level name</th>
<th scope="col">Maximum frame size</th>
</tr>
<tr>
<th scope="row">LL</th>
<td>Low Level</td>
<td>352 x 288 pixels</td>
</tr>
<tr>
<th scope="row">ML</th>
<td>Main Level</td>
<td>720 x 576 pixels</td>
</tr>
<tr>
<th scope="row">H-14</th>
<td>High 1440</td>
<td>1440 x 1152 pixels</td>
</tr>
<tr>
<th scope="row">HL</th>
<td>High Level</td>
<td>1920 x 1152 pixels</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<th scope="row">Supported color modes</th>
<td>Y'CbCr with 4:2:0 chroma subsampling in most profiles; the "High" and "4:2:2" profiles support 4:2:2 chroma subsampling as well.</td>
</tr>
<tr>
<th scope="row">HDR support</th>
<td>No</td>
</tr>
<tr>
<th scope="row">Variable Frame Rate (VFR) support</th>
<td>No</td>
</tr>
<tr>
<th scope="row">Browser compatibility</th>
<td>
<table class="standard-table">
<tbody>
<tr>
<th scope="row">Feature</th>
<th scope="col">Chrome</th>
<th scope="col">Edge</th>
<th scope="col">Firefox</th>
<th scope="col">Internet Explorer</th>
<th scope="col">Opera</th>
<th scope="col">Safari</th>
</tr>
<tr>
<th scope="row">MPEG-2 support</th>
<td>No</td>
<td>No</td>
<td>No</td>
<td>No</td>
<td>No</td>
<td>Yes</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<th scope="row">Container support</th>
<td><a href="/en-US/docs/Web/Media/Formats/Containers#MPEGMPEG-2">MPEG</a>, MPEG-TS (MPEG Transport Stream), <a href="/en-US/docs/Web/Media/Formats/Containers#MP4">MP4</a>, <a href="/en-US/docs/Web/Media/Formats/Containers#QuickTime">QuickTime</a></td>
</tr>
<tr>
<th scope="row">{{Glossary("RTP")}} / <a href="/en-US/docs/Web/API/WebRTC_API">WebRTC</a> compatible</th>
<td>No</td>
</tr>
<tr>
<th scope="row">Supporting/Maintaining organization</th>
<td><a href="https://mpeg.chiariglione.org/">MPEG</a> / <a href="https://www.itu.int/">ITU</a></td>
</tr>
<tr>
<th scope="row">Specification</th>
<td><a href="https://www.itu.int/rec/T-REC-H.262">https://www.itu.int/rec/T-REC-H.262</a><br>
<a href="https://www.iso.org/standard/61152.html">https://www.iso.org/standard/61152.html</a></td>
</tr>
<tr>
<th scope="row">Licensing</th>
<td>Proprietary; all patents have expired worldwide with the exception of in Malaysia and the Philippines as of April 1, 2019, so MPEG-2 can be used freely outside those two countries. Patents are licensed by <a href="https://www.mpegla.com/programs/mpeg-2/">MPEG LA</a>.</td>
</tr>
</tbody>
</table>
<h3 id="Theora">Theora</h3>
<p><strong>{{interwiki("wikipedia", "Theora")}}</strong>, developed by <a href="https://xiph.org/">Xiph.org</a>, is an open and free video codec which may be used without royalties or licensing. Theora is comparable in quality and compression rates to MPEG-4 Part 2 Visual and AVC, making it a very good if not top-of-the-line choice for video encoding. But its status as being free from any licensing concerns and its relatively low CPU resource requirements make it a popular choice for many software and web projects. The low CPU impact is particularly useful since there are no hardware decoders available for Theora.</p>
<p>Theora was originally based upon the VC3 codec by On2 Technologies. The codec and its specification were released under the LGPL license and entrusted to Xiph.org, which then developed it into the Theora standard.</p>
<p>One drawback to Theora is that it only supports 8 bits per color component, with no option to use 10 or more in order to avoid color banding. That said, 8 bits per component is still the most commonly-used color format in use today, so this is only a minor inconvenience in most cases. Also, Theora can only be used in an Ogg container. The biggest drawback of all, however, is that it is not supported by Safari, leaving Theora unavailable not only on macOS but on all those millions and millions of iPhones and iPads.</p>
<p>The <a href="http://en.flossmanuals.net/ogg-theora/">Theora Cookbook</a> offers additional details about Theora as well as the Ogg container format it is used within.</p>
<table class="standard-table">
<tbody>
<tr>
<th scope="row">Supported bit rates</th>
<td>Up to 2 Gbps</td>
</tr>
<tr>
<th scope="row">Supported frame rates</th>
<td>Arbitrary; any non-zero value is supported. The frame rate is specified as a 32-bit numerator and a 32-bit denominator, to allow for non-integer frame rates.</td>
</tr>
<tr>
<th scope="row">Compression</th>
<td>Lossy <a href="https://en.wikipedia.org/wiki/Discrete_cosine_transform">DCT-based algorithm</a></td>
</tr>
<tr>
<th scope="row">Supported frame sizes</th>
<td>Any combination of width and height up to 1,048,560 x 1,048,560 pixels</td>
</tr>
<tr>
<th scope="row">Supported color modes</th>
<td>Y'CbCr with 4:2:0, 4:2:2, and 4:4:4 chroma subsampling at 8 bits per component</td>
</tr>
<tr>
<th scope="row">HDR support</th>
<td>No</td>
</tr>
<tr>
<th scope="row">Variable Frame Rate (VFR) support</th>
<td>Yes<sup><a href="#theora-foot-1">[1]</a></sup></td>
</tr>
<tr>
<th scope="row">Browser compatibility</th>
<td>
<table class="standard-table">
<tbody>
<tr>
<th scope="row">Feature</th>
<th scope="col">Chrome</th>
<th scope="col">Edge</th>
<th scope="col">Firefox</th>
<th scope="col">Internet Explorer</th>
<th scope="col">Opera</th>
<th scope="col">Safari</th>
</tr>
<tr>
<th scope="row">Theora support</th>
<td>3</td>
<td>Yes<sup><a href="#theora-foot-2">[2]</a></sup></td>
<td>3.5</td>
<td>No</td>
<td>10.5</td>
<td>No</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<th scope="row">Container support</th>
<td><a href="/en-US/docs/Web/Media/Formats/Containers#Ogg">Ogg</a></td>
</tr>
<tr>
<th scope="row">{{Glossary("RTP")}} / <a href="/en-US/docs/Web/API/WebRTC_API">WebRTC</a> compatible</th>
<td>No</td>
</tr>
<tr>
<th scope="row">Supporting/Maintaining organization</th>
<td><a href="https://www.xiph.org/">Xiph.org</a></td>
</tr>
<tr>
<th scope="row">Specification</th>
<td><a href="https://www.theora.org/doc/">https://www.theora.org/doc/</a></td>
</tr>
<tr>
<th scope="row">Licensing</th>
<td>Open and free of royalties and any other licensing requirements</td>
</tr>
</tbody>
</table>
<p><a id="theora-foot-1" name="theora-foot-1">[1]</a> While Theora doesn't support Variable Frame Rate (VFR) within a single stream, multiple streams can be chained together within a single file, and each of those can have its own frame rate, thus allowing what is essentially VFR. However, this is impractical if the frame rate needs to change frequently.</p>
<p><a name="theora-foot-2">[2]</a> Edge supports Theora with the optional <a href="https://www.microsoft.com/en-us/p/web-media-extensions/9n5tdp8vcmhs?activetab=pivot:overviewtab">Web Media Extensions</a> add-on.</p>
<h3 id="VP8">VP8</h3>
<p>The <strong>Video Processor 8</strong> (<strong>VP8</strong>) codec was initially created by On2 Technologies. Following their purchase of On2, Google released VP8 as an open and royalty-free video format under a promise not to enforce the relevant patents. In terms of quality and compression rate, VP8 is comparable to {{anch("AVC")}}.</p>
<p>If supported by the browser, VP8 allows video with an alpha channel, allowing the video to play with the background able to be seen through the video to a degree specified by each pixel's alpha component.</p>
<p>There is good browser support for VP8 in HTML content, especially within <a href="/en-US/docs/Web/Media/Formats/Containers#WebM">WebM</a> files. This makes VP8 a good candidate for your content, although VP9 is an even better choice if available to you. Web browsers are <em>required</em> to support VP8 for WebRTC, but not all browsers that do so also support it in HTML audio and video elements.</p>
<table class="standard-table">
<tbody>
<tr>
<th scope="row">Supported bit rates</th>
<td>Arbitrary; no maximum unless level-based limitations are enforced</td>
</tr>
<tr>
<th scope="row">Supported frame rates</th>
<td>Arbitrary</td>
</tr>
<tr>
<th scope="row">Compression</th>
<td>Lossy <a href="https://en.wikipedia.org/wiki/Discrete_cosine_transform">DCT-based algorithm</a></td>
</tr>
<tr>
<th scope="row">Supported frame sizes</th>
<td>Up to 16,384 x 16,384 pixels</td>
</tr>
<tr>
<th scope="row">Supported color modes</th>
<td>Y'CbCr with 4:2:0 chroma subsampling at 8 bits per component</td>
</tr>
<tr>
<th scope="row">HDR support</th>
<td>No</td>
</tr>
<tr>
<th scope="row">Variable Frame Rate (VFR) support</th>
<td>Yes</td>
</tr>
<tr>
<th scope="row">Browser compatibility</th>
<td>
<table class="standard-table">
<tbody>
<tr>
<th scope="row">Feature</th>
<th scope="col">Chrome</th>
<th scope="col">Edge</th>
<th scope="col">Firefox</th>
<th scope="col">Internet Explorer</th>
<th scope="col">Opera</th>
<th scope="col">Safari</th>
</tr>
<tr>
<th scope="row">VP8 support</th>
<td>25</td>
<td>14<sup><a href="#vp8-foot-1">[1]</a></sup></td>
<td>4</td>
<td>9</td>
<td>16</td>
<td>12.1<sup><a href="#vp8-foot-2">[2]</a></sup></td>
</tr>
<tr>
<th scope="row">MSE compatibility</th>
<td></td>
<td></td>
<td>Yes<sup><a href="#vp8-foot-3">3</a></sup></td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<th scope="row">Container support</th>
<td><a href="/en-US/docs/Web/Media/Formats/Containers#3GP">3GP</a>, <a href="/en-US/docs/Web/Media/Formats/Containers#Ogg">Ogg</a>, <a href="/en-US/docs/Web/Media/Formats/Containers#WebM">WebM</a></td>
</tr>
<tr>
<th scope="row">{{Glossary("RTP")}} / <a href="/en-US/docs/Web/API/WebRTC_API">WebRTC</a> compatible</th>
<td>Yes; VP8 is one of the spec-required codecs for WebRTC</td>
</tr>
<tr>
<th scope="row">Supporting/Maintaining organization</th>
<td><a href="https://www.google.com/">Google</a></td>
</tr>
<tr>
<th scope="row">Specification</th>
<td>{{RFC(6386)}}</td>
</tr>
<tr>
<th scope="row">Licensing</th>
<td>Open and free of royalties and any other licensing requirements</td>
</tr>
</tbody>
</table>
<p><a name="vp8-foot-1">[1]</a> Edge support for VP8 requires the use of <a href="/en-US/docs/Web/API/Media_Source_Extensions_API">Media Source Extensions</a>.</p>
<p><a id="vp8-foot-2" name="vp8-foot-2">[2]</a> Safari only supports VP8 in WebRTC connections.</p>
<p><a id="vp8-foot-3" name="vp8-foot-3">[3]</a> Firefox only supports VP8 in MSE when no H.264 hardware decoder is available. Use {{domxref("MediaSource.isTypeSupported()")}} to check for availability.</p>
<h3 id="VP9">VP9</h3>
<p><strong>Video Processor 9</strong> (<strong>VP9</strong>) is the successor to the older VP8 standard developed by Google. Like VP8, VP9 is entirely open and royalty-free. Its encoding and decoding performance is comparable to or slightly faster than that of AVC, but with better quality. VP9's encoded video quality is comparable to that of HEVC at similar bit rates.</p>
<p>VP9's main profile supports only 8-bit color depth at 4:2:0 chroma subsampling levels, but its profiles include support for deeper color and the full range of chroma subsampling modes. It supports several HDR imiplementations, and offers substantial freedom in selecting frame rates, aspect ratios, and frame sizes.</p>
<p>VP9 is widely supported by browsers, and hardware implementations of the codec are fairly common. VP9 is one of the two video codecs mandated by <a href="/en-US/docs/Web/Media/Formats/Containers#WebM">WebM</a> (the other being {{anch("VP8")}}). Of note, however, is that Safari supports neither WebM nor VP9, so if you choose to use VP9, be sure to offer a fallback format such as AVC or HEVC for iPhone, iPad, and Mac users.</p>
<p>Aside from the lack of Safari support, VP9 is a good choice if you are able to use a WebM container and are able to provide a fallback video in a format such as AVC or HEVC for Safari users. This is especially true if you wish to use an open codec rather than a proprietary one. If you can't provide a fallback and aren't willing to sacrifice Safari compatibility, VP9 in WebM is a good option. Otherwise, you should probably consider a different codec.</p>
<table class="standard-table">
<tbody>
<tr>
<th scope="row">Supported bit rates</th>
<td>Arbitrary; no maximum unless level-based limitations are enforced</td>
</tr>
<tr>
<th scope="row">Supported frame rates</th>
<td>Arbitrary</td>
</tr>
<tr>
<th scope="row">Compression</th>
<td>Lossy <a href="https://en.wikipedia.org/wiki/Discrete_cosine_transform">DCT-based algorithm</a></td>
</tr>
<tr>
<th scope="row">Supported frame sizes</th>
<td>Up to 65,536 x 65,536 pixels</td>
</tr>
<tr>
<th scope="row">Supported color modes</th>
<td>
<table class="standard-table">
<thead>
<tr>
<th scope="row">Profile</th>
<th scope="col">Color depths</th>
<th scope="col">Chroma subsampling</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">Profile 0</th>
<td>8</td>
<td>4:2:0</td>
</tr>
<tr>
<th scope="row">Profile 1</th>
<td>8</td>
<td>4:2:0, 4:2:2, and 4:4:4</td>
</tr>
<tr>
<th scope="row">Profile 2</th>
<td>10 to 12</td>
<td>4:2:0</td>
</tr>
<tr>
<th scope="row">Profile 3</th>
<td>10 to 12</td>
<td>4:2:0, 4:2:2, and f:4:4</td>
</tr>
</tbody>
</table>
<p>Color spaces supported: {{interwiki("wikipedia", "Rec. 601")}}, {{interwiki("wikipedia", "Rec. 709")}}, {{interwiki("wikipedia", "Rec. 2020")}}, {{interwiki("wikipedia", "SMPTE C")}}, SMPTE-240M (obsolete; replaced by Rec. 709), and {{interwiki("wikipedia", "sRGB")}}.</p>
</td>
</tr>
<tr>
<th scope="row">HDR support</th>
<td>Yes; HDR10+, <a href="https://en.wikipedia.org/wiki/Hybrid_Log-Gamma">HLG</a>, and <a href="https://en.wikipedia.org/wiki/Perceptual_Quantizer">PQ</a></td>
</tr>
<tr>
<th scope="row">Variable Frame Rate (VFR) support</th>
<td>Yes</td>
</tr>
<tr>
<th scope="row">Browser compatibility</th>
<td>
<table class="standard-table">
<tbody>
<tr>
<th scope="row">Feature</th>
<th scope="col">Chrome</th>
<th scope="col">Edge</th>
<th scope="col">Firefox</th>
<th scope="col">Internet Explorer</th>
<th scope="col">Opera</th>
<th scope="col">Safari</th>
</tr>
<tr>
<th scope="row">VP9 support</th>
<td>29</td>
<td>14</td>
<td>28</td>
<td>No</td>
<td>10.6</td>
<td>No</td>
</tr>
<tr>
<th scope="row">MSE compatibility</th>
<td></td>
<td></td>
<td>Yes<sup><a href="#vp9-foot-1">1</a></sup></td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<th scope="row">Container support</th>
<td><a href="/en-US/docs/Web/Media/Formats/Containers#MP4">MP4</a>, <a href="/en-US/docs/Web/Media/Formats/Containers#Ogg">Ogg</a>, <a href="/en-US/docs/Web/Media/Formats/Containers#WebM">WebM</a></td>
</tr>
<tr>
<th scope="row">{{Glossary("RTP")}} / <a href="/en-US/docs/Web/API/WebRTC_API">WebRTC</a> compatible</th>
<td>Yes</td>
</tr>
<tr>
<th scope="row">Supporting/Maintaining organization</th>
<td><a href="https://www.google.com/">Google</a></td>
</tr>
<tr>
<th scope="row">Specification</th>
<td><a href="https://www.webmproject.org/vp9/">https://www.webmproject.org/vp9/</a></td>
</tr>
<tr>
<th scope="row">Licensing</th>
<td>Open and free of royalties and any other licensing requirements</td>
</tr>
</tbody>
</table>
<p><a id="vp9-foot-1" name="vp9-foot-1">[1]</a> Firefox only supports VP8 in MSE when no H.264 hardware decoder is available. Use {{domxref("MediaSource.isTypeSupported()")}} to check for availability.</p>
<h2 id="Choosing_a_video_codec">Choosing a video codec</h2>
<p>The decision as to which codec or codecs to use begins with a series of questions to prepare yourself:</p>
<ul>
<li>Do you wish to use an open format, or are proprietary formats also to be considered?</li>
<li>Do you have the resources to produce more than one format for each of your videos? The ability to provide a fallback option vastly simplifies the decision-making process.</li>
<li>Are there any browsers you're willing to sacrifice compatibility with?</li>
<li>How old is the oldest version of web browser you need to support? For example, do you need to work on every browser shipped in the past five yeras, or just the past one year?</li>
</ul>
<p>In the sections below, we offer recommended codec selections for specific use cases. For each use case, you'll find up to two reccommendations. If the codec which is considered best for the use case is proprietary or may require royalty payments, then two options are provided: first, an open and royalty-free option, followed by the proprietary one.</p>
<p>If you are only able to offer a single version of each video, you can choose the format that's most appropriate for your needs.The first one is recommended as being a good combnination of quality, performance, and compatibility. The second option will be the most broadly compatible choice, at the expense of some amount of quality, preformance, and/or size.</p>
<h3 id="Recommendations_for_everyday_videos">Recommendations for everyday videos</h3>
<p>First, let's look at the best options for videos presented on a typical web site such as a blog, informational site, small business web site where videos are used to demonstrate products (but not where the videos themselves are a product), and so forth.</p>
<ol>
<li>
<p>A <strong><a href="/en-US/docs/Web/Media/Formats/Containers#WebM">WebM</a></strong> container using the <strong>{{anch("VP8")}}</strong> codec for video and the <strong><a href="/en-US/docs/Web/Media/Formats/Audio_codecs#Opus">Opus</a></strong> codec for audio. These are all open, royalty-free formats which are generally well-supported, although only in quite recent browsers, which is why a fallback is a good idea.</p>
<pre class="brush: js"><video controls src="filename.webm"></video>
</pre>
</li>
<li>
<p>An <strong><a href="/en-US/docs/Web/Media/Formats/Containers#MP4">MP4</a></strong> container and the <strong>{{anch("AVC")}}</strong> (<strong>H.264</strong>) video codec, ideally with <strong><a href="/en-US/docs/Web/Media/Formats/Audio_codecs#AAC">AAC</a></strong> as your audio codec. This is because the MP4 container with AVC and AAC codecs within is a broadly-supported combination—by every major browser, in fact—and the quality is typically good for most use cases. Make sure you verify your compliance with the license requirements, however.</p>
<pre class="brush: html"><video controls>
<source type="video/webm"
src="filename.webm">
<source type="video/mp4"
src="filename.mp4">
</video>
</pre>
</li>
</ol>
<div class="blockIndicator note">
<p><strong>Note:</strong> Keep in mind that the {{HTMLElement("<video>")}} element requires a closing <code></video></code> tag, whether or not you have any {{HTMLElement("source")}} elements inside it.</p>
</div>
<h3 id="Recommendations_for_high-quality_video_presentation">Recommendations for high-quality video presentation</h3>
<p>If your mission is to present video at the highest possible quality, you will probably benefit from offering as many formats as possible, as the codecs capable of the best quality tend also to be the newest, and thus the most likely to have gaps in browser compatibility.</p>
<ol>
<li>
<p>A WebM container using AV1 for video and Opus for audio. If you're able to use the High or Professional profile when encoding AV1, at a high level like 6.3, you can get very high bit rates at 4K or 8K resolution, while maintaining excellent video quality. Encoding your audio using Opus's Fullband profile at a 48 kHz sample rate maximizes the audio bandwidth captured, capturing nearly the entire frequency range that's within human hearing.</p>
<pre class="brush: js"><video controls src="filename.webm"></video>
</pre>
</li>
<li>
<p>An MP4 container using the {{anch("HEVC")}} codec using one of the advanced Main profiles, such as Main 4:2:2 with 10 or 12 bits of color depth, or even the Main 4:4:4 profile at up to 16 bits per component. At a high bit rate, this provides excellent graphics quality with remarkable color reproduction. In addition, you can optionally include HDR metadata to provide high dynamic range video. For audio, use the AAC codec at a high sample rate (at least 48 kHz but ideally 96kHz) and encoded with complex encoding rather than fast encoding.</p>
<pre class="brush: html"><video controls>
<source type="video/webm"
src="filename.webm">
<source type="video/mp4"
src="filename.mp4">
</video>
</pre>
</li>
</ol>
<h3 id="Recommendations_for_archival_editing_or_remixing">Recommendations for archival, editing, or remixing</h3>
<p>There are not currently any lossless—or even near-lossless—video codecs generally available in web browsers. The reason for this is simple: video is huge. Lossless compression is by definition less effective than lossy compression. For example, uncompressed 1080p video (1920 by 1080 pixels) with 4:2:0 chroma subsampling needs at least 1.5 Gbps. Using lossless compression such as FFV1 (which is not supported by web browsers) could perhaps reduce that to somewhere around 600 Mbps, depending on the content. That's still a huge number of bits to pump through a connection every second, and is not currently practical for any real-world use.</p>
<p>This is the case even though some of the lossy codecs have a lossless mode available; the lossless modes are not implemented in any current web browsers. The best you can do is to select a high-quality codec that uses lossy compression and configure it to perform as little compression as possible. One way to do this is to configure the codec to use "fast" compression, which inherently means less compression is achieved.</p>
<h4 id="Preparing_video_externally">Preparing video externally</h4>
<p>To prepare video for archival purposes from outside your web site or app, use a utility that performs compression on the original uncompressed video data. For example, the free <a href="https://www.videolan.org/developers/x264.html">x264</a> utility can be used to encode video in {{anch("AVC")}} format using a very high bit rate:</p>
<pre>x264 --crf 18 -preset ultrafast --output <em>outfilename.mp4</em> <em>infile</em></pre>
<p>While other codecs may have better best-case quality levels when compressing the video by a significant margin, their encoders tend to be slow enough that the nearly-lossless encoding you get with this compression is vastly faster at about the same overall quality level.</p>
<h4 id="Recording_video">Recording video</h4>
<p>Given the constraints on how close to lossless you can get, you might consider using {{anch("AVC")}} or {{anch("AV1")}}. For example, if you're using the <a href="/en-US/docs/Web/API/MediaStream_Recording_API">MediaStream Recording API</a> to record video, you might use code like the following when creating your {{domxref("MediaRecorder")}} object:</p>
<pre class="brush: js">const kbps = 1024;
const Mbps = kbps*kbps;
const options = {
mimeType: 'video/webm; codecs="av01.2.19H.12.0.000.09.16.09.1, flac"',
bitsPerSecond: 800*Mbps,
};
let recorder = new MediaRecorder(sourceStream, options);</pre>
<p>This example creates a <code>MediaRecorder</code> configured to record {{anch("AV1")}} video using BT.2100 HDR in 12-bit color with 4:4:4 chroma subsampling and <a href="/en-US/docs/Web/Media/Formats/Audio_codecs#FLAC">FLAC</a> for lossless audio. The resulting file will use a bit rate of no more than 800 Mbps shared between the video and audio tracks. You will likely need to adjust these values depending on hardware performance, your requirements, and the specific codecs you choose to use. This bit rate is obviously not realistic for network transmission and would likely only be used locally.</p>
<p>Breaking down the value of the <code>codecs</code> parameter into its dot-delineated properties, we see the following:</p>
<table class="standard-table">
<thead>
<tr>
<th scope="col">Value</th>
<th scope="col">Desccription</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>av01</code></td>
<td>The four-character code (4CC) designation identifying the {{anch("AV1")}} codec.</td>
</tr>
<tr>
<td><code>2</code></td>
<td>The profile. A value of 2 indicates the Professional profile. A value of 1 is the High profile, while a value of 0 would specify the Main profile.</td>
</tr>
<tr>
<td><code>19H</code></td>
<td>The level and tier. This value comes from the table in section <a href="https://aomediacodec.github.io/av1-spec/#levels">A.3</a> of the AV1 specification, and indicates the high tier of Level 6.3.</td>
</tr>
<tr>
<td><code>12</code></td>
<td>The color depth. This indicates 12 bits per component. Other possible values are 8 and 10, but 12 is the highest-accuracy color representation available in AV1.</td>
</tr>
<tr>
<td><code>0</code></td>
<td>The monochrome mode flag. If 1, then no chroma planes would be recorded, and all data should be structly luma data, resulting in a greyscale image. We've specified 0 because we want color.</td>
</tr>
<tr>
<td><code>000</code></td>
<td>The chroma subsampling mode, taken from <a href="https://aomediacodec.github.io/av1-spec/#color-config-semantics">section 6.4.2</a> in the AV1 specification. A value of 000, combined with the monochrome mode value 0, indicates that we want 4:4:4 chroma subsampling, or no loss of color data.</td>
</tr>
<tr>
<td><code>09</code></td>
<td>The color primaries to use. This value comes from <a href="https://aomediacodec.github.io/av1-spec/#color-config-semantics">section 6.4.2</a> in the AV1 specification; 9 indicates that we want to use BT.2020 color, which is used for HDR.</td>
</tr>
<tr>
<td><code>16</code></td>
<td>The transfer characteristics to use. This comes from <a href="https://aomediacodec.github.io/av1-spec/#color-config-semantics">section 6.4.2</a> as well; 16 indicates that we want to use the characteristics for BT.2100 PQ color.</td>
</tr>
<tr>
<td><code>09</code></td>
<td>The matrix coefficents to use, from the <a href="https://aomediacodec.github.io/av1-spec/#color-config-semantics">section 6.4.2</a> again. A value of 9 specifies that we want to use BT.2020 with variable luminance; this is also known as BT.2010 YbCbCr.</td>
</tr>
<tr>
<td><code>1</code></td>
<td>The video "full range" flag. A value of 1 indicates that we want the full color range to be used.</td>
</tr>
</tbody>
</table>
<p>The documentation for your codec choices will probably offer information you'll use when constructing your <code>codecs</code> parameter.</p>
<h2 id="See_also">See also</h2>
<ul>
<li><a href="/en-US/docs/Web/Media/Formats/Audio_codecs">Web audio codec guide</a></li>
<li><a href="/en-US/docs/Web/Media/Formats/Containers">Media container formats (file types)</a></li>
<li><a href="/en-US/docs/Web/Media/Formats/Support_issues">Handling media support issues in web content</a></li>
<li><a href="/en-US/docs/Web/Media/Formats/WebRTC_codecs">Codecs used by WebRTC</a></li>
<li>{{RFC(6381)}}: The "Codecs" and "Profiles" parameters for "Bucket" media types</li>
<li>{{RFC(5334)}}: Ogg Media Types</li>
<li>{{RFC(3839)}}: MIME Type Registrations for 3GPP Multimedia Files</li>
<li>{{RFC(4381)}}: MIME Type Registrations for 3GPP2 Multimedia Files</li>
<li>{{RFC(4337)}}: MIME Type Registrations for MPEG-4</li>
<li><a href="http://dev.opera.com/articles/view/introduction-html5-video/#codecs">Video codecs in Opera</a></li>
<li><a href="http://msdn.microsoft.com/en-us/library/ff975073%28v=VS.85%29.aspx">Video</a> and <a href="http://msdn.microsoft.com/en-us/library/ff975061%28v=vs.85%29.aspx">audio</a> codecs in Internet Explorer</li>
<li><a href="http://www.chromium.org/audio-video">Video and audio codecs in Chrome</a></li>
</ul>
|