... | ... |
@@ -1536,6 +1536,29 @@ int check_stream_specifier(AVFormatContext *s, AVStream *st, const char *spec) |
1536 | 1536 |
spec += 2; |
1537 | 1537 |
stream_id = strtol(spec, &endptr, 0); |
1538 | 1538 |
return stream_id == st->id; |
1539 |
+ } else if (*spec == 'm' && *(spec + 1) == ':') { |
|
1540 |
+ AVDictionaryEntry *tag; |
|
1541 |
+ char *key, *val; |
|
1542 |
+ int ret; |
|
1543 |
+ |
|
1544 |
+ spec += 2; |
|
1545 |
+ val = strchr(spec, ':'); |
|
1546 |
+ |
|
1547 |
+ key = val ? av_strndup(spec, val - spec) : av_strdup(spec); |
|
1548 |
+ if (!key) |
|
1549 |
+ return AVERROR(ENOMEM); |
|
1550 |
+ |
|
1551 |
+ tag = av_dict_get(st->metadata, key, NULL, 0); |
|
1552 |
+ if (tag) { |
|
1553 |
+ if (!val || !strcmp(tag->value, val + 1)) |
|
1554 |
+ ret = 1; |
|
1555 |
+ else |
|
1556 |
+ ret = 0; |
|
1557 |
+ } else |
|
1558 |
+ ret = 0; |
|
1559 |
+ |
|
1560 |
+ av_freep(&key); |
|
1561 |
+ return ret; |
|
1539 | 1562 |
} else if (!*spec) /* empty specifier, matches everything */ |
1540 | 1563 |
return 1; |
1541 | 1564 |
|
... | ... |
@@ -720,6 +720,11 @@ To map all the streams except the second audio, use negative mappings |
720 | 720 |
avconv -i INPUT -map 0 -map -0:a:1 OUTPUT |
721 | 721 |
@end example |
722 | 722 |
|
723 |
+To pick the English audio stream: |
|
724 |
+@example |
|
725 |
+avconv -i INPUT -map 0:m:language:eng OUTPUT |
|
726 |
+@end example |
|
727 |
+ |
|
723 | 728 |
Note that using this option disables the default mappings for this output file. |
724 | 729 |
|
725 | 730 |
@item -map_metadata[:@var{metadata_spec_out}] @var{infile}[:@var{metadata_spec_in}] (@emph{output,per-metadata}) |
... | ... |
@@ -44,6 +44,13 @@ If @var{stream_index} is given, then matches stream number @var{stream_index} in |
44 | 44 |
program with id @var{program_id}. Otherwise matches all streams in this program. |
45 | 45 |
@item i:@var{stream_id} |
46 | 46 |
Match the stream by stream id (e.g. PID in MPEG-TS container). |
47 |
+@item m:@var{key}[:@var{value}] |
|
48 |
+Matches streams with the metadata tag @var{key} having the specified value. If |
|
49 |
+@var{value} is not given, matches streams that contain the given tag with any |
|
50 |
+value. |
|
51 |
+ |
|
52 |
+Note that in @command{avconv}, matching by metadata will only work properly for |
|
53 |
+input files. |
|
47 | 54 |
@end table |
48 | 55 |
@section Generic options |
49 | 56 |
|