Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FFmpeg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
libremedia
Tethys
FFmpeg
Commits
481a3667
Commit
481a3667
authored
10 years ago
by
Anton Khirnov
Browse files
Options
Downloads
Patches
Plain Diff
cmdutils: allow matching by metadata in stream specifiers
parent
8ddc3262
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
Changelog
+1
-0
1 addition, 0 deletions
Changelog
cmdutils.c
+23
-0
23 additions, 0 deletions
cmdutils.c
doc/avconv.texi
+5
-0
5 additions, 0 deletions
doc/avconv.texi
doc/avtools-common-opts.texi
+7
-0
7 additions, 0 deletions
doc/avtools-common-opts.texi
with
36 additions
and
0 deletions
Changelog
+
1
−
0
View file @
481a3667
...
...
@@ -30,6 +30,7 @@ version <next>:
- drop avserver, it was unmaintained for years and largely broken
- Icecast protocol
- request icecast metadata by default
- support for using metadata in stream specifiers in avtools
version 10:
...
...
This diff is collapsed.
Click to expand it.
cmdutils.c
+
23
−
0
View file @
481a3667
...
...
@@ -1536,6 +1536,29 @@ int check_stream_specifier(AVFormatContext *s, AVStream *st, const char *spec)
spec
+=
2
;
stream_id
=
strtol
(
spec
,
&
endptr
,
0
);
return
stream_id
==
st
->
id
;
}
else
if
(
*
spec
==
'm'
&&
*
(
spec
+
1
)
==
':'
)
{
AVDictionaryEntry
*
tag
;
char
*
key
,
*
val
;
int
ret
;
spec
+=
2
;
val
=
strchr
(
spec
,
':'
);
key
=
val
?
av_strndup
(
spec
,
val
-
spec
)
:
av_strdup
(
spec
);
if
(
!
key
)
return
AVERROR
(
ENOMEM
);
tag
=
av_dict_get
(
st
->
metadata
,
key
,
NULL
,
0
);
if
(
tag
)
{
if
(
!
val
||
!
strcmp
(
tag
->
value
,
val
+
1
))
ret
=
1
;
else
ret
=
0
;
}
else
ret
=
0
;
av_freep
(
&
key
);
return
ret
;
}
else
if
(
!*
spec
)
/* empty specifier, matches everything */
return
1
;
...
...
This diff is collapsed.
Click to expand it.
doc/avconv.texi
+
5
−
0
View file @
481a3667
...
...
@@ -720,6 +720,11 @@ To map all the streams except the second audio, use negative mappings
avconv -i INPUT -map 0 -map -0:a:1 OUTPUT
@end example
To pick the English audio stream:
@example
avconv -i INPUT -map 0:m:language:eng OUTPUT
@end example
Note that using this option disables the default mappings for this output file.
@item -map
_
metadata[:@var
{
metadata
_
spec
_
out
}
] @var
{
infile
}
[:@var
{
metadata
_
spec
_
in
}
] (@emph
{
output,per-metadata
}
)
...
...
This diff is collapsed.
Click to expand it.
doc/avtools-common-opts.texi
+
7
−
0
View file @
481a3667
...
...
@@ -44,6 +44,13 @@ If @var{stream_index} is given, then matches stream number @var{stream_index} in
program with id @var{program_id}. Otherwise matches all streams in this program.
@item i:@var{stream_id}
Match the stream by stream id (e.g. PID in MPEG-TS container).
@item m:@var{key}[:@var{value}]
Matches streams with the metadata tag @var{key} having the specified value. If
@var{value} is not given, matches streams that contain the given tag with any
value.
Note that in @command{avconv}, matching by metadata will only work properly for
input files.
@end table
@section Generic options
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment