-
Notifications
You must be signed in to change notification settings - Fork 19
/
bmxtranswrap.cpp
4997 lines (4659 loc) · 229 KB
/
bmxtranswrap.cpp
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
/*
* Copyright (C) 2011, British Broadcasting Corporation
* All Rights Reserved.
*
* Author: Philip de Nier
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the British Broadcasting Corporation nor the names
* of its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#define __STDC_FORMAT_MACROS
#define __STDC_LIMIT_MACROS
#include <cstdio>
#include <cstring>
#include <cerrno>
#include <limits.h>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include "MXFInputTrack.h"
#include "../writers/OutputTrack.h"
#include "../writers/TrackMapper.h"
#include <bmx/mxf_reader/MXFFileReader.h>
#include <bmx/mxf_reader/MXFGroupReader.h>
#include <bmx/mxf_reader/MXFSequenceReader.h>
#include <bmx/mxf_reader/MXFFrameMetadata.h>
#include <bmx/mxf_reader/MXFTimedTextTrackReader.h>
#include <bmx/essence_parser/SoundConversion.h>
#include <bmx/essence_parser/MPEG2AspectRatioFilter.h>
#include <bmx/mxf_helper/RDD36MXFDescriptorHelper.h>
#include <bmx/clip_writer/ClipWriter.h>
#include <bmx/as02/AS02PictureTrack.h>
#include <bmx/wave/WaveFileIO.h>
#include <bmx/wave/WaveChunk.h>
#include <bmx/st436/ST436Element.h>
#include <bmx/st436/RDD6Metadata.h>
#include <bmx/URI.h>
#include <bmx/MXFHTTPFile.h>
#include <bmx/MXFUtils.h>
#include <bmx/Utils.h>
#include <bmx/Version.h>
#include <bmx/as11/AS11Labels.h>
#include <bmx/as10/AS10ShimNames.h>
#include <bmx/as10/AS10MPEG2Validator.h>
#include <bmx/as10/AS10RDD9Validator.h>
#include <bmx/apps/AppMCALabelHelper.h>
#include <bmx/apps/AppMXFFileFactory.h>
#include <bmx/apps/AppUtils.h>
#include <bmx/apps/AS11Helper.h>
#include <bmx/apps/AS10Helper.h>
#include <bmx/BMXException.h>
#include <bmx/Logging.h>
#include <mxf/mxf_avid.h>
using namespace std;
using namespace bmx;
using namespace mxfpp;
#define DEFAULT_GF_RETRIES 10
#define DEFAULT_GF_RETRY_DELAY 1.0
#define DEFAULT_GF_RATE_AFTER_FAIL 1.5
#define DEFAULT_ST436_MANIFEST_COUNT 2
typedef struct
{
UL scheme_id;
const char *lang;
const char *filename;
} EmbedXMLInfo;
typedef struct
{
const char *position_str;
AvidLocator locator;
} LocatorOption;
static const char APP_NAME[] = "bmxtranswrap";
static const char DEFAULT_SHIM_NAME[] = "Sample File";
static const char DEFAULT_SHIM_ID[] = "http://bbc.co.uk/rd/as02/default-shim.txt";
static const char DEFAULT_SHIM_ANNOTATION[] = "Default AS-02 shim";
static const char DEFAULT_BEXT_ORIGINATOR[] = "bmx";
static const uint32_t DEFAULT_RW_INTL_SIZE = (64 * 1024);
static const uint16_t DEFAULT_RDD6_LINES[2] = {9, 572}; /* ST 274, line 9 field 1 and 2 */
static const uint8_t DEFAULT_RDD6_SDID = 4; /* first channel pair is 5/6 */
static const uint32_t DEFAULT_HTTP_MIN_READ = 1024 * 1024;
namespace bmx
{
extern bool BMX_REGRESSION_TEST;
};
static bool regtest_output_track_map_comp(const TrackMapper::OutputTrackMap &left,
const TrackMapper::OutputTrackMap &right)
{
return left.data_def < right.data_def;
}
static bool filter_anc_manifest_element(const ANCManifestElement *element, set<ANCDataType> &filter)
{
set<ANCDataType>::const_iterator iter;
for (iter = filter.begin(); iter != filter.end(); iter++) {
if (*iter == ALL_ANC_DATA) {
return true;
} else if (*iter == ST2020_ANC_DATA) {
if (element->did == 0x45)
return true;
} else if (*iter == ST2016_ANC_DATA) {
if (element->did == 0x41 && (element->sdid == 0x05 || element->sdid == 0x06))
return true;
} else if (*iter == RDD8_SDP_ANC_DATA) {
if (element->did == 0x43 && element->sdid == 0x02)
return true;
} else if (*iter == ST12M_ANC_DATA) {
if (element->did == 0x60 && element->sdid == 0x60)
return true;
} else if (*iter == ST334_ANC_DATA) {
if ((element->did == 0x61 && (element->sdid == 0x01 || element->sdid == 0x02)) ||
(element->did == 0x62 && (element->sdid == 0x02)))
{
return true;
}
}
}
return false;
}
static bool filter_anc_manifest(const MXFDataTrackInfo *data_info, set<ANCDataType> &filter)
{
size_t i;
for (i = 0; i < data_info->anc_manifest.size(); i++) {
if (filter_anc_manifest_element(&data_info->anc_manifest[i], filter))
return true;
}
return false;
}
static uint32_t calc_st2020_max_size(bool sample_coding_10bit, uint32_t line_count)
{
// The maximum ANC packet size is limited by the Data Count (DC) byte and equals
// DID (1) + SDID (1) + DC (1) + UDW (255) + CS (1) = 259 samples
// The ST 436 payload byte array data must be padded to a UInt32 boundary and therefore the
// max size is 260 samples for 8-bit sample coding. For 10-bit encoding 3 samples are stored
// in 4 bytes with 2 padding bits
uint32_t max_array_size;
if (sample_coding_10bit)
max_array_size = (259 + 2) / 3 * 4;
else
max_array_size = 260;
// A maximum of 2 ANC packets are required for an audio program metadata frame
// The maximum number of packets per video frame is 2
// Method B: 2 packets if video frame rate <= 30 Hz; Method A: 2 packets if audio metadata exceeds max packet size
// ST 436 ANC element starts with a 2 byte packet count followed by (14 byte header + array data) for each packet
return 2 + line_count * 2 * (14 + max_array_size);
}
static uint32_t calc_st2020_max_size(const MXFDataTrackInfo *data_info)
{
// The SDID identifies the first channel pair in the audio program
// Assume the audio program count equals the number of unique SDID values
// Also check for 10-bit sample coding
bool sample_coding_10bit = false;
set<uint8_t> sdids;
size_t i;
for (i = 0; i < data_info->anc_manifest.size(); i++) {
if (data_info->anc_manifest[i].did == 0x45) {
sdids.insert(data_info->anc_manifest[i].sdid);
if (data_info->anc_manifest[i].sample_coding == ANC_10_BIT_COMP_LUMA ||
data_info->anc_manifest[i].sample_coding == ANC_10_BIT_COMP_COLOR ||
data_info->anc_manifest[i].sample_coding == ANC_10_BIT_COMP_LUMA_COLOR)
{
sample_coding_10bit = true;
}
}
}
if (sdids.empty()) {
log_warn("Unable to calculate the maximum ANC frame element data size for ST 2020 because extracted manifest "
"includes no ST 2020 data");
return 0;
}
return calc_st2020_max_size(sample_coding_10bit, (uint32_t)sdids.size());
}
static void construct_anc_rdd6_sub_frame(RDD6MetadataFrame *rdd6_frame,
bool is_first_sub_frame,
bmx::ByteArray *rdd6_buffer,
uint8_t sdid, uint16_t line_number,
bmx::ByteArray *anc_buffer)
{
rdd6_buffer->SetSize(0);
rdd6_frame->ConstructST2020(rdd6_buffer, sdid, is_first_sub_frame);
ST436Element output_element(false);
ST436Line line(false);
line.wrapping_type = VANC_FRAME;
line.payload_sample_coding = ANC_8_BIT_COMP_LUMA;
line.line_number = line_number;
line.payload_sample_count = rdd6_buffer->GetSize();
line.payload_data = rdd6_buffer->GetBytes();
line.payload_size = rdd6_buffer->GetSize(); // alignment left to ST436Element::Construct
output_element.lines.push_back(line);
anc_buffer->SetSize(0);
output_element.Construct(anc_buffer);
}
static void construct_anc_rdd6(RDD6MetadataFrame *rdd6_frame,
bmx::ByteArray *rdd6_first_buffer, bmx::ByteArray *rdd6_second_buffer,
uint8_t sdid, uint16_t *line_numbers,
bmx::ByteArray *anc_buffer)
{
rdd6_first_buffer->SetSize(0);
rdd6_second_buffer->SetSize(0);
rdd6_frame->ConstructST2020(rdd6_first_buffer, sdid, true);
rdd6_frame->ConstructST2020(rdd6_second_buffer, sdid, false);
ST436Element output_element(false);
ST436Line line(false);
line.wrapping_type = VANC_FRAME;
line.payload_sample_coding = ANC_8_BIT_COMP_LUMA;
line.line_number = line_numbers[0];
line.payload_sample_count = rdd6_first_buffer->GetSize();
line.payload_data = rdd6_first_buffer->GetBytes();
line.payload_size = rdd6_first_buffer->GetSize(); // alignment left to ST436Element::Construct
output_element.lines.push_back(line);
line.line_number = line_numbers[1];
line.payload_sample_count = rdd6_second_buffer->GetSize();
line.payload_data = rdd6_second_buffer->GetBytes();
line.payload_size = rdd6_second_buffer->GetSize(); // alignment left to ST436Element::Construct
output_element.lines.push_back(line);
anc_buffer->SetSize(0);
output_element.Construct(anc_buffer);
}
static uint32_t read_samples(MXFReader *reader, const vector<uint32_t> &sample_sequence,
uint32_t *sample_sequence_offset, uint32_t max_samples_per_read)
{
uint32_t num_read;
if (max_samples_per_read == 1) {
uint32_t num_frame_samples = sample_sequence[*sample_sequence_offset];
*sample_sequence_offset = (*sample_sequence_offset + 1) % sample_sequence.size();
num_read = reader->Read(num_frame_samples);
if (num_read != num_frame_samples)
num_read = 0;
} else {
BMX_ASSERT(sample_sequence.size() == 1 && sample_sequence[0] == 1);
num_read = reader->Read(max_samples_per_read);
}
return num_read;
}
static void write_anc_samples(OutputTrack *output_track, Frame *frame, set<ANCDataType> &filter, bmx::ByteArray &anc_buffer)
{
BMX_CHECK(frame->num_samples == 1);
if (filter.empty() || (filter.size() == 1 && (*filter.begin()) == ALL_ANC_DATA)) {
output_track->WriteSamples(0, (unsigned char*)frame->GetBytes(), frame->GetSize(), frame->num_samples);
return;
}
ST436Element input_element(false);
input_element.Parse(frame->GetBytes(), frame->GetSize());
ST436Element output_element(false);
size_t i;
for (i = 0; i < input_element.lines.size(); i++) {
ANCManifestElement manifest_element;
manifest_element.Parse(&input_element.lines[i]);
if (filter_anc_manifest_element(&manifest_element, filter))
output_element.lines.push_back(input_element.lines[i]);
}
anc_buffer.SetSize(0);
output_element.Construct(&anc_buffer);
output_track->WriteSamples(0, anc_buffer.GetBytes(), anc_buffer.GetSize(), 1);
}
static void disable_tracks(MXFReader *reader, const set<size_t> &track_indexes,
bool disable_audio, bool disable_video, bool disable_data)
{
size_t i;
for (i = 0; i < reader->GetNumTrackReaders(); i++) {
if (track_indexes.count(i) ||
(disable_audio && reader->GetTrackReader(i)->GetTrackInfo()->data_def == MXF_SOUND_DDEF) ||
(disable_video && reader->GetTrackReader(i)->GetTrackInfo()->data_def == MXF_PICTURE_DDEF) ||
(disable_data && reader->GetTrackReader(i)->GetTrackInfo()->data_def == MXF_DATA_DDEF))
{
reader->GetTrackReader(i)->SetEnable(false);
}
}
}
EssenceType process_assumed_essence_type(const MXFTrackInfo *input_track_info, EssenceType assume_d10_essence_type)
{
// Map the essence type if generic MPEG video is assumed to be D-10
if (assume_d10_essence_type != UNKNOWN_ESSENCE_TYPE &&
(input_track_info->essence_type == PICTURE_ESSENCE ||
input_track_info->essence_type == MPEG2LG_422P_ML_576I) &&
(mxf_is_mpeg_video_ec(&input_track_info->essence_container_label, 1) ||
mxf_is_mpeg_video_ec(&input_track_info->essence_container_label, 0)))
{
return assume_d10_essence_type;
}
else
{
return input_track_info->essence_type;
}
}
static void usage_ref(const char *cmd)
{
fprintf(stderr, "%s\n", get_app_version_info(APP_NAME).c_str());
fprintf(stderr, "Run '%s -h' to show detailed commandline usage.\n", strip_path(cmd).c_str());
fprintf(stderr, "\n");
}
static void usage(const char *cmd)
{
printf("%s\n", get_app_version_info(APP_NAME).c_str());
printf("Re-wrap from one MXF file to another MXF file\n");
printf("\n");
printf("Usage: %s <<Options>> [<<Input Options>> <mxf input>]+\n", strip_path(cmd).c_str());
printf(" Use <mxf input> '-' for standard input\n");
printf("Options (* means option is required):\n");
printf(" -h | --help Show usage and exit\n");
printf(" -v | --version Print version info\n");
printf(" -p Print progress percentage to stdout\n");
printf(" -l <file> Log filename. Default log to stderr/stdout\n");
printf(" --log-level <level> Set the log level. 0=debug, 1=info, 2=warning, 3=error. Default is 1\n");
printf(" -t <type> Clip type: as02, as11op1a, as11d10, as11rdd9, op1a, avid, d10, rdd9, as10, wave, imf. Default is op1a\n");
printf("* -o <name> as02: <name> is a bundle name\n");
printf(" as11op1a/as11d10/op1a/d10/rdd9/as10/wave: <name> is a filename or filename pattern (see Notes at the end)\n");
printf(" avid: <name> is a filename prefix\n");
printf(" --ess-type-names <names> A comma separated list of 4 names for video, audio, data or mixed essence types\n");
printf(" The names can be used to replace {type} in output filename patterns\n");
printf(" The default names are: video,audio,data,mixed\n");
printf(" --prod-info <cname>\n");
printf(" <pname>\n");
printf(" <ver>\n");
printf(" <verstr>\n");
printf(" <uid>\n");
printf(" Set the product info in the MXF Identification set\n");
printf(" <cname> is a string and is the Company Name property\n");
printf(" <pname> is a string and is the Product Name property\n");
printf(" <ver> has format '<major>.<minor>.<patch>.<build>.<release>' and is the Product Version property. Set to '0.0.0.0.0' to omit it\n");
printf(" <verstr> is a string and is the Version String property\n");
printf(" <uid> is a UUID (see Notes at the end) and is the Product UID property\n");
printf(" --create-date <tstamp> Set the creation date in the MXF Identification set. Default is 'now'\n");
printf(" --input-file-md5 Calculate an MD5 checksum of the input file\n");
printf(" -y <hh:mm:sscff> Override input start timecode. Default 00:00:00:00\n");
printf(" The c character in the pattern should be ':' for non-drop frame; any other character indicates drop frame\n");
printf(" --mtc Check first and use the input material package start timecode if present\n");
printf(" --fstc Check first and use the file source package timecode if present\n");
printf(" --pstc Check first and use the physical source package timecode if present\n");
printf(" --tc-rate <rate> Start timecode rate to use when input is audio only\n");
printf(" The <rate> is either 'num', 'num'/'den', 23976 (=24000/1001), 2997 (=30000/1001) or 5994 (=60000/1001)\n");
printf(" --clip <name> Set the clip name\n");
printf(" --start <count> Set the start in input edit rate units. Default is 0\n");
printf(" --dur <count> Set the duration in input edit rate units. Default is minimum input duration\n");
printf(" --check-end Check at the start that the last (start + duration - 1) edit unit can be read\n");
printf(" --check-end-tolerance <frame> Allow output duration shorter than input declared duration\n");
printf(" --check-complete Check that the input file structure can be read and is complete\n");
printf(" --group Use the group reader instead of the sequence reader\n");
printf(" Use this option if the files have different material packages\n");
printf(" but actually belong to the same virtual package / group\n");
printf(" --no-reorder Don't attempt to order the inputs in a sequence\n");
printf(" Use this option for files with broken timecode\n");
printf(" --rt <factor> Transwrap at realtime rate x <factor>, where <factor> is a floating point value\n");
printf(" <factor> value 1.0 results in realtime rate, value < 1.0 slower and > 1.0 faster\n");
printf(" --gf Support growing files. Retry reading a frame when it fails\n");
printf(" --gf-retries <max> Set the maximum times to retry reading a frame. The default is %u.\n", DEFAULT_GF_RETRIES);
printf(" --gf-delay <sec> Set the delay (in seconds) between a failure to read and a retry. The default is %f.\n", DEFAULT_GF_RETRY_DELAY);
printf(" --gf-rate <factor> Limit the read rate to realtime rate x <factor> after a read failure. The default is %f\n", DEFAULT_GF_RATE_AFTER_FAIL);
printf(" <factor> value 1.0 results in realtime rate, value < 1.0 slower and > 1.0 faster\n");
printf(" --disable-indexing-file Use this option to stop the reader creating an index of the partitions and essence positions in the file up front\n");
printf(" This option can be used to avoid indexing files containing many partitions\n");
if (mxf_http_is_supported()) {
printf(" --http-min-read <bytes>\n");
printf(" Set the minimum number of bytes to read when accessing a file over HTTP. The default is %u.\n", DEFAULT_HTTP_MIN_READ);
printf(" --http-disable-seek Disable seeking when reading file over HTTP\n");
}
printf(" --no-precharge Don't output clip/track with precharge. Adjust the start position and duration instead\n");
printf(" --no-rollout Don't output clip/track with rollout. Adjust the duration instead\n");
printf(" --rw-intl Interleave input reads with output writes\n");
printf(" --rw-intl-size The interleave size. Default is %u\n", DEFAULT_RW_INTL_SIZE);
printf(" Value must be a multiple of the system page size, %u\n", mxf_get_system_page_size());
#if defined(_WIN32)
printf(" --seq-scan Set the sequential scan hint for optimizing file caching whilst reading\n");
#if !defined(__MINGW32__)
printf(" --mmap-file Use memory-mapped file I/O for the MXF files\n");
printf(" Note: this may reduce file I/O performance and was found to be slower over network drives\n");
#endif
#endif
printf(" --avcihead <format> <file> <offset>\n");
printf(" Default AVC-Intra sequence header data (512 bytes) to use when the input file does not have it\n");
printf(" <format> is a comma separated list of one or more of the following integer values:\n");
size_t i;
for (i = 0; i < get_num_avci_header_formats(); i++)
printf(" %2" PRIszt ": %s\n", i, get_avci_header_format_string(i));
printf(" or set <format> to 'all' for all formats listed above\n");
printf(" The 512 bytes are extracted from <file> starting at <offset> bytes\n");
printf(" and incrementing 512 bytes for each format in the list\n");
printf(" --ps-avcihead Panasonic AVC-Intra sequence header data for Panasonic-compatible files that don't include the header data\n");
printf(" These formats are supported:\n");
for (i = 0; i < get_num_ps_avci_header_formats(); i++) {
if (i == 0)
printf(" ");
else if (i % 4 == 0)
printf(",\n ");
else
printf(", ");
printf("%s", get_ps_avci_header_format_string(i));
}
printf("\n");
printf(" -a <n:d> Override or set the image aspect ratio\n");
printf(" --bsar Set image aspect ratio in video bitstream. Currently supports D-10 essence types only\n");
printf(" --vc2-mode <mode> Set the mode that determines how the VC-2 data is wrapped\n");
printf(" <mode> is one of the following integer values:\n");
printf(" 0: Passthrough input, but add a sequence header if not present, remove duplicate/redundant sequence headers\n");
printf(" and fix any incorrect parse info offsets and picture numbers\n");
printf(" 1: (default) Same as 0, but remove auxiliary and padding data units and complete the sequence in each frame\n");
printf(" --locked <bool> Override or set flag indicating whether the number of audio samples is locked to the video. Either true or false\n");
printf(" --audio-ref <level> Override or set audio reference level, number of dBm for 0VU\n");
printf(" --dial-norm <value> Override or set gain to be applied to normalize perceived loudness of the clip\n");
printf(" --ref-image-edit-rate <rate> Override or set the Reference Image Edit Rate\n");
printf(" The <rate> is either 'num', 'num'/'den', 23976 (=24000/1001), 2997 (=30000/1001) or 5994 (=60000/1001)\n");
printf(" --ref-audio-align-level <value> Override or set the Reference Audio Alignment Level\n");
printf(" --signal-std <value> Override or set the video signal standard. The <value> is one of the following:\n");
printf(" 'none', 'bt601', 'bt1358', 'st347', 'st274', 'st296', 'st349', 'st428'\n");
printf(" --frame-layout <value> Override or set the video frame layout. The <value> is one of the following:\n");
printf(" 'fullframe', 'separatefield', 'singlefield', 'mixedfield', 'segmentedframe'\n");
printf(" --field-dom <value> Override or set which field is first in temporal order. The <value> is 1 or 2\n");
printf(" --video-line-map <value> Override or set the video line map. The <value> is 2 line numbers separated by a comma\n");
printf(" --transfer-ch <value> Override or set the transfer characteristic label\n");
printf(" The <value> is a SMPTE UL, formatted as a 'urn:smpte:ul:...' or one of the following:\n");
printf(" 'bt470', 'bt709', 'st240', 'st274', 'bt1361', 'linear', 'dcdm',\n");
printf(" 'iec61966', 'bt2020', 'st2084', 'hlg'\n");
printf(" --coding-eq <value> Override or set the coding equations label\n");
printf(" The <value> is a SMPTE UL, formatted as a 'urn:smpte:ul:...' or one of the following:\n");
printf(" 'bt601', 'bt709', 'st240', 'ycgco', 'gbr', 'bt2020'\n");
printf(" --color-prim <value> Override or set the color primaries label\n");
printf(" The <value> is a SMPTE UL, formatted as a 'urn:smpte:ul:...' or one of the following:\n");
printf(" 'st170', 'bt470', 'bt709', 'bt2020', 'dcdm', 'p3'\n");
printf(" --color-siting <value> Override or set the color siting. The <value> is one of the following:\n");
printf(" 'cositing', 'horizmp', '3tap', 'quincunx', 'bt601', 'linealt', 'vertmp', 'unknown'\n");
printf(" (Note that 'bt601' is deprecated in SMPTE ST 377-1. Use 'cositing' instead)\n");
printf(" --black-level <value> Override or set the black reference level\n");
printf(" --white-level <value> Override or set the white reference level\n");
printf(" --color-range <value> Override or set the color range\n");
printf(" --comp-max-ref <value> Override or set the RGBA component maximum reference level\n");
printf(" --comp-min-ref <value> Override or set the RGBA component minimum reference level\n");
printf(" --scan-dir <value> Override or set the RGBA scanning direction\n");
printf(" --display-primaries <value> Override or set the mastering display primaries.\n");
printf(" The <value> is an array of 6 unsigned integers separated by a ','.\n");
printf(" --display-white-point <value> Override or set the mastering display white point chromaticity.\n");
printf(" The <value> is an array of 2 unsigned integers separated by a ','.\n");
printf(" --display-max-luma <value> Override or set the mastering display maximum luminance.\n");
printf(" --display-min-luma <value> Override or set the mastering display minimum luminance.\n");
printf(" --rdd36-opaque Override and treat RDD-36 4444 or 4444 XQ as opaque by omitting the Alpha Sample Depth property\n");
printf(" --rdd36-comp-depth <value> Override of set component depth for RDD-36. Defaults to 10 if not present in input file\n");
printf(" --active-width Override or set the Active Width of the active area rectangle\n");
printf(" --active-height Override or set the Active Height of the active area rectangle\n");
printf(" --active-x-offset Override or set the Active X Offset of the active area rectangle\n");
printf(" --active-y-offset Override or set the Active Y Offset of the active area rectangle\n");
printf(" --display-f2-offset Override or set the default Display F2 Offset if it is not extracted from the essence\n");
printf(" --center-cut-4-3 Override or add the Alternative Center Cut 4:3\n");
printf(" --center-cut-14-9 Override or add the Alternative Center Cut 14:9\n");
printf(" --ignore-input-desc Don't use input MXF file descriptor properties to fill in missing information\n");
printf(" --track-map <expr> Map input audio channels to output tracks\n");
printf(" The default is 'mono', except if --clip-wrap option is set for op1a it is 'singlemca'\n");
printf(" See below for details of the <expr> format\n");
printf(" --dump-track-map Dump the output audio track map to stderr.\n");
printf(" The dumps consists of a list output tracks, where each output track channel\n");
printf(" is shown as '<output track channel> <- <input channel>\n");
printf(" --dump-track-map-exit Same as --dump-track-map, but exit immediately afterwards\n");
printf(" --assume-d10-30 Assume a generic MPEG video elementary stream is actually D-10 30\n");
printf(" --assume-d10-40 Assume a generic MPEG video elementary stream is actually D-10 40\n");
printf(" --assume-d10-50 Assume a generic MPEG video elementary stream is actually D-10 50\n");
printf("\n");
printf(" as11op1a/as11d10/as11rdd9/op1a/rdd9/d10:\n");
printf(" --head-fill <bytes> Reserve minimum <bytes> at the end of the header metadata using a KLV Fill\n");
printf(" Add a 'K' suffix for kibibytes and 'M' for mibibytes\n");
printf("\n");
printf(" as02:\n");
printf(" --mic-type <type> Media integrity check type: 'md5' or 'none'. Default 'md5'\n");
printf(" --mic-file Calculate checksum for entire essence component file. Default is essence only\n");
printf(" --shim-name <name> Set ShimName element value in shim.xml file to <name>. Default is '%s'\n", DEFAULT_SHIM_NAME);
printf(" --shim-id <id> Set ShimID element value in shim.xml file to <id>. Default is '%s'\n", DEFAULT_SHIM_ID);
printf(" --shim-annot <str> Set AnnotationText element value in shim.xml file to <str>. Default is '%s'\n", DEFAULT_SHIM_ANNOTATION);
printf("\n");
printf(" as02/as11op1a/op1a/rdd9/as10:\n");
printf(" --part <interval> Video essence partition interval in frames in input edit rate units, or (floating point) seconds with 's' suffix. Default single partition\n");
printf("\n");
printf(" as11op1a/as11d10/as11rdd9:\n");
printf(" --dm <fwork> <name> <value> Set descriptive framework property. <fwork> is 'as11' or 'dpp'\n");
printf(" --dm-file <fwork> <name> Parse and set descriptive framework properties from text file <name>. <fwork> is 'as11' or 'dpp'\n");
printf(" --seg <name> Parse and set segmentation data from text file <name>\n");
printf(" --pass-dm Copy descriptive metadata from the input file. The metadata can be overidden by other options\n");
printf(" --norm-pass-dm Same as --pass-dm, but also normalise strings to always have a null terminator. This is a workaround for products that fail to handle zero size string properties.\n");
printf(" --spec-id <id> Set the AS-11 specification identifier labels associated with <id>\n");
printf(" The <id> is one of the following:\n");
printf(" as11-x1 : AMWA AS-11 X1, delivery of finished UHD programs to Digital Production Partnership (DPP) broadcasters\n");
printf(" as11-x2 : AMWA AS-11 X2, delivery of finished HD AVC Intra programs to a broadcaster or publisher\n");
printf(" as11-x3 : AMWA AS-11 X3, delivery of finished HD AVC Long GOP programs to a broadcaster or publisher\n");
printf(" as11-x4 : AMWA AS-11 X4, delivery of finished HD AVC Long GOP programs to a broadcaster or publisher\n");
printf(" as11-x5 : AMWA AS-11 X5, delivery of finished UHD TV Commericals and Promotions to UK Digital Production Partnership (DPP) broadcasters\n");
printf(" as11-x6 : AMWA AS-11 X6, delivery of finished HD TV Commercials and Promotions to UK Digital Production Partnership (DPP) broadcasters\n");
printf(" as11-x7 : AMWA AS-11 X7, delivery of finished SD D10 programs to a broadcaster or publisher\n");
printf(" as11-x8 : AMWA AS-11 X8, delivery of finished HD (MPEG-2) programs to North American Broadcasters Association (NABA) broadcasters\n");
printf(" as11-x9 : AMWA AS-11 X9, delivery of finished HD TV Programmes (AVC) to North American Broadcasters Association (NABA) broadcasters\n");
printf("\n");
printf(" as02/as11op1a/as11d10/op1a/d10/rdd9/as10:\n");
printf(" --afd <value> Active Format Descriptor 4-bit code from table 1 in SMPTE ST 2016-1. Default is input file's value or not set\n");
printf("\n");
printf(" as11op1a/as11d10/op1a/d10/rdd9/as10:\n");
printf(" --single-pass Write file in a single pass\n");
printf(" Header and body partitions will be incomplete for as11op1a/op1a if the number if essence container bytes per edit unit is variable\n");
printf(" --file-md5 Calculate an MD5 checksum of the output file. This requires writing in a single pass (--single-pass is assumed)\n");
printf("\n");
printf(" as11op1a/op1a:\n");
printf(" --pass-anc <filter> Pass through ST 436 ANC data tracks\n");
printf(" <filter> is a comma separated list of ANC data types to pass through\n");
printf(" The following ANC data types are supported in <filter>:\n");
printf(" all : pass through all ANC data\n");
printf(" st2020 : SMPTE ST 2020 / RDD 6 audio metadata\n");
printf(" st2016 : SMPTE ST 2016-3/ AFD, bar and pan-scan data\n");
printf(" sdp : SMPTE RDD 8 / OP-47 Subtitling Distribution Packet data\n");
printf(" st12 : SMPTE ST 12 Ancillary timecode\n");
printf(" st334 : SMPTE ST 334-1 EIA 708B, EIA 608 and data broadcast (DTV)\n");
printf(" --pass-vbi Pass through ST 436 VBI data tracks\n");
printf(" --st436-mf <count> Set the <count> of frames to examine for ST 436 ANC/VBI manifest info. Default is %u\n", DEFAULT_ST436_MANIFEST_COUNT);
printf(" The manifest is used at the start to determine whether an output ANC data track is created\n");
printf(" Set <count> to 0 to always create an ANC data track if the input has one\n");
printf(" --anc-const <size> Use to indicate that the ST 436 ANC frame element data, excl. key and length, has a constant <size>. A variable size is assumed by default\n");
printf(" --anc-max <size> Use to indicate that the ST 436 ANC frame element data, excl. key and length, has a maximum <size>. A variable size is assumed by default\n");
printf(" --st2020-max The ST 436 ANC maximum frame element data size for ST 2020 only is calculated from the extracted manifest. Option '--pass-anc st2020' is required.\n");
printf(" --vbi-const <size> Use to indicate that the ST 436 VBI frame element data, excl. key and length, has a constant <size>. A variable size is assumed by default\n");
printf(" --vbi-max <size> Use to indicate that the ST 436 VBI frame element data, excl. key and length, has a maximum <size>. A variable size is assumed by default\n");
printf(" --rdd6 <file> Add ST 436 ANC data track containing 'static' RDD-6 audio metadata from XML <file>\n");
printf(" The timecode fields are ignored, i.e. they are set to 'undefined' values in the RDD-6 metadata stream\n");
printf(" --rdd6-lines <lines> A single or pair of line numbers, using ',' as the separator, for carriage of the RDD-6 ANC data. The default is a pair of numbers, '%u,%u'\n", DEFAULT_RDD6_LINES[0], DEFAULT_RDD6_LINES[1]);
printf(" --rdd6-sdid <sdid> The SDID value indicating the first audio channel pair associated with the RDD-6 data. Default is %u\n", DEFAULT_RDD6_SDID);
printf("\n");
printf(" op1a/rdd9/d10:\n");
printf(" --xml-scheme-id <id> Set the XML payload scheme identifier associated with the following --embed-xml option.\n");
printf(" The <id> is one of the following:\n");
printf(" * a SMPTE UL, formatted as a 'urn:smpte:ul:...',\n");
printf(" * a UUID, formatted as a 'urn:uuid:...'or as 32 hexadecimal characters using a '.' or '-' seperator,\n");
printf(" * 'as11', which corresponds to urn:smpte:ul:060e2b34.04010101.0d010801.04010000\n");
printf(" A default BMX scheme identifier is used if this option is not provided\n");
printf(" --xml-lang <tag> Set the RFC 5646 language tag associated with the the following --embed-xml option.\n");
printf(" Defaults to the xml:lang attribute in the root element or empty string if not present\n");
printf(" --embed-xml <filename> Embed the XML from <filename> using the approach specified in SMPTE RP 2057\n");
printf(" If the XML size is less than 64KB and uses UTF-8 or UTF-16 encoding (declared in\n");
printf(" the XML prolog) then the XML data is included in the header metadata. Otherwise\n");
printf(" a Generic Stream partition is used to hold the XML data.\n");
printf("\n");
printf(" op1a:\n");
printf(" --no-tc-track Don't create a timecode track in either the material or file source package\n");
printf(" --min-part Only use a header and footer MXF file partition. Use this for applications that don't support\n");
printf(" separate partitions for header metadata, index tables, essence container data and footer\n");
printf(" --body-part Create separate body partitions for essence data\n");
printf(" and don't create separate body partitions for index table segments\n");
printf(" --clip-wrap Use clip wrapping for a single sound track\n");
printf(" --mp-track-num Use the material package track number property to define a track order. By default the track number is set to 0\n");
printf(" --aes-3 Use AES-3 audio mapping\n");
printf(" --kag-size-512 Set KAG size to 512, instead of 1\n");
printf(" --system-item Add system item\n");
printf(" --primary-package Set the header metadata set primary package property to the top-level file source package\n");
printf(" --index-follows The index partition follows the essence partition, even when it is CBE essence\n");
printf(" --st379-2 Add ContainerConstraintsSubDescriptor to signal compliance with ST 379-2, MXF Constrained Generic Container\n");
printf(" The sub-descriptor will be added anyway if there is RDD 36 video present\n");
printf("\n");
printf(" op1a/rdd9:\n");
printf(" --ard-zdf-hdf Use the ARD ZDF HDF profile\n");
printf(" --repeat-index Repeat the index table segments in the footer partition\n");
printf("\n");
printf(" op1a/d10:\n");
printf(" --cbe-index-duration-0 Use duration=0 if index table is CBE\n");
printf("\n");
printf(" as10:\n");
printf(" --shim-name <name> Shim name for AS10 (used for setting 'ShimName' metadata and setting video/sound parameters' checks)\n");
printf(" list of known shims: %s\n", get_as10_shim_names().c_str());
printf(" --dm-file as10 <name> Parse and set descriptive framework properties from text file <name>\n");
printf(" N.B. 'ShimName' is the only mandatary property of AS10 metadata set\n");
printf(" --dm as10 <name> <value> Set descriptive framework property\n");
printf(" --pass-dm Copy descriptive metadata from the input file. The metadata can be overidden by other options\n");
printf(" --mpeg-checks [<name>] Enable AS-10 compliancy checks. The file <name> is optional and contains expected descriptor values\n");
printf(" --loose-checks Don't stop processing on detected compliancy violations\n");
printf(" --print-checks Print default values of mpeg descriptors and report on descriptors either found in mpeg headers or copied from mxf headers\n");
printf(" --max-same-warnings <value> Max same violations warnings logged, default 3\n");
printf("\n");
printf(" as11d10/d10:\n");
printf(" --d10-mute <flags> Indicate using a string of 8 '0' or '1' which sound channels should be muted. The lsb is the rightmost digit\n");
printf(" --d10-invalid <flags> Indicate using a string of 8 '0' or '1' which sound channels should be flagged invalid. The lsb is the rightmost digit\n");
printf("\n");
printf(" as11op1a/as11d10/op1a/d10/rdd9/as10:\n");
printf(" --mp-uid <umid> Set the Material Package UID. Autogenerated by default\n");
printf(" --fp-uid <umid> Set the File Package UID. Autogenerated by default\n");
printf("\n");
printf(" avid:\n");
printf(" --project <name> Set the Avid project name\n");
printf(" --tape <name> Source tape name\n");
printf(" --import <name> Source import name. <name> is one of the following:\n");
printf(" - a file URL starting with 'file://'\n");
printf(" - an absolute Windows (starts with '[A-Z]:') or *nix (starts with '/') filename\n");
printf(" - a relative filename, which will be converted to an absolute filename\n");
printf(" --comment <string> Add 'Comments' user comment to the MaterialPackage\n");
printf(" --desc <string> Add 'Descript' user comment to the MaterialPackage\n");
printf(" --tag <name> <value> Add <name> user comment to the MaterialPackage. Option can be used multiple times\n");
printf(" --locator <position> <comment> <color>\n");
printf(" Add locator at <position> with <comment> and <color>\n");
printf(" <position> format is o?hh:mm:sscff, where the optional 'o' indicates it is an offset\n");
printf(" --umid-type <type> Set the UMID type that is generated for the Package UID properties.\n");
printf(" The default <type> is 'aafsdk'.\n");
printf(" The <type> is one of the following:\n");
printf(" uuid : UUID generation method\n");
printf(" aafsdk : same method as implemented in the AAF SDK\n");
printf(" This type is required to be compatible with some older Avid product versions\n");
printf(" Note: this is not guaranteed to create a unique UMID when used in multiple processes\n");
printf(" old-aafsdk : same method as implemented in revision 1.47 of AAF/ref-impl/src/impl/AAFUtils.c in the AAF SDK\n");
printf(" Note: this is not guaranteed to create a unique UMID when used in multiple processes\n");
printf(" --mp-uid <umid> Set the Material Package UID. Autogenerated by default\n");
printf(" --mp-created <tstamp> Set the Material Package creation date. Default is 'now'\n");
printf(" --psp-uid <umid> Set the tape/import Source Package UID\n");
printf(" tape: autogenerated by default\n");
printf(" import: single input Material Package UID or autogenerated by default\n");
printf(" --psp-created <tstamp> Set the tape/import Source Package creation date. Default is 'now'\n");
printf(" --ess-marks Convert XDCAM Essence Marks to locators\n");
printf(" --allow-no-avci-head Allow inputs with no AVCI header (512 bytes, sequence and picture parameter sets)\n");
printf(" --avid-gf Use the Avid growing file flavour\n");
printf(" --avid-gf-dur <dur> Set the duration which should be shown whilst the file is growing\n");
printf(" The default value is the output duration\n");
printf(" --ignore-d10-aes3-flags Ignore D10 AES3 audio validity flags and assume they are all valid\n");
printf(" This workarounds an issue with Avid transfer manager which sets channel flags 4 to 8 to invalid\n");
printf("\n");
printf(" op1a/avid:\n");
printf(" --force-no-avci-head Strip AVCI header (512 bytes, sequence and picture parameter sets) if present\n");
printf("\n");
printf(" wave:\n");
printf(" --orig <name> Set originator in the Wave bext chunk. Default '%s'\n", DEFAULT_BEXT_ORIGINATOR);
printf(" --exclude-wave-chunks <ids> Don't transfer non-builtin or <chna> Wave chunks with ID in the comma-separated list of chunk <ids>\n");
printf(" Set <ids> to 'all' to exclude all Wave chunks\n");
printf("\n");
printf(" as02/op1a/as11op1a:\n");
printf(" --use-avc-subdesc Use the AVC sub-descriptor rather than the MPEG video descriptor for AVC-Intra tracks\n");
printf("\n");
printf(" op1a/as11op1a/rdd9:\n");
printf(" --audio-layout <label> Set the Wave essence descriptor channel assignment label which identifies the audio layout mode in operation\n");
printf(" The <label> is one of the following:\n");
printf(" * a SMPTE UL, formatted as a 'urn:smpte:ul:...',\n");
printf(" * 'as11-mode-0', which corresponds to urn:smpte:ul:060e2b34.04010101.0d010801.02010000,\n");
printf(" * 'as11-mode-1', which corresponds to urn:smpte:ul:060e2b34.04010101.0d010801.02020000,\n");
printf(" * 'as11-mode-2', which corresponds to urn:smpte:ul:060e2b34.04010101.0d010801.02030000\n");
printf(" * 'imf', which corresponds to urn:smpte:ul:060e2b34.0401010d.04020210.04010000\n");
printf(" * 'adm', which corresponds to urn:smpte:ul:060e2b34.0401010d.04020210.05010000\n");
printf(" --track-mca-labels <scheme> <file> Insert audio labels defined in <file>. The 'as11' <scheme> will add an override and otherwise <scheme> is ignored\n");
printf(" The format of <file> is described in bmx/docs/mca_labels_format.md\n");
printf(" All tag symbols registered in the bmx code are available for use\n");
printf(" The 'as11' <scheme> will change the label associated with the 'chVIN' tag symbol to use the 'Visually Impaired Narrative' tag name, i.e. without a '-'\n");
printf("\n");
printf("Input options:\n");
printf(" --disable-tracks <tracks> A comma separated list of track indexes and/or ranges to disable.\n");
printf(" A track is identified by the index reported by mxf2raw\n");
printf(" A range of track indexes is specified as '<first>-<last>', e.g. 0-3\n");
printf(" --disable-audio Disable audio tracks\n");
printf(" --disable-video Disable video tracks\n");
printf(" --disable-data Disable data tracks\n");
printf("\n\n");
printf("Notes:\n");
printf(" - filename pattern: Clip types producing a single output file may use a filename pattern with variables that get substituted\n");
printf(" Pattern variables start with a '{' and end with a '}'. E.g. 'output_{type}_{fp_uuid}.mxf'\n");
printf(" The following variables are available:\n");
printf(" - {type}: Is replaced with the name for video, audio, data or mixed essence types\n");
printf(" See the --ess-type-names option for the default names and use the option to change them\n");
printf(" - {mp_uuid}: The UUID material number in a material package UMID\n");
printf(" The clip writers will by default generate UMIDs with UUID material numbers\n");
printf(" - {mp_umid}: The material package UMID\n");
printf(" - {fp_uuid}: The UUID material number in a file source package UMID\n");
printf(" The clip writers will by default generate UMIDs with UUID material numbers\n");
printf(" - {fp_umid}: The file source package UMID\n");
printf(" At least one letter in a variable name can also be in uppercase, which will result in\n");
printf(" the corresponding substituted value being in uppercase.\n");
printf(" - <umid> format is 64 hexadecimal characters and any '.' and '-' characters are ignored\n");
printf(" - <uuid> format is 32 hexadecimal characters and any '.' and '-' characters are ignored\n");
printf(" - <tstamp> format is YYYY-MM-DDThh:mm:ss:qm where qm is in units of 1/250th second\n");
printf("\n");
printf(" The track mapping <expr> format is one of the following:\n");
printf(" 'mono' : each input audio channel is mapped to a single-channel output track\n");
printf(" 'stereo' : input audio channels are paired to stereo-channel output tracks\n");
printf(" A silence channel is added to the last output track if the channel count is odd\n");
printf(" 'singlemca': all input audio channels are mapped to a single multi-channel output track\n");
printf(" <pattern> : a pattern defining how input channels map to output track channels - see below\n");
printf("\n");
printf(" The track mapping <pattern> specifies how input audio channels are mapped to output track channels\n");
printf(" A <pattern> consists of a list of <group>s separated by a ';'.\n");
printf(" A <group> starts with an optional 'm', followed by a list of <element> separated by a ','.\n");
printf(" An 'm' indicates that each channel in the <group> is mapped to separate single-channel output track.\n");
printf(" If an 'm' is not present then the channels are mapped to a single output track.\n");
printf(" A <element> is either a <channel>, <range>, <silence> or <remainder>.\n");
printf(" A <channel> is an input channel number starting from 0.\n");
printf(" The input channel number is the number derived from the input track order reported by mxf2raw for the\n");
printf(" input files in the same order and including any --disable input options. Each channel in a track\n");
printf(" contributes 1 to the overall channel number.\n");
printf(" A <range> is 2 <channel>s separated by a '-' and includes all channels starting with the first number\n");
printf(" and ending with the last number.\n");
printf(" A <silence> is 's' followed by a <count> and results in <count> silence channels added to the output track.\n");
printf(" A <remainder> is 'x', and results in all remaining channels being added to the output track.\n");
printf("\n");
printf("Here are some <pattern> examples:\n");
printf(" 'mx' : equivalent to 'mono'\n");
printf(" '0,1;x' : the first 2 channels mapped to a stereo output track and all remaining channels mapped\n");
printf(" to a single multi-channel track\n");
printf(" '2-7;0,1': 6 channel output track followed by a 2 channel output track\n");
printf(" '0,1,s2' : 2 input channels plus 2 silence channels mapped to a single output track\n");
}
int main(int argc, const char** argv)
{
Rational timecode_rate = FRAME_RATE_25;
bool timecode_rate_set = false;
vector<const char *> input_filenames;
map<size_t, set<size_t> > disable_track_indexes;
map<size_t, bool> disable_audio;
map<size_t, bool> disable_video;
map<size_t, bool> disable_data;
const char *log_filename = 0;
LogLevel log_level = INFO_LOG;
ClipWriterType clip_type = CW_OP1A_CLIP_TYPE;
ClipSubType clip_sub_type = NO_CLIP_SUB_TYPE;
bool ard_zdf_hdf_profile = false;
bool aes3 = false;
bool kag_size_512 = false;
bool op1a_system_item = false;
bool op1a_primary_package = false;
bool op1a_index_follows = false;
bool st379_2 = false;
AS10Shim as10_shim = AS10_UNKNOWN_SHIM;
const char *output_name = "";
map<EssenceType, string> filename_essence_type_names;
Timecode start_timecode;
const char *start_timecode_str = 0;
bool use_mtc = false;
bool use_fstc = false;
bool use_pstc = false;
int64_t start = 0;
bool start_set = false;
int64_t duration = -1;
bool check_end = false;
int check_end_tolerance = 0;
bool check_complete = false;
const char *clip_name = 0;
MICType mic_type = MD5_MIC_TYPE;
MICScope ess_component_mic_scope = ESSENCE_ONLY_MIC_SCOPE;
const char *partition_interval_str = 0;
int64_t partition_interval = 0;
bool partition_interval_set = false;
const char *shim_name = 0;
const char *shim_id = 0;
const char *shim_annot = 0;
const char *project_name = 0;
const char *tape_name = 0;
const char *import_name = 0;
map<string, string> user_comments;
vector<LocatorOption> locators;
AS11Helper as11_helper;
AS10Helper as10_helper;
const char *mpeg_descr_defaults_name = 0;
bool mpeg_descr_frame_checks = false;
bool as10_loose_checks = false;
int max_mpeg_check_same_warn_messages = 3;
bool print_mpeg_checks = false;
bool pass_dm = false;
const char *segmentation_filename = 0;
bool do_print_version = false;
bool use_group_reader = false;
bool keep_input_order = false;
BMX_OPT_PROP_DECL_DEF(uint8_t, user_afd, 0);
vector<AVCIHeaderInput> avci_header_inputs;
bool show_progress = false;
bool single_pass = false;
bool output_file_md5 = false;
BMX_OPT_PROP_DECL_DEF(Rational, user_aspect_ratio, ASPECT_RATIO_16_9);
bool set_bs_aspect_ratio = false;
BMX_OPT_PROP_DECL_DEF(bool, user_locked, false);
BMX_OPT_PROP_DECL_DEF(int8_t, user_audio_ref_level, 0);
BMX_OPT_PROP_DECL_DEF(int8_t, user_dial_norm, 0);
BMX_OPT_PROP_DECL_DEF(MXFSignalStandard, user_signal_standard, MXF_SIGNAL_STANDARD_NONE);
BMX_OPT_PROP_DECL_DEF(MXFFrameLayout, user_frame_layout, MXF_FULL_FRAME);
BMX_OPT_PROP_DECL_DEF(uint8_t, user_field_dominance, 1);
BMX_OPT_PROP_DECL_DEF(mxfVideoLineMap, user_video_line_map, g_Null_Video_Line_Map);
BMX_OPT_PROP_DECL_DEF(mxfUL, user_transfer_ch, g_Null_UL);
BMX_OPT_PROP_DECL_DEF(mxfUL, user_coding_equations, g_Null_UL);
BMX_OPT_PROP_DECL_DEF(mxfUL, user_color_primaries, g_Null_UL);
BMX_OPT_PROP_DECL_DEF(MXFColorSiting, user_color_siting, MXF_COLOR_SITING_UNKNOWN);
BMX_OPT_PROP_DECL_DEF(uint32_t, user_black_ref_level, 0);
BMX_OPT_PROP_DECL_DEF(uint32_t, user_white_ref_level, 0);
BMX_OPT_PROP_DECL_DEF(uint32_t, user_color_range, 0);
BMX_OPT_PROP_DECL_DEF(uint32_t, user_comp_max_ref, 0);
BMX_OPT_PROP_DECL_DEF(uint32_t, user_comp_min_ref, 0);
BMX_OPT_PROP_DECL_DEF(uint8_t, user_scan_dir, 0);
BMX_OPT_PROP_DECL_DEF(mxfThreeColorPrimaries, user_display_primaries, g_Null_Three_Color_Primaries);
BMX_OPT_PROP_DECL_DEF(mxfColorPrimary, user_display_white_point, g_Null_Color_Primary);
BMX_OPT_PROP_DECL_DEF(uint32_t, user_display_max_luma, 0);
BMX_OPT_PROP_DECL_DEF(uint32_t, user_display_min_luma, 0);
BMX_OPT_PROP_DECL_DEF(bool, user_rdd36_opaque, false);
BMX_OPT_PROP_DECL_DEF(uint32_t, user_rdd36_component_depth, 10);
BMX_OPT_PROP_DECL_DEF(uint32_t, user_active_width, 0);
BMX_OPT_PROP_DECL_DEF(uint32_t, user_active_height, 0);
BMX_OPT_PROP_DECL_DEF(uint32_t, user_active_x_offset, 0);
BMX_OPT_PROP_DECL_DEF(uint32_t, user_active_y_offset, 0);
BMX_OPT_PROP_DECL_DEF(int32_t, user_display_f2_offset, 0);
BMX_OPT_PROP_DECL_DEF(bool, user_center_cut_4_3, false);
BMX_OPT_PROP_DECL_DEF(bool, user_center_cut_14_9, false);
BMX_OPT_PROP_DECL_DEF(mxfRational, user_ref_image_edit_rate, g_Null_Rational);
BMX_OPT_PROP_DECL_DEF(int8_t, user_ref_audio_align_level, 0);
bool ignore_input_desc = false;
bool input_file_md5 = false;
int input_file_flags = 0;
bool no_precharge = false;
bool no_rollout = false;
bool rw_interleave = false;
uint32_t rw_interleave_size = DEFAULT_RW_INTL_SIZE;
uint32_t system_page_size = mxf_get_system_page_size();
uint8_t d10_mute_sound_flags = 0;
uint8_t d10_invalid_sound_flags = 0;
const char *originator = DEFAULT_BEXT_ORIGINATOR;
set<WaveChunkId> exclude_wave_chunks;
bool exclude_all_wave_chunks = false;
AvidUMIDType avid_umid_type = AAFSDK_UMID_TYPE;
UMID mp_uid = g_Null_UMID;
bool mp_uid_set = false;
Timestamp mp_created;
bool mp_created_set = false;
UMID fp_uid = g_Null_UMID;
bool fp_uid_set = false;
UMID psp_uid = g_Null_UMID;
bool psp_uid_set = false;
Timestamp psp_created;
bool psp_created_set = false;
bool convert_ess_marks = false;
bool allow_no_avci_head = false;
bool force_no_avci_head = false;
bool no_tc_track = false;
bool min_part = false;
bool body_part = false;
bool repeat_index = false;
bool cbe_index_duration_0 = false;
bool op1a_clip_wrap = false;
bool realtime = false;
float rt_factor = 1.0;
bool growing_file = false;
unsigned int gf_retries = DEFAULT_GF_RETRIES;
float gf_retry_delay = DEFAULT_GF_RETRY_DELAY;
float gf_rate_after_fail = DEFAULT_GF_RATE_AFTER_FAIL;
bool enable_indexing_file = true;
bool product_info_set = false;
string company_name;
string product_name;
mxfProductVersion product_version;
string version_string;
UUID product_uid;
Timestamp creation_date;
bool creation_date_set = false;
bool ps_avcihead = false;
bool replace_avid_avcihead = false;
bool avid_gf = false;
int64_t avid_gf_duration = -1;
set<ANCDataType> pass_anc;
bool pass_vbi = false;
uint32_t st436_manifest_count = DEFAULT_ST436_MANIFEST_COUNT;
uint32_t anc_const_size = 0;
uint32_t anc_max_size = 0;
bool st2020_max_size = false;
uint32_t vbi_const_size = 0;
uint32_t vbi_max_size = 0;
const char *rdd6_filename = 0;
uint16_t rdd6_lines[2] = {DEFAULT_RDD6_LINES[0], DEFAULT_RDD6_LINES[1]};
uint8_t rdd6_sdid = DEFAULT_RDD6_SDID;
uint32_t http_min_read = DEFAULT_HTTP_MIN_READ;
bool http_enable_seek = true;
bool mp_track_num = false;
#if defined(_WIN32) && !defined(__MINGW32__)
bool use_mmap_file = false;
#endif
vector<EmbedXMLInfo> embed_xml;
EmbedXMLInfo next_embed_xml;
bool ignore_d10_aes3_flags = false;
TrackMapper track_mapper;
bool track_map_set = false;
bool dump_track_map = false;
bool dump_track_map_exit = false;
vector<pair<string, string> > track_mca_labels;
bool use_avc_subdesc = false;
UL audio_layout_mode_label = g_Null_UL;
BMX_OPT_PROP_DECL_DEF(uint32_t, head_fill, 0);
int vc2_mode_flags;
mxfThreeColorPrimaries three_color_primaries;
mxfColorPrimary color_primary;
EssenceType assume_d10_essence_type = UNKNOWN_ESSENCE_TYPE;
int value, num, den;
unsigned int uvalue;
int64_t i64value;
Rational rate;
bool msvc_block_limit;
int cmdln_index;
memset(&next_embed_xml, 0, sizeof(next_embed_xml));
parse_vc2_mode("1", &vc2_mode_flags);
parse_essence_type_names("video,audio,data,mixed", &filename_essence_type_names);
if (argc == 1) {
usage(argv[0]);
return 0;
}
for (cmdln_index = 1; cmdln_index < argc; cmdln_index++)
{
msvc_block_limit = false;
if (strcmp(argv[cmdln_index], "--help") == 0 ||
strcmp(argv[cmdln_index], "-h") == 0)
{
usage(argv[0]);
return 0;
}
else if (strcmp(argv[cmdln_index], "--version") == 0 ||
strcmp(argv[cmdln_index], "-v") == 0)
{
if (argc == 2) {
printf("%s\n", get_app_version_info(APP_NAME).c_str());
return 0;
}
do_print_version = true;
}
else if (strcmp(argv[cmdln_index], "-p") == 0)
{
show_progress = true;
}
else if (strcmp(argv[cmdln_index], "-l") == 0)
{
if (cmdln_index + 1 >= argc)
{
usage_ref(argv[0]);
fprintf(stderr, "Missing argument for Option '%s'\n", argv[cmdln_index]);
return 1;
}
log_filename = argv[cmdln_index + 1];