-
Notifications
You must be signed in to change notification settings - Fork 513
/
main.c
5271 lines (4961 loc) · 182 KB
/
main.c
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
/*
* GPAC - Multimedia Framework C SDK
*
* Authors: Jean Le Feuvre
* Copyright (c) Telecom ParisTech 2000-2012
* All rights reserved
*
* This file is part of GPAC / mp4box application
*
* GPAC is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* GPAC is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#include <gpac/download.h>
#include <gpac/network.h>
#include <gpac/utf.h>
#ifndef GPAC_DISABLE_SMGR
#include <gpac/scene_manager.h>
#endif
#ifdef GPAC_DISABLE_ISOM
#error "Cannot compile MP4Box if GPAC is not built with ISO File Format support"
#else
#if defined(WIN32) && !defined(_WIN32_WCE)
#include <io.h>
#include <fcntl.h>
#endif
#include <gpac/media_tools.h>
/*RTP packetizer flags*/
#ifndef GPAC_DISABLE_STREAMING
#include <gpac/ietf.h>
#endif
#ifndef GPAC_DISABLE_MCRYPT
#include <gpac/ismacryp.h>
#endif
#include <gpac/constants.h>
#include <gpac/internal/mpd.h>
#include <time.h>
#define BUFFSIZE 8192
#define DEFAULT_INTERLEAVING_IN_SEC 0.5
/*in fileimport.c*/
#ifndef GPAC_DISABLE_MEDIA_IMPORT
void convert_file_info(char *inName, u32 trackID);
#endif
#ifndef GPAC_DISABLE_ISOM_WRITE
GF_Err import_file(GF_ISOFile *dest, char *inName, u32 import_flags, Double force_fps, u32 frames_per_sample);
GF_Err split_isomedia_file(GF_ISOFile *mp4, Double split_dur, u64 split_size_kb, char *inName, Double interleaving_time, Double chunk_start, Bool adjust_split_end, char *outName, const char *tmpdir);
GF_Err cat_isomedia_file(GF_ISOFile *mp4, char *fileName, u32 import_flags, Double force_fps, u32 frames_per_sample, char *tmp_dir, Bool force_cat, Bool align_timelines, Bool allow_add_in_command);
#if !defined(GPAC_DISABLE_SCENE_ENCODER)
GF_Err EncodeFile(char *in, GF_ISOFile *mp4, GF_SMEncodeOptions *opts, FILE *logs);
GF_Err EncodeFileChunk(char *chunkFile, char *bifs, char *inputContext, char *outputContext, const char *tmpdir);
#endif
GF_ISOFile *package_file(char *file_name, char *fcc, const char *tmpdir, Bool make_wgt);
#endif
GF_Err dump_isom_cover_art(GF_ISOFile *file, char *inName, Bool is_final_name);
GF_Err dump_isom_chapters(GF_ISOFile *file, char *inName, Bool is_final_name, Bool dump_ogg);
void dump_isom_udta(GF_ISOFile *file, char *inName, Bool is_final_name, u32 dump_udta_type, u32 dump_udta_track);
GF_Err set_file_udta(GF_ISOFile *dest, u32 tracknum, u32 udta_type, char *src, Bool is_box_array);
u32 id3_get_genre_tag(const char *name);
/*in filedump.c*/
#ifndef GPAC_DISABLE_SCENE_DUMP
GF_Err dump_isom_scene(char *file, char *inName, Bool is_final_name, GF_SceneDumpFormat dump_mode, Bool do_log);
//void gf_check_isom_files(char *conf_rules, char *inName);
#endif
#ifndef GPAC_DISABLE_SCENE_STATS
void dump_isom_scene_stats(char *file, char *inName, Bool is_final_name, u32 stat_level);
#endif
void PrintNode(const char *name, u32 graph_type);
void PrintBuiltInNodes(u32 graph_type);
void PrintBuiltInBoxes();
#ifndef GPAC_DISABLE_ISOM_DUMP
GF_Err dump_isom_xml(GF_ISOFile *file, char *inName, Bool is_final_name, Bool do_track_dump);
#endif
#ifndef GPAC_DISABLE_ISOM_HINTING
#ifndef GPAC_DISABLE_ISOM_DUMP
void dump_isom_rtp(GF_ISOFile *file, char *inName, Bool is_final_name);
#endif
void dump_isom_sdp(GF_ISOFile *file, char *inName, Bool is_final_name);
#endif
void dump_isom_timestamps(GF_ISOFile *file, char *inName, Bool is_final_name);
void dump_isom_nal(GF_ISOFile *file, u32 trackID, char *inName, Bool is_final_name);
#ifndef GPAC_DISABLE_ISOM_DUMP
void dump_isom_ismacryp(GF_ISOFile *file, char *inName, Bool is_final_name);
void dump_isom_timed_text(GF_ISOFile *file, u32 trackID, char *inName, Bool is_final_name, Bool is_convert, GF_TextDumpType dump_type);
#endif /*GPAC_DISABLE_ISOM_DUMP*/
void DumpTrackInfo(GF_ISOFile *file, u32 trackID, Bool full_dump);
void DumpMovieInfo(GF_ISOFile *file);
void PrintLanguages();
#ifndef GPAC_DISABLE_MPEG2TS
void dump_mpeg2_ts(char *mpeg2ts_file, char *pes_out_name, Bool prog_num);
#endif
#if !defined(GPAC_DISABLE_STREAMING) && !defined(GPAC_DISABLE_SENG)
void PrintStreamerUsage();
int stream_file_rtp(int argc, char **argv);
int live_session(int argc, char **argv);
void PrintLiveUsage();
#endif
#if !defined(GPAC_DISABLE_STREAMING)
u32 grab_live_m2ts(const char *grab_m2ts, const char *ifce_name, const char *outName);
#endif
int mp4boxTerminal(int argc, char **argv);
u32 quiet = 0;
Bool dvbhdemux = GF_FALSE;
Bool keep_sys_tracks = GF_FALSE;
/*some global vars for swf import :(*/
u32 swf_flags = 0;
Float swf_flatten_angle = 0;
s32 laser_resolution = 0;
typedef struct {
u32 code;
const char *name;
const char *comment;
} itunes_tag;
static const itunes_tag itags[] = {
{GF_ISOM_ITUNE_ALBUM_ARTIST, "album_artist", "usage: album_artist=album artist"},
{GF_ISOM_ITUNE_ALBUM, "album", "usage: album=name" },
{GF_ISOM_ITUNE_TRACKNUMBER, "tracknum", "usage: track=x/N"},
{GF_ISOM_ITUNE_TRACK, "track", "usage: track=name"},
{GF_ISOM_ITUNE_ARTIST, "artist", "usage: artist=name"},
{GF_ISOM_ITUNE_COMMENT, "comment", "usage: comment=any comment"},
{GF_ISOM_ITUNE_COMPILATION, "compilation", "usage: compilation=yes,no"},
{GF_ISOM_ITUNE_COMPOSER, "composer", "usage: composer=name"},
{GF_ISOM_ITUNE_CREATED, "created", "usage: created=time"},
{GF_ISOM_ITUNE_DISK, "disk", "usage: disk=x/N"},
{GF_ISOM_ITUNE_TOOL, "tool", "usage: tool=name"},
{GF_ISOM_ITUNE_GENRE, "genre", "usage: genre=name"},
{GF_ISOM_ITUNE_NAME, "name", "usage: name=name"},
{GF_ISOM_ITUNE_TEMPO, "tempo", "usage: tempo=integer"},
{GF_ISOM_ITUNE_WRITER, "writer", "usage: writer=name"},
{GF_ISOM_ITUNE_GROUP, "group", "usage: group=name"},
{GF_ISOM_ITUNE_COVER_ART, "cover", "usage: cover=file.jpg,file.png"},
{GF_ISOM_ITUNE_ENCODER, "encoder", "usage: encoder=name"},
{GF_ISOM_ITUNE_GAPLESS, "gapless", "usage: gapless=yes,no"},
{GF_ISOM_ITUNE_ALL, "all", "usage: all=NULL"},
};
u32 nb_itunes_tags = sizeof(itags) / sizeof(itunes_tag);
void PrintVersion()
{
fprintf(stderr, "MP4Box - GPAC version " GPAC_FULL_VERSION "\n"
"GPAC Copyright (c) Telecom ParisTech 2000-2012\n"
"GPAC Configuration: " GPAC_CONFIGURATION "\n"
"Features: %s\n", gpac_features());
}
void PrintGeneralUsage()
{
fprintf(stderr, "General Options:\n"
#ifdef GPAC_MEMORY_TRACKING
" -mem-track: enables memory tracker\n"
" -mem-track-stack: enables memory tracker with stack dumping\n"
#endif
" -strict-error exits after the first error is reported\n"
" -inter time_in_ms interleaves file data (track chunks of time_in_ms)\n"
" * Note 1: Interleaving is 0.5s by default\n"
" * Note 2: Performs drift checking across tracks\n"
" * Note 3: a value of 0 disables interleaving\n"
" -old-inter time same as -inter but doesn't perform drift checking\n"
" -tight performs tight interleaving (sample based) of the file\n"
" * Note: reduces disk seek but increases file size\n"
" -flat stores file with all media data first, non-interleaved\n"
" -frag time_in_ms fragments file (track fragments of time_in_ms)\n"
" * Note: Always disables interleaving\n"
" -out filename specifies output file name\n"
" * Note: By default input (MP4,3GP) file is overwritten\n"
" -tmp dirname specifies directory for temporary file creation\n"
" * Note: Default temp dir is OS-dependent\n"
" -for-test disables all creation/modif dates and GPAC versions in files\n"
" -co64 forces usage of 64-bit chunk offsets for ISOBMF files\n"
" -write-buffer SIZE specifies write buffer in bytes for ISOBMF files\n"
" -no-sys removes all MPEG-4 Systems info except IOD (profiles)\n"
" * Note: Set by default whith '-add' and '-cat'\n"
" -no-iod removes InitialObjectDescriptor from file\n"
" -isma rewrites the file as an ISMA 1.0 AV file\n"
" -ismax same as \'-isma\' and removes all clock references\n"
" -3gp rewrites as 3GPP(2) file (no more MPEG-4 Systems Info)\n"
" * Note 1: some tracks may be removed in the process\n"
" * Note 2: always on for *.3gp *.3g2 *.3gpp\n"
" -ipod rewrites the file for iPod\n"
" -psp rewrites the file for PSP devices\n"
" -brand ABCD[:v] sets major brand of file, with optional version\n"
" -ab ABCD adds given brand to file's alternate brand list\n"
" -rb ABCD removes given brand from file's alternate brand list\n"
" -cprt string adds copyright string to movie\n"
" -chap file adds chapter information contained in file\n"
" -set-track-id id1:id2 changes the id of a track from id1 to id2\n"
" -swap-track-id id1:id2 swaps the IDs of the identified tracks\n"
" -rem trackID removes track from file\n"
" -rap trackID removes all non-RAP samples from track\n"
" -enable trackID enables track\n"
" -disable trackID disables track\n"
" -new forces creation of a new destination file\n"
" -timescale VAL sets movie timescale to VAL ticks per second (default is 600)\n"
" -lang [tkID=]LAN sets track language. LAN is the BCP-47 code (eng, en-UK, ...)\n"
" -delay tkID=TIME sets track start delay in ms\n"
" -par tkID=PAR sets visual track pixel aspect ratio (PAR=N:D or \"none\")\n"
" -name tkID=NAME sets track handler name\n"
" * NAME can indicate a UTF-8 file (\"file://file name\"\n"
" -itags tag1[:tag2] sets iTunes tags to file - more info: MP4Box -tag-list\n"
" -split time_sec splits in files of time_sec max duration, starting each file at RAP.\n"
" * Note: this removes all MPEG-4 Systems media\n"
" -split-size size splits in files of max filesize kB. same as -splits.\n"
" * Note: this removes all MPEG-4 Systems media\n"
" -split-rap splits in files beginning at each RAP. same as -splitr.\n"
" * Note: this removes all MPEG-4 Systems media\n"
" -split-chunk S:E extracts a new file from Start to End (in seconds). same as -splitx\n"
" * Note: this removes all MPEG-4 Systems media\n"
" -splitz S:E same as -split-chunk, but adjust the end time to be before the last RAP sample\n"
" * Note: this removes all MPEG-4 Systems media\n"
" -group-add fmt creates a new grouping information in the file. Format is\n"
" a colon-separated list of following options:\n"
" refTrack=ID: ID of the track used as a group reference.\n"
" If not set, the track will belong to the same group as the previous trackID specified.\n"
" If 0 or no previous track specified, a new alternate group will be created\n"
" switchID=ID: ID of the switch group to create.\n"
" If 0, a new ID will be computed for you\n"
" If <0, disables SwitchGroup\n"
" criteria=string: list of space-separated 4CCs.\n"
" trackID=ID: ID of the track to add to this group.\n"
"\n"
" *WARNING* Options modify state as they are parsed:\n"
" trackID=1:criteria=lang:trackID=2\n"
" is different from:\n"
" criteria=lang:trackID=1:trackID=2\n"
"\n"
" -group-rem-track ID removes track from its group\n"
" -group-rem ID removes the track's group\n"
" -group-clean removes all group information from all tracks\n"
" -group-single puts all tracks in a single group\n"
" -ref id:XXXX:refID adds a reference of type 4CC from track ID to track refID\n"
" -keep-utc keeps UTC timing in the file after edit\n"
" -udta ID:[OPTS] sets udta for given track or movie if ID is 0. OPTS is a colon separated list of:\n"
" type=CODE where code is the 4CC code of the UDTA (not needed for box= option)\n"
" box=FILE where FILE is the location of the udta data, formatted as serialized boxes\n"
#ifndef GPAC_DISABLE_CORE_TOOLS
" box=base64,DATA where DATA is the base64 encoded udta data, formatted as serialized boxes\n"
#endif
" src=FILE where FILE is the location of the udta data (will be stored in a single box of type CODE)\n"
#ifndef GPAC_DISABLE_CORE_TOOLS
" src=base64,DATA where DATA is the base64 encoded udta data (will be stored in a single box of type CODE)\n"
#endif
" If no source is set, UDTA of type CODE will be removed\n"
"\n");
}
void PrintDASHUsage()
{
fprintf(stderr, "DASH Options:\n"
" -mpd m3u8 converts HLS manifest (local or remote http) to MPD \n"
" Note: not compatible with other DASH options (except -out and -tmp) and does not convert associated segments\n"
" -dash dur enables DASH-ing of the file(s) with a segment duration of DUR ms\n"
" Note: the duration of a fragment (subsegment) is set\n"
" using the -frag switch.\n"
" Note: for onDemand profile, sets duration of a subsegment\n"
" -dash-strict dur enables DASH-ing of the file(s) with a segment duration of DUR ms (old behaviour)\n"
" Note: the duration will be the closest to \'dur\', and will remain constant\n"
" -dash-live[=F] dur generates a live DASH session using dur segment duration, optionally writing live context to F\n"
" MP4Box will run the live session until \'q\' is pressed or a fatal error occurs.\n"
" -ddbg-live[=F] dur same as -dash-live without time regulation for debug purposes.\n"
" -frag time_in_ms Specifies a fragment duration of time_in_ms.\n"
" * Note: By default, this is the DASH duration\n"
" -out filename specifies output MPD file name.\n"
" -tmp dirname specifies directory for temporary file creation\n"
" * Note: Default temp dir is OS-dependent\n"
" -profile NAME specifies the target DASH profile: \"onDemand\",\n"
" \"live\", \"main\", \"simple\", \"full\",\n"
" \"hbbtv1.5:live\", \"dashavc264:live\", \"dashavc264:onDemand\"\n"
" * This will set default option values to ensure conformance to the desired profile\n"
" * Default profile is \"full\" in static mode, \"live\" in dynamic mode\n"
" -profile-ext STRING specifies a list of profile extensions, as used by DASH-IF and DVB.\n"
" The string will be colon-concatenated with the profile used\n"
"\n"
"Input media files to dash can use the following modifiers\n"
" \"#trackID=N\" only uses the track ID N from the source file\n"
" \"#video\" only uses the first video track from the source file\n"
" \"#audio\" only uses the first audio track from the source file\n"
" \":id=NAME\" sets the representation ID to NAME\n"
" \":dur=VALUE\" processes VALUE seconds from the media\n"
" If VALUE is longer than the media duration, the last media duration is lengthen.\n"
" \":period=NAME\" sets the representation's period to NAME. Multiple periods may be used\n"
" period appear in the MPD in the same order as specified with this option\n"
" \":BaseURL=NAME\" sets the BaseURL. Set multiple times for multiple BaseURLs\n"
" WARNING: this does NOT modify generated files location (see segment template).\n"
" \":bandwidth=VALUE\" sets the representation's bandwidth to a given value\n"
" \":period_duration=VALUE\" increases the duration of this period by the given duration in seconds\n"
" only used when no input media is specified (remote period insertion), eg :period=X:xlink=Z:duration=Y.\n"
" \":xlink=VALUE\" sets the xlink value for the period containing this element\n"
" only the xlink declared on the first rep of a period will be used\n"
" \":role=VALUE\" sets the role of this representation (cf DASH spec).\n"
" media with different roles belong to different adaptation sets.\n"
" \":desc_p=VALUE\" adds a descriptor at the Period level. Value must be a properly formatted XML element.\n"
" \":desc_as=VALUE\" adds a descriptor at the AdaptationSet level. Value must be a properly formatted XML element.\n"
" two input files with different values will be in different AdaptationSet elements.\n"
" \":desc_as_c=VALUE\" adds a descriptor at the AdaptationSet level. Value must be a properly formatted XML element.\n"
" value is ignored while creating AdaptationSet elements.\n"
" \":desc_rep=VALUE\" adds a descriptor at the Representation level. Value must be a properly formatted XML element.\n"
" value is ignored while creating AdaptationSet elements.\n"
"\n"
" -rap segments begin with random access points\n"
" Note: segment duration may not be exactly what asked by\n"
" \"-dash\" since encoded video data is not modified\n"
" -frag-rap All fragments begin with random access points\n"
" Note: fragment duration may not be exactly what is asked by\n"
" \"-frag\" since encoded video data is not modified\n"
" -segment-name name sets the segment name for generated segments\n"
" If not set (default), segments are concatenated in output file\n"
" except in \"live\" profile where dash_%%s is used\n"
" Replacement strings supported:\n"
" $Number[%%0Nd]$ is replaced by the segment number, possibly prefixed with 0.\n"
" $RepresentationID$ is replaced by representation name.\n"
" $Time$ is replaced by segment start time.\n"
" $Bandwidth$ is replaced by representation bandwidth.\n"
" $Init=NAME$ is replaced by NAME for init segment, ignored otherwise.\n"
" $Index=NAME$ is replaced by NAME for index segments, ignored otherwise.\n"
" $Path=PATH$ is replaced by PATH when creating segments, ignored otherwise.\n"
"\n"
" -segment-ext name sets the segment extension. Default is m4s, \"null\" means no extension\n"
" -segment-timeline uses SegmentTimeline when generating segments.\n"
" -segment-marker MARK adds a box of type \'MARK\' at the end of each DASH segment. MARK shall be a 4CC identifier\n"
" -insert-utc inserts UTC clock at the begining of each ISOBMF segment\n"
" -base-url string sets Base url at MPD level. Can be used several times.\n"
" WARNING: this does NOT modify generated files location (see segment template).\n"
" -mpd-title string sets MPD title.\n"
" -mpd-source string sets MPD source.\n"
" -mpd-info-url string sets MPD info url.\n"
" -cprt string adds copyright string to MPD\n"
" -dash-ctx FILE stores/restore DASH timing from FILE.\n"
" -dynamic uses dynamic MPD type instead of static.\n"
" -last-dynamic same as dynamic but closes the period (insert lmsg brand if needed and update duration).\n"
" -mpd-duration DUR sets the duration in second of a live session (0 by default). If 0, you must use -mpd-refresh.\n"
" -mpd-refresh TIME specifies MPD update time in seconds (double can be used).\n"
" -time-shift TIME specifies MPD time shift buffer depth in seconds (default 0). Specify -1 to keep all files\n"
" -subdur DUR specifies maximum duration in ms of the input file to be dashed in LIVE or context mode.\n"
" NOTE: This does not change the segment duration: dashing stops once segments produced exceeded the duration.\n"
" -dash-run-for TIME In case of dash live, runs for T ms of the media then exits\n"
" -min-buffer TIME specifies MPD min buffer time in milliseconds\n"
" -ast-offset TIME specifies MPD AvailabilityStartTime offset in ms if positive, or availabilityTimeOffset of each representation if negative. Default is 0 sec delay\n"
" -dash-scale SCALE specifies that timing for -dash and -frag are expressed in SCALE units per seconds\n"
" -mem-frags fragments will be produced in memory rather than on disk before flushing to disk\n"
" -pssh-moof stores PSSH boxes in first moof of each segments. By default PSSH are stored in movie box.\n"
" -sample-groups-traf stores sample group descriptions in traf (duplicated for each traf). If not used, sample group descriptions are stored in the movie box.\n"
" -no-cache disable file cache for dash inputs .\n"
"\n"
"Advanced Options, should not be needed when using -profile:\n"
" -subsegs-per-sidx N sets the number of subsegments to be written in each SIDX box\n"
" If 0, a single SIDX box is used per segment\n"
" If -1, no SIDX box is used\n"
" -url-template uses SegmentTemplate instead of explicit sources in segments.\n"
" Ignored if segments are stored in the output file.\n"
" -daisy-chain uses daisy-chain SIDX instead of hierarchical. Ignored if frags/sidx is 0.\n"
" -single-segment uses a single segment for the whole file (OnDemand profile). \n"
" -single-file uses a single file for the whole file (default). \n"
" -bs-switching MODE sets bitstream switching to \"inband\" (default), \"merge\", \"multi\", \"no\" or \"single\" to test with single input.\n"
" -moof-sn N sets sequence number of first moof to N\n"
" -tfdt N sets TFDT of first traf to N in SCALE units (cf -dash-scale)\n"
" -no-frags-default disables default flags in fragments\n"
" -single-traf uses a single track fragment per moof (smooth streaming and derived specs may require this)\n"
" -dash-ts-prog N program_number to be considered in case of an MPTS input file.\n"
" -frag-rt when using fragments in live mode, flush fragments according to their timing (only supported with a single input).\n"
" -cp-location=MODE sets ContentProtection element location. Possible values for mode are:\n"
" as: sets ContentProtection in AdaptationSet element\n"
" rep: sets ContentProtection in Representation element\n"
" both: sets ContentProtection in both elements\n"
" -start-date for live mode, sets start date (as xs:date, eg YYYY-MM-DDTHH:MM:SSZ. Default is now.\n"
" !! Do not use with multiple periods, nor when DASH duration is not a multiple of GOP size !!\n"
"\n");
}
void PrintFormats()
{
fprintf(stderr, "Supported raw formats and file extensions:\n"
" NHNT .media .nhnt .info\n"
" NHML .nhml (opt: .media .info)\n"
" MPEG-1-2 Video .m1v .m2v\n"
" MPEG-4 Video .cmp .m4v\n"
" H263 Video .263 .h263\n"
" AVC/H264 Video .h264 .h26L .264 .26L .x264 .svc\n"
" HEVC Video .hevc .h265 .265 .hvc .shvc .lhvc .mhvc\n"
" JPEG Images .jpg .jpeg\n"
" JPEG-2000 Images .jp2\n"
" PNG Images .png\n"
" MPEG 1-2 Audio .mp3, .mp2, .m1a, .m2a\n"
" ADTS-AAC Audio .aac\n"
" Dolby (e)AC-3 Audio .ac3 .ec3\n"
" AMR(WB) Audio .amr .awb\n"
" EVRC Audio .evc\n"
" SMV Audio .smv\n"
"\n"
"Supported containers and file extensions:\n"
" AVI .avi\n"
" MPEG-2 PS .mpg .mpeg .vob .vcd .svcd\n"
" MPEG-2 TS .ts .m2t\n"
" QCP .qcp\n"
" OGG .ogg\n"
" ISO-Media files no extension checking\n"
"\n"
"Supported text formats:\n"
" SRT Subtitles .srt\n"
" SUB Subtitles .sub\n"
" VobSub .idx\n"
" GPAC Timed Text .ttxt\n"
" VTT .vtt\n"
" TTML .ttml\n"
" QuickTime TeXML Text .xml (cf QT documentation)\n"
"\n"
"Supported Scene formats:\n"
" MPEG-4 XMT-A .xmt .xmta .xmt.gz .xmta.gz\n"
" MPEG-4 BT .bt .bt.gz\n"
" MPEG-4 SAF .saf .lsr\n"
" VRML .wrl .wrl.gz\n"
" X3D-XML .x3d .x3d.gz\n"
" X3D-VRML .x3dv .x3dv.gz\n"
" MacroMedia Flash .swf (very limited import support only)\n"
"\n"
"Supported chapter formats:\n"
" Nero chapters .txt .chap\n"
"\n"
);
}
void PrintImportUsage()
{
fprintf(stderr, "Importing Options\n"
"\nFile importing syntax:\n"
" \"#video\" \"#audio\" base import for most AV files\n"
" \"#trackID=ID\" track import for IsoMedia and other files\n"
" \"#pid=ID\" stream import from MPEG-2 TS\n"
" \":dur=D\" imports only the first D seconds\n"
" \":lang=LAN\" sets imported media language code\n"
" \":delay=delay_ms\" sets imported media initial delay in ms\n"
" \":par=PAR\" sets visual pixel aspect ratio (PAR=Num:Den)\n"
" \":name=NAME\" sets track handler name\n"
" \":ext=EXT\" overrides file extension when importing\n"
" \":hdlr=code\" sets track handler type to the given code point (4CC)\n"
" \":disable\" imported track(s) will be disabled\n"
" \":group=G\" adds the track as part of the G alternate group.\n"
" If G is 0, the first available GroupID will be picked.\n"
" \":fps=VAL\" same as -fps option\n"
" \":rap\" imports only RAP samples\n"
" \":trailing\" keeps trailing 0-bytes in AVC/HEVC samples\n"
" \":agg=VAL\" same as -agg option\n"
" \":dref\" same as -dref option\n"
" \":keep_refs\" keeps track reference when importing a single track\n"
" \":nodrop\" same as -nodrop option\n"
" \":packed\" same as -packed option\n"
" \":sbr\" same as -sbr option\n"
" \":sbrx\" same as -sbrx option\n"
" \":ovsbr\" same as -ovsbr option\n"
" \":ps\" same as -ps option\n"
" \":psx\" same as -psx option\n"
" \":mpeg4\" same as -mpeg4 option\n"
" \":nosei\" discard all SEI messages during import\n"
" \":svc\" import SVC/LHVC with explicit signaling (no AVC base compatibility)\n"
" \":nosvc\" discard SVC/LHVC data when importing\n"
" \":svcmode=MODE\" sets SVC/LHVC import mode:\n"
" \" split : each layer is in its own track\n"
" \" merge : all layers are merged in a single track\n"
" \" splitbase : all layers are merged in a track, and the AVC base in another\n"
" \" splitnox : each layer is in its own track, and no extractors are written\n"
" \":subsamples\" adds SubSample information for AVC+SVC\n"
" \":forcesync\" forces non IDR samples with I slices to be marked as sync points (AVC GDR)\n"
" !! RESULTING FILE IS NOT COMPLIANT WITH THE SPEC but will fix seeking in most players\n"
" \":xps_inband\" Sets xPS inband for AVC/H264 and HEVC (for reverse operation, re-import from raw media)\n"
" \":max_lid=N\" sets HEVC max layer ID to be imported to N. Default imports all.\n"
" \":max_tid=N\" sets HEVC max temporal ID to be imported to N. Default imports all.\n"
" \":tiles\" adds HEVC tiles signaling and NALU maps without splitting the tiles into different tile tracks.\n"
" \":split_tiles\" splits HEVC tiles into different tile tracks, one tile (or all tiles of one slice) per track.\n"
" \":negctts\" uses negative CTS-DTS offsets (ISO4 brand)\n"
" \":stype=4CC\" forces the sample description type to a different value\n"
" !! THIS MAY BREAK THE FILE WRITING !!\n"
" \":chap\" specifies the track is a chapter track\n"
" \":chapter=NAME\" adds a single chapter (old nero format) with given name lasting the entire file\n"
" This command can be used in -cat as well\n"
" \":chapfile=file\" adds a chapter file (old nero format)\n"
" This command can be used in -cat as well\n"
" \":layout=WxHxXxY\" specifies the track layout\n"
" - if W (resp H) = 0, the max width (resp height) of\n"
" the tracks in the file are used.\n"
" - if Y=-1, the layout is moved to the bottom of the\n"
" track area\n"
" - X and Y can be omitted (:layout=WxH)\n"
" \":rescale=TS\" forces media timescale to TS !! changes the media duration\n"
" \":timescale=TS\" sets import timescale to TS\n"
" \":noedit\" do not set edit list when importing B-frames video tracks\n"
" \":rvc=FILENAME\" sets TVC configuration for the media\n"
" \":fmt=FORMAT\" overrides format detection with given format (cf BT/XMTA doc)\n"
" \":profile=INT\" overrides AVC profile\n"
" \":level=INT\" overrides AVC level\n"
" \":novpsext\" removes VPS extensions from HEVC VPS\n"
" \":font=name\" specifies font name for text import (default \"Serif\")\n"
" \":size=s\" specifies font size for text import (default 18)\n"
" \":text_layout=WxHxXxY\" specifies the track text layout\n"
" - if W (resp H) = 0, the max width (resp height) of\n"
" the tracks in the file are used.\n"
" - if Y=-1, the layout is moved to the bottom of the\n"
" track area\n"
" - X and Y can be omitted (:layout=WxH)\n"
" \":swf-global\" all SWF defines are placed in first scene replace\n"
" * Note: By default SWF defines are sent when needed\n"
" \":swf-no-ctrl\" uses a single stream for movie control and dictionary\n"
" * Note: this will disable ActionScript\n"
" \":swf-no-text\" removes all SWF text\n"
" \":swf-no-font\" removes all embedded SWF Fonts (terminal fonts used)\n"
" \":swf-no-line\" removes all lines from SWF shapes\n"
" \":swf-no-grad\" removes all gradients from swf shapes\n"
" \":swf-quad\" uses quadratic bezier curves instead of cubic ones\n"
" \":swf-xlp\" support for lines transparency and scalability\n"
" \":swf-ic2d\" uses indexed curve 2D hardcoded proto\n"
" \":swf-same-app\" appearance nodes are reused\n"
" \":swf-flatten=ang\" complementary angle below which 2 lines are merged\n"
" * Note: angle \'0\' means no flattening\n"
" \":kind=schemeURI=value\" sets kind for the track\n"
" \":txtflags=flags\" sets display flags (hexa number) of text track\n"
" \":txtflags+=flags\" adds display flags (hexa number) to text track\n"
" \":txtflags-=flags\" removes display flags (hexa number) from text track\n"
"\n"
" -add file add file tracks to (new) output file\n"
" -cat file concatenates file samples to (new) output file\n"
" * Note: creates tracks if needed\n"
" * Note: aligns initial timestamp of the file to be concatenated.\n"
" -catx file same as cat but new tracks can be imported before concatenation by specifying '+ADD_COMMAND'\n"
" where ADD_COMMAND is a regular -add syntax\n"
" -unalign-cat does not attempt to align timestamps of samples inbetween tracks\n"
" -force-cat skips media configuration check when concatenating file\n"
" !!! THIS MAY BREAK THE CONCATENATED TRACK(S) !!!\n"
" -keep-sys keeps all MPEG-4 Systems info when using '-add' / 'cat'\n"
" -keep-all keeps all existing tracks when using '-add'\n"
" * Note: only used when adding IsoMedia files\n"
"\n"
"All the following options can be specified as default or for each track.\n"
"When specified by track the syntax is \":opt\" or \":opt=val\".\n\n"
" -dref keeps media data in original file\n"
" -no-drop forces constant FPS when importing AVI video\n"
" -packed forces packed bitstream when importing raw ASP\n"
" -sbr backward compatible signaling of AAC-SBR\n"
" -sbrx non-backward compatible signaling of AAC-SBR\n"
" -ps backward compatible signaling of AAC-PS\n"
" -psx non-backward compatible signaling of AAC-PS\n"
" -ovsbr oversample SBR\n"
" * Note: SBR AAC, PS AAC and oversampled SBR cannot be detected at import time\n"
" -fps FPS forces frame rate for video and SUB subtitles import\n"
" FPS is either a number or expressed as timescale-increment\n"
" * For raw H263 import, default FPS is 15\n"
" * For all other imports, default FPS is 25\n"
" !! THIS IS IGNORED FOR IsoMedia IMPORT !!\n"
" -mpeg4 forces MPEG-4 sample descriptions when possible (3GPP2)\n"
" For AAC, forces MPEG-4 AAC signaling even if MPEG-2\n"
" -agg N aggregates N audio frames in 1 sample (3GP media only)\n"
" * Note: Maximum value is 15 - Disabled by default\n"
"\n"
);
}
void PrintEncodeUsage()
{
fprintf(stderr, "MPEG-4 Scene Encoding Options\n"
" -mp4 specify input file is for encoding.\n"
" -def encode DEF names\n"
" -sync time_in_ms forces BIFS sync sample generation every time_in_ms\n"
" * Note: cannot be used with -shadow\n"
" -shadow time_ms forces BIFS sync shadow sample generation every time_ms.\n"
" * Note: cannot be used with -sync\n"
" -log generates scene codec log file if available\n"
" -ms file specifies file for track importing\n"
"\nChunk Processing\n"
" -ctx-in file specifies initial context (MP4/BT/XMT)\n"
" * Note: input file must be a commands-only file\n"
" -ctx-out file specifies storage of updated context (MP4/BT/XMT)\n"
"\n"
"LASeR Encoding options\n"
" -resolution res resolution factor (-8 to 7, default 0)\n"
" all coords are multiplied by 2^res before truncation\n"
" -coord-bits bits bits used for encoding truncated coordinates\n"
" (0 to 31, default 12)\n"
" -scale-bits bits extra bits used for encoding truncated scales\n"
" (0 to 4, default 0)\n"
" -auto-quant res resolution is given as if using -resolution\n"
" but coord-bits and scale-bits are infered\n"
);
}
void PrintEncryptUsage()
{
fprintf(stderr, "ISMA Encryption/Decryption Options\n"
" -crypt drm_file crypts a specific track using ISMA AES CTR 128\n"
" -decrypt [drm_file] decrypts a specific track using ISMA AES CTR 128\n"
" * Note: drm_file can be omitted if keys are in file\n"
" -set-kms kms_uri changes KMS location for all tracks or a given one.\n"
" * to address a track, use \'tkID=kms_uri\'\n"
"\n"
"DRM file syntax for GPAC ISMACryp:\n"
" File is XML and shall start with xml header\n"
" File root is an \"ISMACryp\" element\n"
" File is a list of \"cryptrack\" elements\n"
"\n"
"cryptrack attributes are\n"
" TrackID ID of track to en/decrypt\n"
" key AES-128 key formatted (hex string \'0x\'+32 chars)\n"
" salt CTR IV salt key (64 bits) (hex string \'0x\'+16 chars)\n"
"\nEncryption only attributes:\n"
" Scheme_URI URI of scheme used\n"
" KMS_URI URI of key management system\n"
" * Note: \'self\' writes key and salt in the file\n"
" selectiveType selective encryption type - understood values are:\n"
" \"None\" all samples encrypted (default)\n"
" \"Clear\" all samples clean (not encrypted)\n"
" \"RAP\" only encrypts random access units\n"
" \"Non-RAP\" only encrypts non-random access units\n"
" \"Rand\" random selection is performed\n"
" \"X\" Encrypts every first sample out of X (uint)\n"
" \"RandX\" Encrypts one random sample out of X (uint)\n"
"\n"
" ipmpType IPMP Signaling Type: None, IPMP, IPMPX\n"
" ipmpDescriptorID IPMP_Descriptor ID to use if IPMP(X) is used\n"
" * If not set MP4Box will generate one for you\n"
"\n"
);
}
void PrintHintUsage()
{
fprintf(stderr, "Hinting Options\n"
" -hint hints the file for RTP/RTSP\n"
" -mtu size specifies RTP MTU (max size) in bytes. Default size is 1450\n"
" * Note: this includes the RTP header (12 bytes)\n"
" -copy copies media data to hint track rather than reference\n"
" * Note: speeds up server but takes much more space\n"
" -multi [maxptime] enables frame concatenation in RTP packets if possible\n"
" maxptime max packet duration in ms (optional, default 100ms)\n"
" -rate ck_rate specifies rtp rate in Hz when no default for payload\n"
" * Note: default value is 90000 (MPEG rtp rates)\n"
" -mpeg4 forces MPEG-4 generic payload whenever possible\n"
" -latm forces MPG4-LATM transport for AAC streams\n"
" -static enables static RTP payload IDs whenever possible\n"
" * By default, dynamic payloads are always used\n"
"\n"
"MPEG-4 Generic Payload Options\n"
" -ocr forces all streams to be synchronized\n"
" * Most RTSP servers only support synchronized streams\n"
" -rap signals random access points in RTP packets\n"
" -ts signals AU Time Stamps in RTP packets\n"
" -size signals AU size in RTP packets\n"
" -idx signals AU sequence numbers in RTP packets\n"
" -iod prevents systems tracks embedding in IOD\n"
" * Note: shouldn't be used with -isma option\n"
"\n"
" -add-sdp string adds sdp string to (hint) track (\"-add-sdp tkID:string\")\n"
" or movie. This will take care of SDP lines ordering\n"
" -unhint removes all hinting information.\n"
"\n");
}
void PrintExtractUsage()
{
fprintf(stderr, "Extracting Options:\n"
" -raw TrackID extracts track in raw format when supported\n"
" :output=FileName sets the output filename for this extraction \n"
" -raws TrackID extract each track sample to a file\n"
" * Note: \"TrackID:N\" extracts Nth sample\n"
" -nhnt TrackID extracts track in nhnt format\n"
" -nhml TrackID extracts track in nhml format (XML nhnt).\n"
" * Note: \"-nhml TrackID:full\" for full dump\n"
" -webvtt-raw TrackID extracts raw media track in WebVTT as metadata.\n"
" * Note: \"-webvtt-raw TrackID:embedded\" to include media data in the WebVTT file\n"
" -six TrackID extracts raw media track in experimental XML streaming instructions.\n"
" -single TrackID extracts track to a new mp4 file\n"
" -avi TrackID extracts visual track to an avi file\n"
" -qcp TrackID same as \'-raw\' but defaults to QCP file for EVRC/SMV\n"
" -aviraw TK extracts AVI track in raw format\n"
" $TK can be one of \"video\" \"audio\" \"audioN\"\n"
" -saf remux file to SAF multiplex\n"
" -dvbhdemux demux DVB-H file into IP Datagrams\n"
" * Note: can be used when encoding scene descriptions\n"
" -raw-layer ID same as -raw but skips SVC/MVC extractors when extracting\n"
" -diod extracts file IOD in raw format when supported\n"
"\n"
#if !defined(GPAC_DISABLE_STREAMING)
" -grab-ts IP:port grabs TS over UDP or RTP at IP:port location to output TS file\n"
" -ifce IFCE indicates default ifce for grab operations\n"
#endif
"\n");
}
void PrintDumpUsage()
{
fprintf(stderr, "Dumping Options\n"
" -stdb dumps/write to stdout and assumes stdout is opened in binary mode\n"
" -std dumps/write to stdout and try to reopen stdout in binary mode.\n"
" -info [trackID] prints movie info / track info if trackID specified\n"
" * Note: for non IsoMedia files, gets import options\n"
" -bt scene to bt format - removes unknown MPEG4 nodes\n"
" -xmt scene to XMT-A format - removes unknown MPEG4 nodes\n"
" -wrl scene VRML format - removes unknown VRML nodes\n"
" -x3d scene to X3D/XML format - removes unknown X3D nodes\n"
" -x3dv scene to X3D/VRML format - removes unknown X3D nodes\n"
" -lsr scene to LASeR format\n"
" -diso dumps IsoMedia file boxes in XML output\n"
" -dxml dumps IsoMedia file boxes and known track samples in XML output\n"
" -drtp rtp hint samples structure to XML output\n"
" -dts prints sample timing to text output\n"
" -dnal trackID prints NAL sample info of given track\n"
" -sdp dumps SDP description of hinted file\n"
" -dcr ISMACryp samples structure to XML output\n"
" -dump-cover Extracts cover art\n"
" -dump-chap Extracts chapter file\n"
" -dump-chap-ogg Extracts chapter file as OGG format\n"
" -dump-udta [ID:]4cc Extracts udta for the given 4CC. If ID is given, dumps from UDTA of the given track ID, otherwise moov is used.\n"
"\n"
#ifndef GPAC_DISABLE_ISOM_WRITE
" -ttxt Converts input subtitle to GPAC TTXT format\n"
#endif
" -ttxt TrackID Dumps Text track to GPAC TTXT format\n"
#ifndef GPAC_DISABLE_ISOM_WRITE
" -srt Converts input subtitle to SRT format\n"
#endif
" -srt TrackID Dumps Text track to SRT format\n"
"\n"
" -stat generates node/field statistics for scene\n"
" -stats generates node/field statistics per MPEG-4 Access Unit\n"
" -statx generates node/field statistics for scene after each AU\n"
"\n"
" -hash generates SHA-1 Hash of the input file\n"
#ifndef GPAC_DISABLE_CORE_TOOLS
" -bin converts input XML file using NHML bitstream syntax to binary\n"
#endif
"\n");
}
void PrintMetaUsage()
{
fprintf(stderr, "Meta handling Options\n"
" -set-meta args sets given meta type - syntax: \"ABCD[:tk=ID]\"\n"
" * ABCD: four char meta type (NULL or 0 to remove meta)\n"
" * [:tk=ID]: if not set use root (file) meta\n"
" if ID is 0 use moov meta\n"
" if ID is not 0 use track meta\n"
" -add-item args adds resource to meta\n"
" * syntax: file_path + options (\':\' separated):\n"
" file_path \"this\" or \"self\": item is the file itself\n"
" tk=ID: meta location (file, moov, track)\n"
" name=str: item name\n"
" type=itype: item 4cc type (not needed if mime is provided)\n"
" mime=mtype: item mime type\n"
" encoding=enctype: item content-encoding type\n"
" id=id: item ID\n"
" ref=4cc,id: reference of type 4cc to an other item\n"
" -add-image args adds the given file (with parameters) as HEIF image item \n"
" * same syntax as add-item with the following options\n"
" name=str same as for -add-item\n"
" id=id same as for -add-item\n"
" ref=4cc, id same as for -add-item\n"
" primary indicates that this item should be the primary item.\n"
" time=t uses the next sync sample after time t (float, in sec, default 0)\n"
" split_tiles for an HEVC tiled image, each tile is stored as a separate item\n"
" rotation=a sets the rotation angle for this image to 90*a degrees anti-clockwise.\n"
" image-hidden indicates that this image item should be hidden.\n"
" -rem-item args removes resource from meta - syntax: item_ID[:tk=ID]\n"
" -set-primary args sets item as primary for meta - syntax: item_ID[:tk=ID]\n"
" -set-xml args sets meta XML data\n"
" * syntax: xml_file_path[:tk=ID][:binary]\n"
" -rem-xml [tk=ID] removes meta XML data\n"
" -dump-xml args dumps meta XML to file - syntax file_path[:tk=ID]\n"
" -dump-item args dumps item to file - syntax item_ID[:tk=ID][:path=fileName]\n"
" -package packages input XML file into an ISO container\n"
" * all media referenced except hyperlinks are added to file\n"
" -mgt packages input XML file into an MPEG-U widget with ISO container.\n"
" * all files contained in the current folder are added to the widget package\n"
);
}
void PrintSWFUsage()
{
fprintf(stderr,
"SWF Importer Options\n"
"\n"
"MP4Box can import simple Macromedia Flash files (\".SWF\")\n"
"You can specify a SWF input file with \'-bt\', \'-xmt\' and \'-mp4\' options\n"
"\n"
" -global all SWF defines are placed in first scene replace\n"
" * Note: By default SWF defines are sent when needed\n"
" -no-ctrl uses a single stream for movie control and dictionary\n"
" * Note: this will disable ActionScript\n"
" -no-text removes all SWF text\n"
" -no-font removes all embedded SWF Fonts (terminal fonts used)\n"
" -no-line removes all lines from SWF shapes\n"
" -no-grad removes all gradients from swf shapes\n"
" -quad uses quadratic bezier curves instead of cubic ones\n"
" -xlp support for lines transparency and scalability\n"
" -flatten ang complementary angle below which 2 lines are merged\n"
" * Note: angle \'0\' means no flattening\n"
"\n"
);
}
void PrintUsage()
{
fprintf (stderr, "MP4Box [option] input [option]\n"
" -h general general options help\n"
" -h hint hinting options help\n"
" -h dash DASH segmenter help\n"
" -h import import options help\n"
" -h encode encode options help\n"
" -h meta meta handling options help\n"
" -h extract extraction options help\n"
" -h dump dump options help\n"
" -h swf Flash (SWF) options help\n"
" -h crypt ISMA E&A options help\n"
" -h format supported formats help\n"
" -h rtp file streamer help\n"
" -h live BIFS streamer help\n"
" -h all all options are printed\n"
"\n"
" -nodes lists supported MPEG4 nodes\n"
" -node NodeName gets MPEG4 node syntax and QP info\n"
" -xnodes lists supported X3D nodes\n"
" -xnode NodeName gets X3D node syntax\n"
" -snodes lists supported SVG nodes\n"
" -languages lists supported ISO 639 languages\n"
" -boxes lists all supported ISOBMF boxes and their syntax\n"
"\n"
" -quiet quiet mode\n"
" -noprog disables progress\n"
" -v verbose mode\n"
" -logs set log tools and levels, formatted as a ':'-separated list of toolX[:toolZ]@levelX\n"
" -log-file FILE sets output log file. Also works with -lf FILE\n"
" -log-clock or -lc logs time in micro sec since start time of GPAC before each log line.\n"
" -log-utc or -lu logs UTC time in ms before each log line.\n"
" -version gets build version\n"
" -- INPUT escape option if INPUT starts with - character\n"
"\n"
);
}
void scene_coding_log(void *cbk, GF_LOG_Level log_level, GF_LOG_Tool log_tool, const char *fmt, va_list vlist)
{
FILE *logs = cbk;
if (log_tool != GF_LOG_CODING) return;
vfprintf(logs, fmt, vlist);
fflush(logs);
}
#ifndef GPAC_DISABLE_ISOM_HINTING
/*
MP4 File Hinting
*/
void SetupClockReferences(GF_ISOFile *file)
{
u32 i, count, ocr_id;
count = gf_isom_get_track_count(file);
if (count==1) return;
ocr_id = 0;
for (i=0; i<count; i++) {
if (!gf_isom_is_track_in_root_od(file, i+1)) continue;
ocr_id = gf_isom_get_track_id(file, i+1);
break;
}
/*doesn't look like MP4*/
if (!ocr_id) return;
for (i=0; i<count; i++) {
GF_ESD *esd = gf_isom_get_esd(file, i+1, 1);
if (esd) {
esd->OCRESID = ocr_id;
gf_isom_change_mpeg4_description(file, i+1, 1, esd);
gf_odf_desc_del((GF_Descriptor *) esd);
}
}
}
/*base RTP payload type used (you can specify your own types if needed)*/
#define BASE_PAYT 96
GF_Err HintFile(GF_ISOFile *file, u32 MTUSize, u32 max_ptime, u32 rtp_rate, u32 base_flags, Bool copy_data, Bool interleave, Bool regular_iod, Bool single_group)
{
GF_ESD *esd;
GF_InitialObjectDescriptor *iod;
u32 i, val, res, streamType;
u32 sl_mode, prev_ocr, single_ocr, nb_done, tot_bw, bw, flags, spec_type;
GF_Err e;
char szPayload[30];
GF_RTPHinter *hinter;
Bool copy, has_iod, single_av;
u8 init_payt = BASE_PAYT;
u32 mtype;
GF_SDP_IODProfile iod_mode = GF_SDP_IOD_NONE;
u32 media_group = 0;
u8 media_prio = 0;
tot_bw = 0;
prev_ocr = 0;
single_ocr = 1;
has_iod = 1;
iod = (GF_InitialObjectDescriptor *) gf_isom_get_root_od(file);
if (!iod) has_iod = 0;
else {
if (!gf_list_count(iod->ESDescriptors)) has_iod = 0;
gf_odf_desc_del((GF_Descriptor *) iod);
}
spec_type = gf_isom_guess_specification(file);
single_av = single_group ? 1 : gf_isom_is_single_av(file);
/*first make sure we use a systems track as base OCR*/
for (i=0; i<gf_isom_get_track_count(file); i++) {
res = gf_isom_get_media_type(file, i+1);
if ((res==GF_ISOM_MEDIA_SCENE) || (res==GF_ISOM_MEDIA_OD)) {
if (gf_isom_is_track_in_root_od(file, i+1)) {
gf_isom_set_default_sync_track(file, i+1);
break;
}
}
}
nb_done = 0;
for (i=0; i<gf_isom_get_track_count(file); i++) {
sl_mode = base_flags;
copy = copy_data;
/*skip emty tracks (mainly MPEG-4 interaction streams...*/
if (!gf_isom_get_sample_count(file, i+1)) continue;
if (!gf_isom_is_track_enabled(file, i+1)) {
fprintf(stderr, "Track ID %d disabled - skipping hint\n", gf_isom_get_track_id(file, i+1) );
continue;
}
mtype = gf_isom_get_media_type(file, i+1);
switch (mtype) {
case GF_ISOM_MEDIA_VISUAL:
if (single_av) {
media_group = 2;
media_prio = 2;
}
break;
case GF_ISOM_MEDIA_AUDIO:
if (single_av) {
media_group = 2;
media_prio = 1;
}
break;
case GF_ISOM_MEDIA_HINT:
continue;
default:
/*no hinting of systems track on isma*/
if (spec_type==GF_ISOM_BRAND_ISMA) continue;
}