-
Notifications
You must be signed in to change notification settings - Fork 0
/
MediaMuxer.xml
856 lines (849 loc) · 50.9 KB
/
MediaMuxer.xml
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
<Type Name="MediaMuxer" FullName="Android.Media.MediaMuxer">
<TypeSignature Language="C#" Value="public sealed class MediaMuxer : Java.Lang.Object" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi sealed beforefieldinit MediaMuxer extends Java.Lang.Object" />
<TypeSignature Language="DocId" Value="T:Android.Media.MediaMuxer" />
<TypeSignature Language="F#" Value="type MediaMuxer = class
 inherit Object" />
<AssemblyInfo>
<AssemblyName>Mono.Android</AssemblyName>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>Java.Lang.Object</BaseTypeName>
</Base>
<Interfaces />
<Attributes>
<Attribute>
<AttributeName Language="C#">[Android.Runtime.Register("android/media/MediaMuxer", DoNotGenerateAcw=true)]</AttributeName>
<AttributeName Language="F#">[<Android.Runtime.Register("android/media/MediaMuxer", DoNotGenerateAcw=true)>]</AttributeName>
</Attribute>
</Attributes>
<Docs since="18">
<summary>MediaMuxer facilitates muxing elementary streams.</summary>
<remarks>
<para>MediaMuxer facilitates muxing elementary streams. Currently MediaMuxer supports MP4, Webm
and 3GP file as the output. It also supports muxing B-frames in MP4 since Android Nougat.</para>
<para>It is generally used like this:</para>
<code lang="text/java">MediaMuxer muxer = new MediaMuxer("temp.mp4", OutputFormat.MUXER_OUTPUT_MPEG_4);
// More often, the MediaFormat will be retrieved from MediaCodec.getOutputFormat()
// or MediaExtractor.getTrackFormat().
MediaFormat audioFormat = new MediaFormat(...);
MediaFormat videoFormat = new MediaFormat(...);
int audioTrackIndex = muxer.addTrack(audioFormat);
int videoTrackIndex = muxer.addTrack(videoFormat);
ByteBuffer inputBuffer = ByteBuffer.allocate(bufferSize);
boolean finished = false;
BufferInfo bufferInfo = new BufferInfo();
muxer.start();
while(!finished) {
// getInputBuffer() will fill the inputBuffer with one frame of encoded
// sample from either MediaCodec or MediaExtractor, set isAudioSample to
// true when the sample is audio data, set up all the fields of bufferInfo,
// and return true if there are no more samples.
finished = getInputBuffer(inputBuffer, isAudioSample, bufferInfo);
if (!finished) {
int currentTrackIndex = isAudioSample ? audioTrackIndex : videoTrackIndex;
muxer.writeSampleData(currentTrackIndex, inputBuffer, bufferInfo);
}
};
muxer.stop();
muxer.release();
</code>
<para><h4>Metadata Track</h4></para>
<para>Per-frame metadata carries information that correlates with video or audio to facilitate offline
processing. For example, gyro signals from the sensor can help video stabilization when doing
offline processing. Metadata tracks are only supported when multiplexing to the MP4 container
format. When adding a new metadata track, the MIME type format must start with prefix
"application/" (for example, "application/gyro"). The format of the metadata is
application-defined. Metadata timestamps must be in the same time base as video and audio
timestamps. The generated MP4 file uses TextMetaDataSampleEntry (defined in section 12.3.3.2 of
the ISOBMFF specification) to signal the metadata's MIME type.</para>
<code lang="text/java">MediaMuxer muxer = new MediaMuxer("temp.mp4", OutputFormat.MUXER_OUTPUT_MPEG_4);
// SetUp Video/Audio Tracks.
MediaFormat audioFormat = new MediaFormat(...);
MediaFormat videoFormat = new MediaFormat(...);
int audioTrackIndex = muxer.addTrack(audioFormat);
int videoTrackIndex = muxer.addTrack(videoFormat);
// Setup Metadata Track
MediaFormat metadataFormat = new MediaFormat(...);
metadataFormat.setString(KEY_MIME, "application/gyro");
int metadataTrackIndex = muxer.addTrack(metadataFormat);
muxer.start();
while(..) {
// Allocate bytebuffer and write gyro data(x,y,z) into it.
ByteBuffer metaData = ByteBuffer.allocate(bufferSize);
metaData.putFloat(x);
metaData.putFloat(y);
metaData.putFloat(z);
BufferInfo metaInfo = new BufferInfo();
// Associate this metadata with the video frame by setting
// the same timestamp as the video frame.
metaInfo.presentationTimeUs = currentVideoTrackTimeUs;
metaInfo.offset = 0;
metaInfo.flags = 0;
metaInfo.size = bufferSize;
muxer.writeSampleData(metadataTrackIndex, metaData, metaInfo);
};
muxer.stop();
muxer.release();
}</code>
<para><h2 id=History>"History">Features and API History</h2></para>
<para>The following table summarizes the feature support in different API version and containers.
For API version numbers, see <c>android.os.Build.VERSION_CODES</c>.
<style>
.api > tr > th, .api > tr > td { text-align: center; padding: 4px 4px; }
.api > tr > th { vertical-align: bottom; }
.api > tr > td { vertical-align: middle; }
.sml > tr > th, .sml > tr > td { text-align: center; padding: 2px 4px; }
.fn { text-align: center; }</style>
<table align="right" style="width: 0%">
<thead>
<tbody class=api>
<tr><th>Symbol</th>
<th>Meaning</th></tr>
</tbody>
</thead>
<tbody class=sml>
<tr><td>&#9679;</td><td>Supported</td></tr>
<tr><td>&#9675;</td><td>Not supported</td></tr>
<tr><td>&#9639;</td><td>Supported in MP4/WebM/3GP</td></tr>
<tr><td>&#8277;</td><td>Only Supported in MP4</td></tr>
</tbody>
</table>
<table align="center" style="width: 100%;">
<thead class=api>
<tr>
<th rowspan=2>Feature</th>
<th colspan="24">SDK Version</th>
</tr>
<tr>
<th>18</th>
<th>19</th>
<th>20</th>
<th>21</th>
<th>22</th>
<th>23</th>
<th>24</th>
<th>25</th>
<th>26+</th>
</tr>
</thead>
<tbody class=api>
<tr>
<td align="center">MP4 container</td>
<td>&#9679;</td>
<td>&#9679;</td>
<td>&#9679;</td>
<td>&#9679;</td>
<td>&#9679;</td>
<td>&#9679;</td>
<td>&#9679;</td>
<td>&#9679;</td>
<td>&#9679;</td>
</tr>
<td align="center">WebM container</td>
<td>&#9675;</td>
<td>&#9675;</td>
<td>&#9675;</td>
<td>&#9679;</td>
<td>&#9679;</td>
<td>&#9679;</td>
<td>&#9679;</td>
<td>&#9679;</td>
<td>&#9679;</td>
</tr>
<td align="center">3GP container</td>
<td>&#9675;</td>
<td>&#9675;</td>
<td>&#9675;</td>
<td>&#9675;</td>
<td>&#9675;</td>
<td>&#9675;</td>
<td>&#9675;</td>
<td>&#9675;</td>
<td>&#9679;</td>
</tr>
<td align="center">Muxing B-Frames(bi-directional predicted frames)</td>
<td>&#9675;</td>
<td>&#9675;</td>
<td>&#9675;</td>
<td>&#9675;</td>
<td>&#9675;</td>
<td>&#9675;</td>
<td>&#8277;</td>
<td>&#8277;</td>
<td>&#8277;</td>
</tr>
</tr>
<td align="center">Muxing Single Video/Audio Track</td>
<td>&#9639;</td>
<td>&#9639;</td>
<td>&#9639;</td>
<td>&#9639;</td>
<td>&#9639;</td>
<td>&#9639;</td>
<td>&#9639;</td>
<td>&#9639;</td>
<td>&#9639;</td>
</tr>
</tr>
<td align="center">Muxing Multiple Video/Audio Tracks</td>
<td>&#9675;</td>
<td>&#9675;</td>
<td>&#9675;</td>
<td>&#9675;</td>
<td>&#9675;</td>
<td>&#9675;</td>
<td>&#9675;</td>
<td>&#9675;</td>
<td>&#8277;</td>
</tr>
</tr>
<td align="center">Muxing Metadata Tracks</td>
<td>&#9675;</td>
<td>&#9675;</td>
<td>&#9675;</td>
<td>&#9675;</td>
<td>&#9675;</td>
<td>&#9675;</td>
<td>&#9675;</td>
<td>&#9675;</td>
<td>&#8277;</td>
</tr>
</tbody>
</table></para>
<para>
<format type="text/html">
<a href="https://developer.android.com/reference/android/media/MediaMuxer" title="Reference documentation">Java documentation for <code>android.media.MediaMuxer</code>.</a>
</format>
</para>
<para>
Portions of this page are modifications based on work created and shared by the
<format type="text/html"><a href="https://developers.google.com/terms/site-policies" title="Android Open Source Project">Android Open Source Project</a></format>
and used according to terms described in the
<format type="text/html"><a href="https://creativecommons.org/licenses/by/2.5/" title="Creative Commons 2.5 Attribution License">Creative Commons 2.5 Attribution License.</a></format></para>
</remarks>
<since version="Added in API level 18" />
</Docs>
<Members>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public MediaMuxer (Java.IO.FileDescriptor fd, Android.Media.MuxerOutputType format);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class Java.IO.FileDescriptor fd, valuetype Android.Media.MuxerOutputType format) cil managed" />
<MemberSignature Language="DocId" Value="M:Android.Media.MediaMuxer.#ctor(Java.IO.FileDescriptor,Android.Media.MuxerOutputType)" />
<MemberSignature Language="F#" Value="new Android.Media.MediaMuxer : Java.IO.FileDescriptor * Android.Media.MuxerOutputType -> Android.Media.MediaMuxer" Usage="new Android.Media.MediaMuxer (fd, format)" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>Mono.Android</AssemblyName>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName Language="C#">[Android.Runtime.Register(".ctor", "(Ljava/io/FileDescriptor;I)V", "", ApiSince=26)]</AttributeName>
<AttributeName Language="F#">[<Android.Runtime.Register(".ctor", "(Ljava/io/FileDescriptor;I)V", "", ApiSince=26)>]</AttributeName>
</Attribute>
<Attribute>
<AttributeName Language="C#">[System.Runtime.Versioning.SupportedOSPlatform("android26.0")]</AttributeName>
<AttributeName Language="F#">[<System.Runtime.Versioning.SupportedOSPlatform("android26.0")>]</AttributeName>
</Attribute>
</Attributes>
<Parameters>
<Parameter Name="fd" Type="Java.IO.FileDescriptor" />
<Parameter Name="format" Type="Android.Media.MuxerOutputType">
<Attributes>
<Attribute>
<AttributeName Language="C#">[Android.Runtime.GeneratedEnum]</AttributeName>
<AttributeName Language="F#">[<Android.Runtime.GeneratedEnum>]</AttributeName>
</Attribute>
</Attributes>
</Parameter>
</Parameters>
<Docs>
<param name="fd">The FileDescriptor of the output media file. If <c>format</c> is
<c>OutputFormat#MUXER_OUTPUT_WEBM</c>, <c>fd</c> must be open in read-write mode.
Otherwise, write mode is sufficient, but read-write is also accepted.</param>
<param name="format">The format of the output media file.</param>
<summary>Creates a media muxer that writes to the specified FileDescriptor.</summary>
<remarks>
<para>Creates a media muxer that writes to the specified FileDescriptor.</para>
<para>The caller must not use the file referenced by the specified <c>fd</c> before calling
<c>#stop</c>.</para>
<para>It is the caller's responsibility to close the file descriptor, which is safe to do so
as soon as this call returns.</para>
<para>
<format type="text/html">
<a href="https://developer.android.com/reference/android/media/MediaMuxer#MediaMuxer(java.io.FileDescriptor,%20int)" title="Reference documentation">Java documentation for <code>android.media.MediaMuxer.MediaMuxer(java.io.FileDescriptor, int)</code>.</a>
</format>
</para>
<para>
Portions of this page are modifications based on work created and shared by the
<format type="text/html"><a href="https://developers.google.com/terms/site-policies" title="Android Open Source Project">Android Open Source Project</a></format>
and used according to terms described in the
<format type="text/html"><a href="https://creativecommons.org/licenses/by/2.5/" title="Creative Commons 2.5 Attribution License">Creative Commons 2.5 Attribution License.</a></format></para>
</remarks>
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public MediaMuxer (string path, Android.Media.MuxerOutputType format);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string path, valuetype Android.Media.MuxerOutputType format) cil managed" />
<MemberSignature Language="DocId" Value="M:Android.Media.MediaMuxer.#ctor(System.String,Android.Media.MuxerOutputType)" />
<MemberSignature Language="F#" Value="new Android.Media.MediaMuxer : string * Android.Media.MuxerOutputType -> Android.Media.MediaMuxer" Usage="new Android.Media.MediaMuxer (path, format)" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>Mono.Android</AssemblyName>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName Language="C#">[Android.Runtime.Register(".ctor", "(Ljava/lang/String;I)V", "")]</AttributeName>
<AttributeName Language="F#">[<Android.Runtime.Register(".ctor", "(Ljava/lang/String;I)V", "")>]</AttributeName>
</Attribute>
</Attributes>
<Parameters>
<Parameter Name="path" Type="System.String" />
<Parameter Name="format" Type="Android.Media.MuxerOutputType">
<Attributes>
<Attribute>
<AttributeName Language="C#">[Android.Runtime.GeneratedEnum]</AttributeName>
<AttributeName Language="F#">[<Android.Runtime.GeneratedEnum>]</AttributeName>
</Attribute>
</Attributes>
</Parameter>
</Parameters>
<Docs>
<param name="path">The path of the output media file.</param>
<param name="format">The format of the output media file.</param>
<summary>Creates a media muxer that writes to the specified path.</summary>
<remarks>
<para>Creates a media muxer that writes to the specified path.</para>
<para>The caller must not use the file <c>path</c> before calling <c>#stop</c>.</para>
<para>
<format type="text/html">
<a href="https://developer.android.com/reference/android/media/MediaMuxer#MediaMuxer(java.lang.String,%20int)" title="Reference documentation">Java documentation for <code>android.media.MediaMuxer.MediaMuxer(java.lang.String, int)</code>.</a>
</format>
</para>
<para>
Portions of this page are modifications based on work created and shared by the
<format type="text/html"><a href="https://developers.google.com/terms/site-policies" title="Android Open Source Project">Android Open Source Project</a></format>
and used according to terms described in the
<format type="text/html"><a href="https://creativecommons.org/licenses/by/2.5/" title="Creative Commons 2.5 Attribution License">Creative Commons 2.5 Attribution License.</a></format></para>
</remarks>
<since version="Added in API level 18" />
<exception cref="T:Java.IO.IOException">if failed to open the file for write
</exception>
</Docs>
</Member>
<Member MemberName="AddTrack">
<MemberSignature Language="C#" Value="public int AddTrack (Android.Media.MediaFormat format);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance int32 AddTrack(class Android.Media.MediaFormat format) cil managed" />
<MemberSignature Language="DocId" Value="M:Android.Media.MediaMuxer.AddTrack(Android.Media.MediaFormat)" />
<MemberSignature Language="F#" Value="member this.AddTrack : Android.Media.MediaFormat -> int" Usage="mediaMuxer.AddTrack format" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>Mono.Android</AssemblyName>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName Language="C#">[Android.Runtime.Register("addTrack", "(Landroid/media/MediaFormat;)I", "")]</AttributeName>
<AttributeName Language="F#">[<Android.Runtime.Register("addTrack", "(Landroid/media/MediaFormat;)I", "")>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Int32</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="format" Type="Android.Media.MediaFormat" />
</Parameters>
<Docs>
<param name="format">The media format for the track. This must not be an empty
MediaFormat.</param>
<summary>Adds a track with the specified format.</summary>
<returns>The track index for this newly added track, and it should be used
in the <c>#writeSampleData</c>.</returns>
<remarks>
<para>Adds a track with the specified format.</para>
<para>The following table summarizes support for specific format keys across android releases.
Keys marked with '+:' are required.
<table style="width: 0%">
<thead>
<tr>
<th rowspan=2>OS Version(s)</th>
<td colspan=3><c>MediaFormat</c> keys used for</th>
</tr><tr>
<th>All Tracks</th>
<th>Audio Tracks</th>
<th>Video Tracks</th>
</tr>
</thead>
<tbody>
<tr>
<td><c>android.os.Build.VERSION_CODES#JELLY_BEAN_MR2</c></td>
<td rowspan=7>+: <c>MediaFormat#KEY_MIME</c></td>
<td rowspan=3>+: <c>MediaFormat#KEY_SAMPLE_RATE</c>,<br>
+: <c>MediaFormat#KEY_CHANNEL_COUNT</c>,<br>
+: <strong>codec-specific data<sup>AAC</sup></strong></td>
<td rowspan=5>+: <c>MediaFormat#KEY_WIDTH</c>,<br>
+: <c>MediaFormat#KEY_HEIGHT</c>,<br>
no <c>KEY_ROTATION</c>,
use <c>#setOrientationHint setOrientationHint()</c><sup>.mp4</sup>,<br>
+: <strong>codec-specific data<sup>AVC, MPEG4</sup></strong></td>
</tr><tr>
<td><c>android.os.Build.VERSION_CODES#KITKAT</c></td>
</tr><tr>
<td><c>android.os.Build.VERSION_CODES#KITKAT_WATCH</c></td>
</tr><tr>
<td><c>android.os.Build.VERSION_CODES#LOLLIPOP</c></td>
<td rowspan=4>as above, plus<br>
+: <strong>codec-specific data<sup>Vorbis & .webm</sup></strong></td>
</tr><tr>
<td><c>android.os.Build.VERSION_CODES#LOLLIPOP_MR1</c></td>
</tr><tr>
<td><c>android.os.Build.VERSION_CODES#M</c></td>
<td>as above, plus<br>
<c>MediaFormat#KEY_BIT_RATE</c><sup>AAC</sup></td>
</tr><tr>
<td><c>android.os.Build.VERSION_CODES#N</c></td>
<td>as above, plus<br>
<!-- {link MediaFormat#KEY_MAX_BIT_RATE}<sup>AAC, MPEG4</sup>,<br> -->
<c>MediaFormat#KEY_BIT_RATE</c><sup>MPEG4</sup>,<br>
<c>MediaFormat#KEY_HDR_STATIC_INFO</c><sup>#, .webm</sup>,<br>
<c>MediaFormat#KEY_COLOR_STANDARD</c><sup>#</sup>,<br>
<c>MediaFormat#KEY_COLOR_TRANSFER</c><sup>#</sup>,<br>
<c>MediaFormat#KEY_COLOR_RANGE</c><sup>#</sup>,<br>
+: <strong>codec-specific data<sup>HEVC</sup></strong>,<br>
codec-specific data<sup>VP9</sup></td>
</tr>
<tr>
<td colspan=4>
<p class=note><strong>Notes:</strong><br>
#: storing into container metadata.<br>
.mp4, .webm&hellip;: for listed containers<br>
MPEG4, AAC&hellip;: for listed codecs
</td>
</tr><tr>
<td colspan=4>
<p class=note>Note that the codec-specific data for the track must be specified using
this method. Furthermore, codec-specific data must not be passed/specified via the
<c>#writeSampleData writeSampleData()</c> call.
</td>
</tr>
</tbody>
</table></para>
<para>The following table summarizes codec support for containers across android releases:
<table style="width: 0%">
<thead>
<tr>
<th rowspan=2>OS Version(s)</th>
<td colspan=3>Codec support</th>
</tr><tr>
<th>OutputFormat#MUXER_OUTPUT_MPEG_4 MP4</th>
<th>OutputFormat#MUXER_OUTPUT_WEBM WEBM</th>
</tr>
</thead>
<tbody>
<tr>
<td><c>android.os.Build.VERSION_CODES#JELLY_BEAN_MR2</c></td>
<td rowspan=6><c>MediaFormat#MIMETYPE_AUDIO_AAC AAC</c>,<br>
<c>MediaFormat#MIMETYPE_AUDIO_AMR_NB NB-AMR</c>,<br>
<c>MediaFormat#MIMETYPE_AUDIO_AMR_WB WB-AMR</c>,<br>
<c>MediaFormat#MIMETYPE_VIDEO_H263 H.263</c>,<br>
<c>MediaFormat#MIMETYPE_VIDEO_MPEG4 MPEG-4</c>,<br>
<c>MediaFormat#MIMETYPE_VIDEO_AVC AVC</c> (H.264)</td>
<td rowspan=3>Not supported</td>
</tr><tr>
<td><c>android.os.Build.VERSION_CODES#KITKAT</c></td>
</tr><tr>
<td><c>android.os.Build.VERSION_CODES#KITKAT_WATCH</c></td>
</tr><tr>
<td><c>android.os.Build.VERSION_CODES#LOLLIPOP</c></td>
<td rowspan=3><c>MediaFormat#MIMETYPE_AUDIO_VORBIS Vorbis</c>,<br>
<c>MediaFormat#MIMETYPE_VIDEO_VP8 VP8</c></td>
</tr><tr>
<td><c>android.os.Build.VERSION_CODES#LOLLIPOP_MR1</c></td>
</tr><tr>
<td><c>android.os.Build.VERSION_CODES#M</c></td>
</tr><tr>
<td><c>android.os.Build.VERSION_CODES#N</c></td>
<td>as above, plus<br>
<c>MediaFormat#MIMETYPE_VIDEO_HEVC HEVC</c> (H.265)</td>
<td>as above, plus<br>
<c>MediaFormat#MIMETYPE_VIDEO_VP9 VP9</c></td>
</tr>
</tbody>
</table></para>
<para>
<format type="text/html">
<a href="https://developer.android.com/reference/android/media/MediaMuxer#addTrack(android.media.MediaFormat)" title="Reference documentation">Java documentation for <code>android.media.MediaMuxer.addTrack(android.media.MediaFormat)</code>.</a>
</format>
</para>
<para>
Portions of this page are modifications based on work created and shared by the
<format type="text/html"><a href="https://developers.google.com/terms/site-policies" title="Android Open Source Project">Android Open Source Project</a></format>
and used according to terms described in the
<format type="text/html"><a href="https://creativecommons.org/licenses/by/2.5/" title="Creative Commons 2.5 Attribution License">Creative Commons 2.5 Attribution License.</a></format></para>
</remarks>
<since version="Added in API level 18" />
</Docs>
</Member>
<Member MemberName="JniPeerMembers">
<MemberSignature Language="C#" Value="public override Java.Interop.JniPeerMembers JniPeerMembers { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance class Java.Interop.JniPeerMembers JniPeerMembers" />
<MemberSignature Language="DocId" Value="P:Android.Media.MediaMuxer.JniPeerMembers" />
<MemberSignature Language="F#" Value="member this.JniPeerMembers : Java.Interop.JniPeerMembers" Usage="Android.Media.MediaMuxer.JniPeerMembers" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>Mono.Android</AssemblyName>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName Language="C#">[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]</AttributeName>
<AttributeName Language="F#">[<System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)>]</AttributeName>
</Attribute>
<Attribute>
<AttributeName Language="C#">[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]</AttributeName>
<AttributeName Language="F#">[<System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>Java.Interop.JniPeerMembers</ReturnType>
</ReturnValue>
<Docs>
<summary>To be added.</summary>
<value>To be added.</value>
<remarks>
<para>Portions of this page are modifications based on work created and shared by the <format type="text/html"><a href="https://developers.google.com/terms/site-policies" title="Android Open Source Project">Android Open Source Project</a></format> and used according to terms described in the <format type="text/html"><a href="https://creativecommons.org/licenses/by/2.5/" title="Creative Commons 2.5 Attribution License">Creative Commons 2.5 Attribution License.</a></format></para>
</remarks>
</Docs>
</Member>
<Member MemberName="Release">
<MemberSignature Language="C#" Value="public void Release ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void Release() cil managed" />
<MemberSignature Language="DocId" Value="M:Android.Media.MediaMuxer.Release" />
<MemberSignature Language="F#" Value="member this.Release : unit -> unit" Usage="mediaMuxer.Release " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>Mono.Android</AssemblyName>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName Language="C#">[Android.Runtime.Register("release", "()V", "")]</AttributeName>
<AttributeName Language="F#">[<Android.Runtime.Register("release", "()V", "")>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Make sure you call this when you're done to free up any resources
instead of relying on the garbage collector to do this for you at
some point in the future.</summary>
<remarks>
<para>Make sure you call this when you're done to free up any resources
instead of relying on the garbage collector to do this for you at
some point in the future.</para>
<para>
<format type="text/html">
<a href="https://developer.android.com/reference/android/media/MediaMuxer#release()" title="Reference documentation">Java documentation for <code>android.media.MediaMuxer.release()</code>.</a>
</format>
</para>
<para>
Portions of this page are modifications based on work created and shared by the
<format type="text/html"><a href="https://developers.google.com/terms/site-policies" title="Android Open Source Project">Android Open Source Project</a></format>
and used according to terms described in the
<format type="text/html"><a href="https://creativecommons.org/licenses/by/2.5/" title="Creative Commons 2.5 Attribution License">Creative Commons 2.5 Attribution License.</a></format></para>
</remarks>
<since version="Added in API level 18" />
</Docs>
</Member>
<Member MemberName="SetLocation">
<MemberSignature Language="C#" Value="public void SetLocation (float latitude, float longitude);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void SetLocation(float32 latitude, float32 longitude) cil managed" />
<MemberSignature Language="DocId" Value="M:Android.Media.MediaMuxer.SetLocation(System.Single,System.Single)" />
<MemberSignature Language="F#" Value="member this.SetLocation : single * single -> unit" Usage="mediaMuxer.SetLocation (latitude, longitude)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>Mono.Android</AssemblyName>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName Language="C#">[Android.Runtime.Register("setLocation", "(FF)V", "")]</AttributeName>
<AttributeName Language="F#">[<Android.Runtime.Register("setLocation", "(FF)V", "")>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="latitude" Type="System.Single" />
<Parameter Name="longitude" Type="System.Single" />
</Parameters>
<Docs>
<param name="latitude">Latitude in degrees. Its value must be in the range [-90,
90].</param>
<param name="longitude">Longitude in degrees. Its value must be in the range
[-180, 180].</param>
<summary>Set and store the geodata (latitude and longitude) in the output file.</summary>
<remarks>
<para>Set and store the geodata (latitude and longitude) in the output file.
This method should be called before <c>#start</c>. The geodata is stored
in udta box if the output format is
<c>OutputFormat#MUXER_OUTPUT_MPEG_4</c>, and is ignored for other output
formats. The geodata is stored according to ISO-6709 standard.</para>
<para>
<format type="text/html">
<a href="https://developer.android.com/reference/android/media/MediaMuxer#setLocation(float,%20float)" title="Reference documentation">Java documentation for <code>android.media.MediaMuxer.setLocation(float, float)</code>.</a>
</format>
</para>
<para>
Portions of this page are modifications based on work created and shared by the
<format type="text/html"><a href="https://developers.google.com/terms/site-policies" title="Android Open Source Project">Android Open Source Project</a></format>
and used according to terms described in the
<format type="text/html"><a href="https://creativecommons.org/licenses/by/2.5/" title="Creative Commons 2.5 Attribution License">Creative Commons 2.5 Attribution License.</a></format></para>
</remarks>
<since version="Added in API level 19" />
<exception cref="T:Java.Lang.IllegalArgumentException">If the given latitude or longitude is out
of range.</exception>
<exception cref="T:Java.Lang.IllegalStateException">If this method is called after <see cref="M:Android.Media.MediaMuxer.Start" />.
</exception>
</Docs>
</Member>
<Member MemberName="SetOrientationHint">
<MemberSignature Language="C#" Value="public void SetOrientationHint (int degrees);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void SetOrientationHint(int32 degrees) cil managed" />
<MemberSignature Language="DocId" Value="M:Android.Media.MediaMuxer.SetOrientationHint(System.Int32)" />
<MemberSignature Language="F#" Value="member this.SetOrientationHint : int -> unit" Usage="mediaMuxer.SetOrientationHint degrees" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>Mono.Android</AssemblyName>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName Language="C#">[Android.Runtime.Register("setOrientationHint", "(I)V", "")]</AttributeName>
<AttributeName Language="F#">[<Android.Runtime.Register("setOrientationHint", "(I)V", "")>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="degrees" Type="System.Int32" />
</Parameters>
<Docs>
<param name="degrees">the angle to be rotated clockwise in degrees.
The supported angles are 0, 90, 180, and 270 degrees.</param>
<summary>Sets the orientation hint for output video playback.</summary>
<remarks>
<para>Sets the orientation hint for output video playback.</para>
<para>This method should be called before <c>#start</c>. Calling this
method will not rotate the video frame when muxer is generating the file,
but add a composition matrix containing the rotation angle in the output
video if the output format is
<c>OutputFormat#MUXER_OUTPUT_MPEG_4</c> so that a video player can
choose the proper orientation for playback. Note that some video players
may choose to ignore the composition matrix in a video during playback.
By default, the rotation degree is 0.</para>
<para>
<format type="text/html">
<a href="https://developer.android.com/reference/android/media/MediaMuxer#setOrientationHint(int)" title="Reference documentation">Java documentation for <code>android.media.MediaMuxer.setOrientationHint(int)</code>.</a>
</format>
</para>
<para>
Portions of this page are modifications based on work created and shared by the
<format type="text/html"><a href="https://developers.google.com/terms/site-policies" title="Android Open Source Project">Android Open Source Project</a></format>
and used according to terms described in the
<format type="text/html"><a href="https://creativecommons.org/licenses/by/2.5/" title="Creative Commons 2.5 Attribution License">Creative Commons 2.5 Attribution License.</a></format></para>
</remarks>
<since version="Added in API level 18" />
</Docs>
</Member>
<Member MemberName="Start">
<MemberSignature Language="C#" Value="public void Start ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void Start() cil managed" />
<MemberSignature Language="DocId" Value="M:Android.Media.MediaMuxer.Start" />
<MemberSignature Language="F#" Value="member this.Start : unit -> unit" Usage="mediaMuxer.Start " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>Mono.Android</AssemblyName>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName Language="C#">[Android.Runtime.Register("start", "()V", "")]</AttributeName>
<AttributeName Language="F#">[<Android.Runtime.Register("start", "()V", "")>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Starts the muxer.</summary>
<remarks>
<para>Starts the muxer.</para>
<para>Make sure this is called after <c>#addTrack</c> and before
<c>#writeSampleData</c>.</para>
<para>
<format type="text/html">
<a href="https://developer.android.com/reference/android/media/MediaMuxer#start()" title="Reference documentation">Java documentation for <code>android.media.MediaMuxer.start()</code>.</a>
</format>
</para>
<para>
Portions of this page are modifications based on work created and shared by the
<format type="text/html"><a href="https://developers.google.com/terms/site-policies" title="Android Open Source Project">Android Open Source Project</a></format>
and used according to terms described in the
<format type="text/html"><a href="https://creativecommons.org/licenses/by/2.5/" title="Creative Commons 2.5 Attribution License">Creative Commons 2.5 Attribution License.</a></format></para>
</remarks>
<since version="Added in API level 18" />
</Docs>
</Member>
<Member MemberName="Stop">
<MemberSignature Language="C#" Value="public void Stop ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void Stop() cil managed" />
<MemberSignature Language="DocId" Value="M:Android.Media.MediaMuxer.Stop" />
<MemberSignature Language="F#" Value="member this.Stop : unit -> unit" Usage="mediaMuxer.Stop " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>Mono.Android</AssemblyName>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName Language="C#">[Android.Runtime.Register("stop", "()V", "")]</AttributeName>
<AttributeName Language="F#">[<Android.Runtime.Register("stop", "()V", "")>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Stops the muxer.</summary>
<remarks>
<para>Stops the muxer.</para>
<para>Once the muxer stops, it can not be restarted.</para>
<para>
<format type="text/html">
<a href="https://developer.android.com/reference/android/media/MediaMuxer#stop()" title="Reference documentation">Java documentation for <code>android.media.MediaMuxer.stop()</code>.</a>
</format>
</para>
<para>
Portions of this page are modifications based on work created and shared by the
<format type="text/html"><a href="https://developers.google.com/terms/site-policies" title="Android Open Source Project">Android Open Source Project</a></format>
and used according to terms described in the
<format type="text/html"><a href="https://creativecommons.org/licenses/by/2.5/" title="Creative Commons 2.5 Attribution License">Creative Commons 2.5 Attribution License.</a></format></para>
</remarks>
<since version="Added in API level 18" />
</Docs>
</Member>
<Member MemberName="ThresholdClass">
<MemberSignature Language="C#" Value="protected override IntPtr ThresholdClass { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance native int ThresholdClass" />
<MemberSignature Language="DocId" Value="P:Android.Media.MediaMuxer.ThresholdClass" />
<MemberSignature Language="F#" Value="member this.ThresholdClass : nativeint" Usage="Android.Media.MediaMuxer.ThresholdClass" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>Mono.Android</AssemblyName>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName Language="C#">[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]</AttributeName>
<AttributeName Language="F#">[<System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)>]</AttributeName>
</Attribute>
<Attribute>
<AttributeName Language="C#">[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]</AttributeName>
<AttributeName Language="F#">[<System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.IntPtr</ReturnType>
</ReturnValue>
<Docs>
<summary>This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.</summary>
<value>A <see cref="T:System.IntPtr" /> which contains the <c>java.lang.Class</c> JNI value corresponding to this type.</value>
<remarks>
<para>Portions of this page are modifications based on work created and shared by the <format type="text/html"><a href="https://developers.google.com/terms/site-policies" title="Android Open Source Project">Android Open Source Project</a></format> and used according to terms described in the <format type="text/html"><a href="https://creativecommons.org/licenses/by/2.5/" title="Creative Commons 2.5 Attribution License">Creative Commons 2.5 Attribution License.</a></format></para>
</remarks>
</Docs>
</Member>
<Member MemberName="ThresholdType">
<MemberSignature Language="C#" Value="protected override Type ThresholdType { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.Type ThresholdType" />
<MemberSignature Language="DocId" Value="P:Android.Media.MediaMuxer.ThresholdType" />
<MemberSignature Language="F#" Value="member this.ThresholdType : Type" Usage="Android.Media.MediaMuxer.ThresholdType" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>Mono.Android</AssemblyName>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName Language="C#">[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]</AttributeName>
<AttributeName Language="F#">[<System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)>]</AttributeName>
</Attribute>
<Attribute>
<AttributeName Language="C#">[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]</AttributeName>
<AttributeName Language="F#">[<System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Type</ReturnType>
</ReturnValue>
<Docs>
<summary>This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.</summary>
<value>A <see cref="T:System.Type" /> which provides the declaring type.</value>
<remarks>
<para>Portions of this page are modifications based on work created and shared by the <format type="text/html"><a href="https://developers.google.com/terms/site-policies" title="Android Open Source Project">Android Open Source Project</a></format> and used according to terms described in the <format type="text/html"><a href="https://creativecommons.org/licenses/by/2.5/" title="Creative Commons 2.5 Attribution License">Creative Commons 2.5 Attribution License.</a></format></para>
</remarks>
</Docs>
</Member>
<Member MemberName="WriteSampleData">
<MemberSignature Language="C#" Value="public void WriteSampleData (int trackIndex, Java.Nio.ByteBuffer byteBuf, Android.Media.MediaCodec.BufferInfo bufferInfo);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void WriteSampleData(int32 trackIndex, class Java.Nio.ByteBuffer byteBuf, class Android.Media.MediaCodec/BufferInfo bufferInfo) cil managed" />
<MemberSignature Language="DocId" Value="M:Android.Media.MediaMuxer.WriteSampleData(System.Int32,Java.Nio.ByteBuffer,Android.Media.MediaCodec.BufferInfo)" />
<MemberSignature Language="F#" Value="member this.WriteSampleData : int * Java.Nio.ByteBuffer * Android.Media.MediaCodec.BufferInfo -> unit" Usage="mediaMuxer.WriteSampleData (trackIndex, byteBuf, bufferInfo)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>Mono.Android</AssemblyName>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName Language="C#">[Android.Runtime.Register("writeSampleData", "(ILjava/nio/ByteBuffer;Landroid/media/MediaCodec$BufferInfo;)V", "")]</AttributeName>
<AttributeName Language="F#">[<Android.Runtime.Register("writeSampleData", "(ILjava/nio/ByteBuffer;Landroid/media/MediaCodec$BufferInfo;)V", "")>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="trackIndex" Type="System.Int32" />
<Parameter Name="byteBuf" Type="Java.Nio.ByteBuffer" />
<Parameter Name="bufferInfo" Type="Android.Media.MediaCodec+BufferInfo" />
</Parameters>
<Docs>
<param name="trackIndex">The track index for this sample.</param>
<param name="byteBuf">The encoded sample.</param>
<param name="bufferInfo">The buffer information related to this sample.</param>
<summary>Writes an encoded sample into the muxer.</summary>
<remarks>
<para>
<format type="text/html">
<a href="https://developer.android.com/reference/android/media/MediaMuxer#writeSampleData(int,%20java.nio.ByteBuffer,%20android.media.BufferInfo)" title="Reference documentation">Java documentation for <code>android.media.MediaMuxer.writeSampleData(int, java.nio.ByteBuffer, android.media.BufferInfo)</code>.</a>
</format>
</para>
<para>
Portions of this page are modifications based on work created and shared by the
<format type="text/html"><a href="https://developers.google.com/terms/site-policies" title="Android Open Source Project">Android Open Source Project</a></format>
and used according to terms described in the
<format type="text/html"><a href="https://creativecommons.org/licenses/by/2.5/" title="Creative Commons 2.5 Attribution License">Creative Commons 2.5 Attribution License.</a></format></para>
</remarks>
<since version="Added in API level 18" />
</Docs>
</Member>
</Members>
</Type>