mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2024-12-24 11:54:01 +00:00
--cues now needs the track ID.
This commit is contained in:
parent
b8691f5c3b
commit
bf99f24a62
47
mkvmerge.1
47
mkvmerge.1
@ -130,10 +130,10 @@ linear drifts. \fIp\fR defaults to 1000 if omitted. Both \fIo\fR and
|
||||
Defaults: no manual synch correction (which is the same as \fId\fR = 0 and
|
||||
\fIo\fR/\fIp\fR = 1.0).
|
||||
.TP
|
||||
\fB\-\-cues\fR <\fInone\fR|\fIiframes\fR|\fIall\fR>
|
||||
Controls for which tracks cue (index) entries are created. \fInone\fR inhibits
|
||||
the creation of cue entries for all tracks contained in the following
|
||||
source files. For \fIiframes\fR only blocks with no backward or forward
|
||||
\fB\-\-cues\fR <\fITID\fR:\fInone\fR|\fIiframes\fR|\fIall\fR>
|
||||
Controls for which tracks cue (index) entries are created for the given track
|
||||
(see section \fBTRACK IDS\fR). \fInone\fR inhibits the creation of cue entries.
|
||||
For \fIiframes\fR only blocks with no backward or forward
|
||||
references ( = I frames in video tracks) are put into the cue sheet. \fIall\fR
|
||||
causes \fBmkvmerge\fR to create cue entries for all blocks which will make
|
||||
the file very big.
|
||||
@ -142,16 +142,16 @@ The default is \fIiframes\fR for video tracks and \fInone\fR for all others.
|
||||
See also option \fB\-\-no\-cues\fR which inhibits the creation of cue
|
||||
entries regardless of the \fB\-\-cues\fR options used.
|
||||
.TP
|
||||
\fB\-\-default\-track\fR
|
||||
Sets the 'default' flag for all tracks read from this file. If the user does
|
||||
not explicitly select a track himself then the player should prefer the
|
||||
track that has his 'default' flag set. Only one track of each kind (audio,
|
||||
video, subttiles) can have his 'default' flag set.
|
||||
\fB\-\-default\-track\fR <\fITID\fR>
|
||||
Sets the 'default' flag for the given track (see section \fBTRACK IDS\fR).
|
||||
If the user does not explicitly select a track himself then the player should
|
||||
prefer the track that has his 'default' flag set. Only one track of each kind
|
||||
(audio, video, subttiles) can have his 'default' flag set.
|
||||
.TP
|
||||
\fB\-\-language\fR <\fIlanguage\fR>
|
||||
Sets the language for all tracks read from this file. Only ISO639-2 codes
|
||||
are allowed. All languages including their ISO639-2 codes can be listed
|
||||
with the \fB\-\-list\-languages\fR option.
|
||||
\fB\-\-language\fR <\fITID\fR:\fIlanguage\fR>
|
||||
Sets the language for the given track (see section \fBTRACK IDS\fR). Only
|
||||
ISO639-2 codes are allowed. All languages including their ISO639-2 codes can be
|
||||
listed with the \fB\-\-list\-languages\fR option.
|
||||
.LP
|
||||
Options that only apply to video tracks:
|
||||
.TP
|
||||
@ -253,14 +253,17 @@ video tracks) then you can tell mplayer which track to play with the
|
||||
\&'\fB-vid\fP' and '\fB-aid\fP' parameters. These are 0-based and do not
|
||||
distinguish between video and audio.
|
||||
.LP
|
||||
If you need an audio track synchronized you can do that easily with
|
||||
If you need an audio track synchronized you can do that easily. First find
|
||||
out which track ID the Vorbis track has with
|
||||
.LP
|
||||
$ \fBmkvmerge -o goodsync.mkv -A source.avi -s 200 outofsync.ogg\fP
|
||||
$ \fBmkvmerge --identify outofsync.ogg\fP
|
||||
.LP
|
||||
This would add 200ms of silence at the beginning of the audio tracks taken from
|
||||
\fIoutofsync.ogg\fP. And \fB-s\fP always applies to all audio tracks in a
|
||||
source file. If you want to apply \fB-s\fP only to a specific track then take
|
||||
the same source file more than once and add \fB-a\fP and \fB-s\fP accordingly.
|
||||
Now you can use that ID in the following command line:
|
||||
.LP
|
||||
$ \fBmkvmerge -o goodsync.mkv -A source.avi -s 12345:200 outofsync.ogg\fP
|
||||
.LP
|
||||
This would add 200ms of silence at the beginning of the audio track with the
|
||||
ID 12345 taken from \fIoutofsync.ogg\fP.
|
||||
.LP
|
||||
Some movies start synced correctly but slowly drift out of sync. For these
|
||||
kind of movies you can specify a delay factor that is applied to all
|
||||
@ -270,7 +273,7 @@ I transcoded was 0.2 seconds out of sync at the end of the movie which
|
||||
was 77340 frames long. At 29.97fps 0.2 seconds correspond to approx. 6
|
||||
frames. So I did
|
||||
.LP
|
||||
$ \fBmkvmerge -o goodsync.mkv -s 0,77346/77340 outofsync.mkv\fP
|
||||
$ \fBmkvmerge -o goodsync.mkv -s 23456:0,77346/77340 outofsync.mkv\fP
|
||||
.LP
|
||||
The result was fine.
|
||||
.LP
|
||||
@ -385,6 +388,10 @@ or \fBmkvmerge \-\-identify\fR. It is \fBnot\fR the track UID.
|
||||
The special track ID '-1' is a wildcard and applies the given switch to all
|
||||
tracks that are read from an input file. This was the bahviour of these
|
||||
switches prior to version 0.4.4.
|
||||
.LP
|
||||
The options that use the track IDs are: \fB\-\-atracks\fR, \fB\-\-vtracks\fR,
|
||||
\fB\-\-stracks\fR, \fB\-\-sync\fR, \fB\-\-default-track\fR, \fB\-\-cues\fR
|
||||
and \fB\-\-language\fR.
|
||||
|
||||
.SH NOTES
|
||||
.LP
|
||||
|
63
mkvmerge.cpp
63
mkvmerge.cpp
@ -346,10 +346,11 @@ static void usage(void) {
|
||||
" linear drifts. p defaults to 1000 if\n"
|
||||
" omitted. Both o and p can be floating point\n"
|
||||
" numbers.\n"
|
||||
" --default-track Sets the 'default' flag for this track.\n"
|
||||
" --cues <none|iframes| Create cue (index) entries for this track:\n"
|
||||
" all> None at all, only for I frames, for all.\n"
|
||||
" --language <lang> Sets the language for the track (ISO639-2\n"
|
||||
" --default-track <TID> Sets the 'default' flag for this track.\n"
|
||||
" --cues <TID:none|iframes|all>\n"
|
||||
" Create cue (index) entries for this track:\n"
|
||||
" None at all, only for I frames, for all.\n"
|
||||
" --language <TID:lang> Sets the language for the track (ISO639-2\n"
|
||||
" code, see --list-languages).\n"
|
||||
"\n Options that only apply to video tracks:\n"
|
||||
" -f, --fourcc <FOURCC> Forces the FourCC to the specified value.\n"
|
||||
@ -420,12 +421,6 @@ static int get_type(char *filename) {
|
||||
type = TYPEDTS;
|
||||
else if (aac_reader_c::probe_file(mm_io, size))
|
||||
type = TYPEAAC;
|
||||
// else if (microdvd_reader_c::probe_file(mm_io, size))
|
||||
// type = TYPEMICRODVD;
|
||||
// else if (vobsub_reader_c::probe_file(mm_io, size))
|
||||
// type = TYPEVOBSUB;
|
||||
// else if (chapter_information_probe(mm_io, size))
|
||||
// type = TYPECHAPTERS;
|
||||
else
|
||||
type = TYPEUNKNOWN;
|
||||
|
||||
@ -639,6 +634,35 @@ static void parse_split(const char *arg) {
|
||||
split_by_time = false;
|
||||
}
|
||||
|
||||
static void parse_cues(char *s, cue_creation_t *cues) {
|
||||
char *colon;
|
||||
|
||||
// Extract the track number.
|
||||
if ((colon = strchr(s, ':')) == NULL) {
|
||||
fprintf(stderr, "Error: Invalid cues option. No track ID specified (%s)."
|
||||
"\n", s);
|
||||
exit(1);
|
||||
}
|
||||
*colon = 0;
|
||||
cues->id = strtol(s, NULL, 10);
|
||||
s = &colon[1];
|
||||
if (*s == 0) {
|
||||
fprintf(stderr, "Error: Invalid cues option specified.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!strcmp(s, "all"))
|
||||
cues->cues = CUES_ALL;
|
||||
else if (!strcmp(s, "iframes"))
|
||||
cues->cues = CUES_IFRAMES;
|
||||
else if (!strcmp(s, "none"))
|
||||
cues->cues = CUES_NONE;
|
||||
else {
|
||||
fprintf(stderr, "Error: '%s' is an unsupported argument for --cues.\n", s);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
static void render_headers(mm_io_c *out, bool last_file, bool first_file) {
|
||||
EbmlHead head;
|
||||
int i;
|
||||
@ -861,10 +885,11 @@ static void parse_args(int argc, char **argv) {
|
||||
filelist_t *file;
|
||||
char *s;
|
||||
audio_sync_t async;
|
||||
cue_creation_t cues;
|
||||
|
||||
memset(&ti, 0, sizeof(track_info_t));
|
||||
ti.audio_syncs = new vector<audio_sync_t>;
|
||||
ti.cues = CUES_UNSPECIFIED;
|
||||
ti.cue_creations = new vector<cue_creation_t>;
|
||||
ti.aspect_ratio = 1.0;
|
||||
ti.atracks = new vector<int64_t>;
|
||||
ti.vtracks = new vector<int64_t>;
|
||||
@ -1111,17 +1136,8 @@ static void parse_args(int argc, char **argv) {
|
||||
fprintf(stderr, "Error: --cues lacks its argument.\n");
|
||||
exit(1);
|
||||
}
|
||||
if (!strcmp(argv[i + 1], "all"))
|
||||
ti.cues = CUES_ALL;
|
||||
else if (!strcmp(argv[i + 1], "iframes"))
|
||||
ti.cues = CUES_IFRAMES;
|
||||
else if (!strcmp(argv[i + 1], "none"))
|
||||
ti.cues = CUES_NONE;
|
||||
else {
|
||||
fprintf(stderr, "Error: '%s' is an unsupported argument for --cues.\n",
|
||||
argv[i + 1]);
|
||||
exit(1);
|
||||
}
|
||||
parse_cues(argv[i + 1], &cues);
|
||||
ti.cue_creations->push_back(cues);
|
||||
i++;
|
||||
|
||||
} else if (!strcmp(argv[i], "--default-track"))
|
||||
@ -1193,9 +1209,10 @@ static void parse_args(int argc, char **argv) {
|
||||
delete ti.vtracks;
|
||||
delete ti.stracks;
|
||||
delete ti.audio_syncs;
|
||||
delete ti.cue_creations;
|
||||
memset(&ti, 0, sizeof(track_info_t));
|
||||
ti.audio_syncs = new vector<audio_sync_t>;
|
||||
ti.cues = CUES_UNSPECIFIED;
|
||||
ti.cue_creations = new vector<cue_creation_t>;
|
||||
ti.aspect_ratio = 1.0;
|
||||
ti.atracks = new vector<int64_t>;
|
||||
ti.vtracks = new vector<int64_t>;
|
||||
|
@ -31,6 +31,7 @@ generic_packetizer_c::generic_packetizer_c(generic_reader_c *nreader,
|
||||
track_info_t *nti) throw(error_c) {
|
||||
int i;
|
||||
audio_sync_t *as;
|
||||
cue_creation_t *cc;
|
||||
|
||||
#ifdef DEBUG
|
||||
debug_c::add_packetizer(this);
|
||||
@ -54,6 +55,16 @@ generic_packetizer_c::generic_packetizer_c(generic_reader_c *nreader,
|
||||
}
|
||||
}
|
||||
|
||||
// Let's see if the user has given a default track flag for this track.
|
||||
ti->cues = CUES_UNSPECIFIED;
|
||||
for (i = 0; i < ti->cue_creations->size(); i++) {
|
||||
cc = &(*ti->cue_creations)[i];
|
||||
if ((cc->id == ti->id) || (cc->id == -1)) { // -1 == all tracks
|
||||
ti->cues = cc->cues;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Set default header values to 'unset'.
|
||||
hserialno = track_number++;
|
||||
huid = 0;
|
||||
@ -476,6 +487,7 @@ track_info_t *duplicate_track_info(track_info_t *src) {
|
||||
dst->vtracks = new vector<int64_t>(*src->vtracks);
|
||||
dst->stracks = new vector<int64_t>(*src->stracks);
|
||||
dst->audio_syncs = new vector<audio_sync_t>(*src->audio_syncs);
|
||||
dst->cue_creations = new vector<cue_creation_t>(*src->cue_creations);
|
||||
dst->private_data = (unsigned char *)safememdup(src->private_data,
|
||||
src->private_size);
|
||||
dst->language = safestrdup(src->language);
|
||||
@ -493,6 +505,7 @@ void free_track_info(track_info_t *ti) {
|
||||
delete ti->vtracks;
|
||||
delete ti->stracks;
|
||||
delete ti->audio_syncs;
|
||||
delete ti->cue_creations;
|
||||
safefree(ti->private_data);
|
||||
safefree(ti->language);
|
||||
safefree(ti->sub_charset);
|
||||
|
@ -54,6 +54,11 @@ typedef struct {
|
||||
void *source;
|
||||
} packet_t;
|
||||
|
||||
typedef struct {
|
||||
int cues;
|
||||
int64_t id;
|
||||
} cue_creation_t;
|
||||
|
||||
typedef struct {
|
||||
// The track ID.
|
||||
int64_t id;
|
||||
@ -62,7 +67,6 @@ typedef struct {
|
||||
char *fname;
|
||||
bool no_audio, no_video, no_subs;
|
||||
vector<int64_t> *atracks, *vtracks, *stracks;
|
||||
int cues;
|
||||
|
||||
// Options used by the packetizers.
|
||||
unsigned char *private_data;
|
||||
@ -74,6 +78,9 @@ typedef struct {
|
||||
vector<audio_sync_t> *audio_syncs;
|
||||
audio_sync_t async;
|
||||
|
||||
vector<cue_creation_t> *cue_creations;
|
||||
int cues;
|
||||
|
||||
int default_track;
|
||||
|
||||
char *language, *sub_charset;
|
||||
|
Loading…
Reference in New Issue
Block a user